Skip to content

Commit 4195baf

Browse files
authored
[e2e] Make tests runnable against dev (#1043)
Made e2e test suite runnable against the dev deployment when running locally. ## Changes - Added calls to cleanup logic after tests - Added code to change the way auth works when running against dev - Added additional environment variables that were missed before - Fixed certificate issue causing the tests to run against dev ## How to test this PR 1. Read the notes 2. Make sure all other repos are up to date 3. Pull the branch for the sbl-frontend repo 4. Update your local .env file to reflect what is in the .env.example file 5. Comment out and override the following values in your local .env with what is listed below replacing the placeholder values with their appropriate ones: - SBL_PLAYWRIGHT_TEST_TARGET="<FRONTEND_URL>" - SBL_PLAYWRIGHT_TEST_REGTECH_TARGET="<USER_FI_URL>" - SBL_PLAYWRIGHT_TEST_FILING_TARGET="<FILING_URL>" - SBL_PLAYWRIGHT_TEST_MAIL_TARGET="<MAIL_URL>" - SBL_PLAYWRIGHT_TEST_CLEANUP_TARGET="<CLEANUP_URL>" - SBL_PLAYWRIGHT_TEST_KC_TARGET="<KEYCLOAK_URL>" - SBL_PLAYWRIGHT_TEST_KC_CLI_CLIENT_SECRET="<KEYCLOAK_SECRET>" ## Notes - As long as dev is out of date and the tests have been updated then it is to be expected that you will see failures when running against dev. - As it stands at the time of this writing, there are test failures related to dev being out of date.
1 parent e0a550a commit 4195baf

23 files changed

+356
-61
lines changed

.env.example

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

.env.example.private

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
###############################################################
2+
# ONLY ADD ENVIRONMENT VARIABLES THAT ARE NOT MEANT TO BE
3+
# PACKAGED WITH AND VISIBLE TO THE CLIENT
4+
###############################################################
5+
6+
NODE_EXTRA_CA_CERTS="./e2e/certs/entrust_chain.crt.pem"
7+
8+
SBL_PLAYWRIGHT_TEST_TARGET="http://localhost:8899"
9+
SBL_PLAYWRIGHT_TEST_REGTECH_TARGET="http://localhost:8881"
10+
SBL_PLAYWRIGHT_TEST_FILING_TARGET="http://localhost:8882"
11+
SBL_PLAYWRIGHT_TEST_CLEANUP_TARGET="http://localhost:8883"
12+
SBL_PLAYWRIGHT_TEST_MAIL_TARGET="http://localhost:8765"
13+
SBL_PLAYWRIGHT_TEST_KC_TARGET="http://localhost:8880/"
14+
SBL_PLAYWRIGHT_TEST_KC_REALM="regtech"
15+
SBL_PLAYWRIGHT_TEST_KC_CLI_USERNAME="admin"
16+
SBL_PLAYWRIGHT_TEST_KC_CLI_CLIENT_ID="admin-cli"
17+
SBL_PLAYWRIGHT_TEST_KC_CLI_CLIENT_SECRET="local_test_only"
18+
SBL_PLAYWRIGHT_TEST_KC_CLI_GRANT_TYPE="client_credentials"
19+
SBL_PLAYWRIGHT_TEST_KC_ADMIN_USERNAME="admin1"
20+
SBL_PLAYWRIGHT_TEST_KC_ADMIN_PASSWORD="admin"
21+
SBL_PLAYWRIGHT_TEST_KC_ADMIN_CLIENT_ID="regtech-client"
22+
SBL_PLAYWRIGHT_TEST_KC_ADMIN_GRANT_TYPE="password"

.env.example.public

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
###############################################################
2+
# ONLY ADD ENVIRONMENT VARIABLES THAT ARE MEANT TO BE PACKAGED
3+
# WITH AND VISIBLE TO THE CLIENT
4+
###############################################################
5+
6+
SBL_DEV_PORT="8899"
7+
SBL_OIDC_AUTHORITY="http://localhost:8880/realms/regtech"
8+
SBL_OIDC_CLIENT_ID="regtech-client"
9+
SBL_OIDC_REDIRECT_URI="http://localhost:${SBL_DEV_PORT}/filing"
10+
SBL_REGTECH_BASE_URL="http://localhost:8881"
11+
SBL_FILING_BASE_URL="http://localhost:8882"
12+
SBL_CLEANUP_BASE_URL="http://localhost:8883"
13+
SBL_MAIL_BASE_URL="http://localhost:8765"
14+
SBL_LOGOUT_REDIRECT_URL=""
15+
SBL_VALIDATION_TIMEOUT_SECONDS="1200"
16+
SBL_LONGPOLLING_DELAY_SECONDS="backoff"
17+
SBL_UPLOAD_FILE_SIZE_LIMIT_BYTES="50000000"
18+
19+
SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS=false

.github/actions/setvars/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ runs:
99
using: "composite"
1010
steps:
1111
- run: |
12-
sed "" ${{ inputs.varFilePath }} >> $GITHUB_ENV
12+
sed -r "/^#/Id" ${{ inputs.varFilePath }} | sed -r "/^\s*$/Id" >> $GITHUB_ENV
1313
shell: bash

.github/variables/.env

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
1+
###############################################################
2+
# ONLY ADD ENVIRONMENT VARIABLES THAT ARE MEANT TO BE PACKAGED
3+
# WITH AND VISIBLE TO THE CLIENT BELOW
4+
###############################################################
5+
16
SBL_DEV_PORT="8899"
27
SBL_OIDC_AUTHORITY="http://localhost:8880/realms/regtech"
38
SBL_OIDC_CLIENT_ID="regtech-client"
49
SBL_OIDC_REDIRECT_URI="http://localhost:${SBL_DEV_PORT}/filing"
510
SBL_REGTECH_BASE_URL="http://localhost:8881"
6-
SBL_MAIL_BASE_URL="http://localhost:8765"
711
SBL_FILING_BASE_URL="http://localhost:8882"
12+
SBL_CLEANUP_BASE_URL="http://localhost:8883"
13+
SBL_MAIL_BASE_URL="http://localhost:8765"
814
SBL_LOGOUT_REDIRECT_URL=""
915
SBL_VALIDATION_TIMEOUT_SECONDS="1200"
1016
SBL_LONGPOLLING_DELAY_SECONDS="backoff"
1117
SBL_UPLOAD_FILE_SIZE_LIMIT_BYTES="50000000"
12-
SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS="false"
13-
SBL_PLAYWRIGHT_TEST_TARGET="http://localhost:8899"
18+
19+
SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS=false
20+
21+
###############################################################
22+
# ONLY ADD ENVIRONMENT VARIABLES THAT ARE NOT MEANT TO BE
23+
# PACKAGED WITH AND VISIBLE TO THE CLIENT BELOW
24+
###############################################################
25+
NODE_EXTRA_CA_CERTS="./e2e/certs/entrust_chain.crt.pem"
26+
27+
SBL_PLAYWRIGHT_TEST_TARGET="http://localhost:${SBL_DEV_PORT}"
28+
SBL_PLAYWRIGHT_TEST_REGTECH_TARGET="${SBL_REGTECH_BASE_URL}"
29+
SBL_PLAYWRIGHT_TEST_FILING_TARGET="${SBL_FILING_BASE_URL}"
30+
SBL_PLAYWRIGHT_TEST_CLEANUP_TARGET="${SBL_CLEANUP_BASE_URL}"
31+
SBL_PLAYWRIGHT_TEST_MAIL_TARGET="${SBL_MAIL_BASE_URL}"
1432
SBL_PLAYWRIGHT_TEST_KC_TARGET="http://localhost:8880/"
1533
SBL_PLAYWRIGHT_TEST_KC_REALM="regtech"
1634
SBL_PLAYWRIGHT_TEST_KC_CLI_USERNAME="admin"

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.env*
2-
!.env.example
2+
!.env.example.public
3+
!.env.example.private
34
node_modules
45
.DS_Store
56
dist

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ COPY --from=build-stage /usr/src/app/dist /usr/share/nginx/html
2828
COPY --from=build-stage \
2929
/usr/src/app/import-meta-env-alpine \
3030
/usr/src/app/nginx-entrypoint.sh \
31-
/usr/src/app/.env.example \
31+
/usr/src/app/.env.example.public \
3232
/usr/share/nginx/html/
3333

3434
# copy nginx configuration into template folder for env var injection

ENV-GUIDE.md

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# To start
22

3-
Make a copy of `.env.example`, rename to `.env`, and place it into the root of the project's folder.
3+
Make a copy of `.env.example.public`, rename to `.env`, and place it into the root of the project's folder.
4+
Copy the content of `.env.example.private` into the `.env` file that was just copied.
45

5-
# Required Environment Variables
6+
### Required Runtime Environment Variables
67

78
```env
89
SBL_DEV_PORT="8899"
@@ -11,13 +12,24 @@ SBL_OIDC_CLIENT_ID="regtech-client"
1112
SBL_OIDC_REDIRECT_URI="http://localhost:${SBL_DEV_PORT}/filing"
1213
SBL_REGTECH_BASE_URL="http://localhost:8881"
1314
SBL_FILING_BASE_URL="http://localhost:8882"
15+
SBL_CLEANUP_BASE_URL="http://localhost:8883"
1416
SBL_MAIL_BASE_URL="http://localhost:8765"
1517
SBL_LOGOUT_REDIRECT_URL=""
1618
SBL_VALIDATION_TIMEOUT_SECONDS="1200"
1719
SBL_LONGPOLLING_DELAY_SECONDS="backoff"
1820
SBL_UPLOAD_FILE_SIZE_LIMIT_BYTES="50000000"
19-
SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS="false"
20-
SBL_PLAYWRIGHT_TEST_TARGET="http://localhost:8899"
21+
SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS=false
22+
```
23+
24+
### Required Test Environment Variables
25+
26+
```env
27+
NODE_EXTRA_CA_CERTS="./e2e/certs/entrust_chain.crt.pem"
28+
SBL_PLAYWRIGHT_TEST_TARGET="http://localhost:${SBL_DEV_PORT}"
29+
SBL_PLAYWRIGHT_TEST_REGTECH_TARGET="${SBL_REGTECH_BASE_URL}"
30+
SBL_PLAYWRIGHT_TEST_FILING_TARGET="${SBL_FILING_BASE_URL}"
31+
SBL_PLAYWRIGHT_TEST_CLEANUP_TARGET="${SBL_CLEANUP_BASE_URL}"
32+
SBL_PLAYWRIGHT_TEST_MAIL_TARGET="${SBL_MAIL_BASE_URL}"
2133
SBL_PLAYWRIGHT_TEST_KC_TARGET="http://localhost:8880/"
2234
SBL_PLAYWRIGHT_TEST_KC_REALM="regtech"
2335
SBL_PLAYWRIGHT_TEST_KC_CLI_USERNAME="admin"
@@ -30,19 +42,44 @@ SBL_PLAYWRIGHT_TEST_KC_ADMIN_CLIENT_ID="regtech-client"
3042
SBL_PLAYWRIGHT_TEST_KC_ADMIN_GRANT_TYPE="password"
3143
```
3244

33-
### To add a new environment variable
45+
## How to add new environment variables
46+
47+
Both private and public variables will need to be added to the places listed below and in accordance with their applicable instructions
3448

35-
When adding a new env variable that needs to be used on production, there are a few places that need to be updated:
49+
### To add a new public environment variable
3650

37-
- "Required Environment Variables" section in this guide (`ENV-GUIDE.md`)
38-
- `.env.example` in the root of this repo
51+
This is where environment vairables that are meant to be visible to the client go
52+
53+
When adding a new public env variable that needs to be used on production, there are a few places that need to be updated:
54+
55+
- "Required Runtime Environment Variables" section in this guide (`ENV-GUIDE.md`)
56+
- `.env.example.public` in the root of this repo
3957
- `.github/workflows/test.yml` in this repo in the `env` section
4058
- Run `yarn start` at least once to generate types for the new env variables
4159
- `sbl-project/dev_setup/frontend.local.env` file in the `sbl-project` repo
4260
- ask a devops/backend engineer to help you update the `values.yaml` overrides
4361

44-
### To use an environment variable
62+
### To use a public environment variable
4563

4664
```js
4765
import.meta.env.SOME_KEY;
4866
```
67+
68+
### To add a new private environment variable
69+
70+
This is where environment vairables that are not meant to be visible to the client go
71+
72+
When adding a new private env variable that needs to be used on production, there are a few places that need to be updated:
73+
74+
- "Required Test Environment Variables" section in this guide (`ENV-GUIDE.md`)
75+
- `.env.example.private` in the root of this repo
76+
- `.github/workflows/test.yml` in this repo in the `env` section
77+
- Run `yarn start` at least once to generate types for the new env variables
78+
- `sbl-project/dev_setup/frontend.local.env` file in the `sbl-project` repo
79+
- ask a devops/backend engineer to help you update the `values.yaml` overrides
80+
81+
### To use a private environment variable
82+
83+
```js
84+
process.env.SOME_KEY;
85+
```

e2e/certs/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Purpose
2+
3+
The purpose of this directory and the files held within is to hold certificates from the certificate chain of the cert that will be presented by the dev deployment. The purpose of each file can be found below:
4+
5+
- entrust_g2_ca.crt.pem: Root certificate for the chain in PEM format
6+
- entrust_l1k.crt.pem: Intermediary certificate for the chain in PEM format
7+
- entrust_chain.crt.pem: Both the root and the intermediary certificates in the same file so that they can both easily be passed as Node Extra Certs

e2e/certs/entrust_chain.crt.pem

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMC
3+
VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50
4+
cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3Qs
5+
IEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVz
6+
dCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwHhcNMDkwNzA3MTcy
7+
NTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUVu
8+
dHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwt
9+
dGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0
10+
aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmlj
11+
YXRpb24gQXV0aG9yaXR5IC0gRzIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
12+
AoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP/vaCeb9zYQYKpSfYs1/T
13+
RU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXzHHfV1IWN
14+
cCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hW
15+
wcKUs/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1
16+
U1+cPvQXLOZprE4yTGJ36rfo5bs0vBmLrpxR57d+tVOx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