Skip to content

Commit 9ffa597

Browse files
authored
Merge pull request #916 from govuk-one-login/FPAD-7815-feature-tests-to-vitest2
FPAD-7815: Feature tests to vitest v2
2 parents 534f0e8 + 596772d commit 9ffa597

16 files changed

Lines changed: 2833 additions & 6571 deletions

feature-tests/Dockerfile

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
11
# Set the base image.
2-
FROM amazonlinux:latest
3-
RUN yum install -y gcc-c++ make
4-
RUN curl -sL https://rpm.nodesource.com/setup_24.x | bash -
5-
RUN yum install -y nodejs
2+
FROM amazon/aws-cli:latest
3+
RUN yum install -y gcc-c++ make && \
4+
curl -sL https://rpm.nodesource.com/setup_24.x | bash - && \
5+
yum install -y nodejs
66

7-
WORKDIR /
8-
9-
# Set up AWS CLI
10-
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
11-
unzip awscliv2.zip && \
12-
./aws/install
7+
WORKDIR /app
138

149
# COPY Files from src directory
15-
COPY package.json /package.json
16-
COPY package-lock.json /package-lock.json
17-
COPY tsconfig.json /tsconfig.json
18-
COPY jest.config.ts /jest.config.ts
19-
COPY jest-cucumber-config.js /jest-cucumber-config.js
10+
COPY package.json package-lock.json tsconfig.json vitest.config.ts /
11+
RUN npm ci
12+
2013
COPY tests/ /tests
2114
COPY apiEndpoints/ /apiEndpoints
2215
COPY utils/ /utils
16+
2317
COPY run-tests.sh /run-tests.sh
2418
RUN chmod +x /run-tests.sh
2519

26-
RUN npm install
2720
ENTRYPOINT [ "/run-tests.sh" ]

feature-tests/README.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
# DI Accounts - VC Storage Tests - JEST Supertest API Test Framework
1+
# DI Accounts - VC Storage Tests - Vitest Supertest API Test Framework
22

3-
Jest is a JavaScript Testing Framework with a focus on simplicity, which can also be used with TypeScript.
3+
Vitest is a JavaScript Testing Framework with a focus on simplicity, which can also be used with TypeScript.
44
Supertest allows for HTTP assertions.
55

6-
#### The purpose of this project is automate API functionality of the VC Storage Solution. The framework configurations can be found in jest-cucumber-config.js file in the feature-tests folder of the project.
6+
#### The purpose of this project is automate API functionality of the VC Storage Solution.
77

88
## This project uses:
99

10-
- Cucumber-Jest
10+
- Cucumber
11+
- Vitest
1112
- Supertest
1213
- Typescript
1314
- npm
@@ -33,7 +34,7 @@ Then sign-in into AWS account.
3334
aws sso login --profile $AWS_PROFILE
3435
```
3536

36-
To run all API tests locally in Jest via Jest.
37+
To run all API tests locally in Vitest via Vitest.
3738

3839
```shell
3940
npm test
@@ -60,6 +61,22 @@ once the docker image is built, run the following the execute the dockerfile
6061
docker run account-intervention-service-feature-tests-image:latest
6162
```
6263

64+
To run the feature tests with the correct environment variables and using the AWS profile from your local machine
65+
66+
```shell
67+
docker run --rm -it \
68+
-v ~/.aws:/root/.aws:ro \
69+
-e AWS_PROFILE=default \
70+
-e TEST_ENVIRONMENT=dev \
71+
-e SAM_STACK_NAME=ais-main \
72+
-e AWS_REGION=eu-west-2 \
73+
-e AWS_PROFILE=dev \
74+
-e tagFilter=@regression \
75+
-e USE_PRIVATE_API_GATEWAY=true \
76+
--dns 25.25.25.25 \
77+
account-intervention-service-feature-tests-image
78+
```
79+
6380
## Environment configuration
6481

6582
If new values are added to **endpoints.ts**, associated values will then need to be added to the main template

feature-tests/jest-cucumber-config.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

feature-tests/jest.config.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)