Skip to content

Commit 05592c1

Browse files
authored
Merge pull request #887 from supertokens/ci/github-actions/auth-react/v0.48.0
[v0.48.0] feat: e2e tests use containerized core
2 parents 2e11189 + f215d04 commit 05592c1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+11671
-30724
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Auth-React Tests - L1
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
push:
10+
branches:
11+
- master
12+
- "v[0-9]+.[0-9]+"
13+
tags:
14+
- "(dev-)?v[0-9]+.[0-9]+.[0-9]+"
15+
16+
jobs:
17+
define-versions:
18+
runs-on: ubuntu-latest
19+
outputs:
20+
fdiVersions: ${{ steps.versions.outputs.fdiVersions }}
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: supertokens/get-supported-versions-action@main
24+
id: versions
25+
with:
26+
has-fdi: true
27+
28+
setup-auth-react:
29+
runs-on: ubuntu-latest
30+
needs: define-versions
31+
strategy:
32+
fail-fast: true
33+
matrix:
34+
fdi-version: ${{ fromJSON(needs.define-versions.outputs.fdiVersions) }}
35+
36+
outputs:
37+
AUTH_REACT__LOG_DIR: ${{ steps.envs.outputs.AUTH_REACT__LOG_DIR }}
38+
AUTH_REACT__SCREENSHOT_DIR: ${{ steps.envs.outputs.AUTH_REACT__SCREENSHOT_DIR }}
39+
AUTH_REACT__NODE_PORT: ${{ steps.envs.outputs.AUTH_REACT__NODE_PORT }}
40+
AUTH_REACT__APP_SERVER: ${{ steps.envs.outputs.AUTH_REACT__NODE_PORT }}
41+
AUTH_REACT__TEST_MODE: ${{ steps.envs.outputs.AUTH_REACT__TEST_MODE }}
42+
AUTH_REACT__PORT: ${{ steps.envs.outputs.AUTH_REACT__PORT }}
43+
specs: ${{ steps.envs.outputs.specs }}
44+
fdiVersions: ${{ needs.define-versions.outputs.fdiVersions }}
45+
46+
steps:
47+
- uses: supertokens/get-versions-action@main
48+
id: versions
49+
with:
50+
driver-name: node
51+
fdi-version: ${{ matrix.fdi-version }}
52+
env:
53+
SUPERTOKENS_API_KEY: ${{ secrets.SUPERTOKENS_API_KEY }}
54+
55+
- uses: supertokens/auth-react-testing-action/setup@main
56+
id: envs
57+
with:
58+
# auth-react-version: ${{ steps.versions.outputs.authReactTag }}
59+
auth-react-version: ${{ github.sha }}
60+
node-sdk-version: ${{ steps.versions.outputs.nodeTag }}
61+
fdi-version: ${{ matrix.fdi-version }}
62+
use-common-app-and-test-server: "true"
63+
64+
launch-test-workflow:
65+
uses: ./.github/workflows/auth-react-test-2.yml
66+
needs: setup-auth-react
67+
name: FDI ${{ matrix.fdi-version }}
68+
strategy:
69+
max-parallel: 1 # This is important to avoid ddos GHA API
70+
fail-fast: false # Don't fail fast to avoid locking TF State
71+
matrix:
72+
fdi-version: ${{ fromJSON(needs.setup-auth-react.outputs.fdiVersions) }}
73+
with:
74+
fdi-version: ${{ matrix.fdi-version }}
75+
specs: ${{ needs.setup-auth-react.outputs.specs }}
76+
AUTH_REACT__LOG_DIR: ${{ needs.setup-auth-react.outputs.AUTH_REACT__LOG_DIR }}
77+
AUTH_REACT__SCREENSHOT_DIR: ${{ needs.setup-auth-react.outputs.AUTH_REACT__SCREENSHOT_DIR }}
78+
AUTH_REACT__APP_SERVER: ${{ needs.setup-auth-react.outputs.AUTH_REACT__APP_SERVER }}
79+
AUTH_REACT__NODE_PORT: ${{ needs.setup-auth-react.outputs.AUTH_REACT__NODE_PORT }}
80+
AUTH_REACT__TEST_MODE: ${{ needs.setup-auth-react.outputs.AUTH_REACT__TEST_MODE }}
81+
AUTH_REACT__PORT: ${{ needs.setup-auth-react.outputs.AUTH_REACT__PORT }}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Auth-React Tests - L2
2+
on:
3+
workflow_call:
4+
inputs:
5+
fdi-version:
6+
description: "FDI Version"
7+
required: true
8+
type: string
9+
10+
specs:
11+
description: "Spec Files"
12+
required: true
13+
type: string
14+
15+
AUTH_REACT__LOG_DIR:
16+
description: AUTH_REACT__LOG_DIR
17+
required: true
18+
type: string
19+
20+
AUTH_REACT__SCREENSHOT_DIR:
21+
description: AUTH_REACT__SCREENSHOT_DIR
22+
required: true
23+
type: string
24+
25+
AUTH_REACT__APP_SERVER:
26+
description: AUTH_REACT__APP_SERVER
27+
required: true
28+
type: string
29+
30+
AUTH_REACT__NODE_PORT:
31+
description: AUTH_REACT__NODE_PORT
32+
required: true
33+
type: string
34+
35+
AUTH_REACT__TEST_MODE:
36+
description: AUTH_REACT__TEST_MODE
37+
required: true
38+
type: string
39+
40+
AUTH_REACT__PORT:
41+
description: AUTH_REACT__PORT
42+
required: true
43+
type: string
44+
45+
jobs:
46+
test:
47+
runs-on: ubuntu-latest
48+
49+
strategy:
50+
max-parallel: 10
51+
fail-fast: false
52+
matrix:
53+
spec: ${{ fromJSON(inputs.specs) }}
54+
55+
env:
56+
SUPERTOKENS_CORE_PORT: 3567
57+
SUPERTOKENS_CORE_HOST: localhost
58+
TEST_MODE: testing
59+
# Auth react setup envs
60+
AUTH_REACT__LOG_DIR: ${{ inputs.AUTH_REACT__LOG_DIR }}
61+
AUTH_REACT__SCREENSHOT_DIR: ${{ inputs.AUTH_REACT__SCREENSHOT_DIR }}
62+
AUTH_REACT__NODE_PORT: ${{ inputs.AUTH_REACT__NODE_PORT }}
63+
AUTH_REACT__APP_SERVER: ${{ inputs.AUTH_REACT__NODE_PORT }}
64+
AUTH_REACT__TEST_MODE: ${{ inputs.AUTH_REACT__TEST_MODE }}
65+
AUTH_REACT__PORT: ${{ inputs.AUTH_REACT__PORT }}
66+
67+
steps:
68+
- uses: actions/checkout@v4
69+
with:
70+
path: supertokens-auth-react
71+
72+
- name: Start core
73+
run: docker compose up --wait
74+
working-directory: supertokens-auth-react
75+
76+
- uses: supertokens/auth-react-testing-action@main
77+
name: test ${{ matrix.spec }} for ${{ inputs.fdi-version }}
78+
with:
79+
fdi-version: ${{ inputs.fdi-version }}
80+
check-name-suffix: "[FDI=${{ inputs.fdi-version }}][Spec=${{ matrix.spec }}]"
81+
path: supertokens-auth-react
82+
spec: ${{ matrix.spec }}

.github/workflows/tests-visual.yml

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

.github/workflows/unit-tests.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Auth-React Unit Tests
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
push:
10+
branches:
11+
- master
12+
- "v[0-9]+.[0-9]+"
13+
tags:
14+
- "(dev-)?v[0-9]+.[0-9]+.[0-9]+"
15+
16+
jobs:
17+
unit-tests:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: 18
24+
- run: npm install
25+
- run: npm run test-unit

.mocharc.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
spec:
2-
- test/unit/**/*.test.js
3-
- test/end-to-end/**/*.test.js
4-
reporter: spec
1+
# spec:
2+
# - test/end-to-end/**/*.test.js
53
slow: 20000
6-
timeout: 30000
4+
timeout: 40000
5+
exit: true
6+
require:
7+
- "@babel/register"
8+
- test/test.mocha.env
9+
reporter: mocha-multi-reporters
10+
reporter-option:
11+
- configFile=mocha-multi-reporters.json

compose.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
services:
2+
core:
3+
# Uses `$SUPERTOKENS_CORE_VERSION` when available, else latest
4+
image: supertokens/supertokens-core:dev-branch-${SUPERTOKENS_CORE_VERSION:-master}
5+
ports:
6+
# Uses `$SUPERTOKENS_CORE_PORT` when available, else 3567 for local port
7+
- ${SUPERTOKENS_CORE_PORT:-3567}:3567
8+
platform: linux/amd64
9+
depends_on: [oauth]
10+
environment:
11+
OAUTH_PROVIDER_PUBLIC_SERVICE_URL: http://oauth:4444
12+
OAUTH_PROVIDER_ADMIN_SERVICE_URL: http://oauth:4445
13+
OAUTH_PROVIDER_CONSENT_LOGIN_BASE_URL: http://localhost:3001/auth
14+
OAUTH_CLIENT_SECRET_ENCRYPTION_KEY: asdfasdfasdfasdfasdf
15+
healthcheck:
16+
test: bash -c 'curl -s "http://127.0.0.1:3567/hello" | grep "Hello"'
17+
interval: 10s
18+
timeout: 5s
19+
retries: 5
20+
21+
oauth:
22+
image: supertokens/oauth2-test:latest
23+
platform: linux/amd64

mocha-multi-reporters.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"reporterEnabled": "mochawesome, mocha-junit-reporter",
3+
"mochaJunitReporterReporterOptions": {
4+
"mochaFile": "test_report/test-results.xml"
5+
},
6+
"mochawesomeReporterOptions": {
7+
"reportDir": "test_report/mochawesome"
8+
}
9+
}

0 commit comments

Comments
 (0)