Skip to content

Commit db57a84

Browse files
Update integration.yml (#586)
### Description - Do not use pnpm for integration tests - Currently disabled gatsby tests - Added environment configuration ### Checklist - [x] I have added documentation for new/changed functionality in this PR or in auth0.com/docs - [x] All active GitHub checks for tests, formatting, and security are passing - [x] The correct base branch is being used, if not the default branch --------- Signed-off-by: Frederik Prijck <[email protected]> Co-authored-by: Ewan Harris <[email protected]>
1 parent e4de78e commit db57a84

File tree

9 files changed

+61
-155
lines changed

9 files changed

+61
-155
lines changed

.github/actions/integration/action.yml

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

.github/workflows/integration.yml

Lines changed: 33 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
name: Integration Tests
22

33
on:
4-
# merge_group:
54
workflow_dispatch:
6-
# pull_request:
7-
# branches:
8-
# - main
9-
# push:
10-
# branches:
11-
# - main
5+
pull_request:
6+
branches:
7+
- main
8+
push:
9+
branches:
10+
- main
1211

1312
permissions:
1413
contents: read
@@ -19,69 +18,46 @@ concurrency:
1918

2019
env:
2120
NODE_VERSION: 18
22-
# Mock user credentials for Cypress tests
23-
CYPRESS_USER_EMAIL: [email protected]
24-
CYPRESS_USER_PASSWORD: mockpassword
2521

2622
jobs:
27-
test-react-router:
28-
name: Run react-router tests
23+
test-examples:
24+
name: Run example tests
2925
runs-on: ubuntu-latest
3026

3127
env:
3228
SKIP_PREFLIGHT_CHECK: true
33-
REACT_APP_DOMAIN: your-tenant.auth0.com
34-
REACT_APP_CLIENT_ID: yourclientid
35-
REACT_APP_AUDIENCE: https://api.example.com/users
36-
REACT_APP_API_PORT: 3001
29+
CYPRESS_USER_EMAIL: ${{secrets.CYPRESS_USER_EMAIL}}
30+
CYPRESS_USER_PASSWORD: ${{secrets.CYPRESS_USER_PASSWORD}}
31+
REACT_APP_DOMAIN: ${{secrets.TEST_DOMAIN}}
32+
REACT_APP_CLIENT_ID: ${{secrets.TEST_CLIENT_ID}}
33+
REACT_APP_AUDIENCE: ${{secrets.TEST_AUDIENCE}}
34+
GATSBY_DOMAIN: ${{secrets.TEST_DOMAIN}}
35+
GATSBY_CLIENT_ID: ${{secrets.TEST_CLIENT_ID}}
36+
GATSBY_AUDIENCE: ${{secrets.TEST_AUDIENCE}}
37+
NEXT_PUBLIC_DOMAIN: ${{secrets.TEST_DOMAIN}}
38+
NEXT_PUBLIC_CLIENT_ID: ${{secrets.TEST_CLIENT_ID}}
39+
NEXT_PUBLIC_AUDIENCE: ${{secrets.TEST_AUDIENCE}}
40+
DOMAIN: ${{secrets.TEST_DOMAIN}}
41+
AUDIENCE: ${{secrets.TEST_AUDIENCE}}
3742

3843
steps:
3944
- name: Checkout code
4045
uses: actions/checkout@v4
4146

42-
- name: Run integration test
43-
uses: ./.github/actions/integration
44-
with:
45-
integration: 'cra-react-router'
46-
node: ${{ env.NODE_VERSION }}
47+
- name: Install dependencies
48+
run: npm ci
4749

48-
test-gatsby:
49-
name: Run Gatsby tests
50-
runs-on: ubuntu-latest
50+
- name: Build SDK
51+
run: npm run build
5152

52-
env:
53-
GATSBY_DOMAIN: your-tenant.auth0.com
54-
GATSBY_CLIENT_ID: yourclientid
55-
GATSBY_AUDIENCE: https://api.example.com/users
56-
GATSBY_API_PORT: 3001
53+
- name: Install examples
54+
run: npm run install:examples
5755

58-
steps:
59-
- name: Checkout code
60-
uses: actions/checkout@v4
61-
62-
- name: Run integration test
63-
uses: ./.github/actions/integration
64-
with:
65-
integration: 'gatsby-app'
66-
node: ${{ env.NODE_VERSION }}
67-
dotenv: '.env.development.sample'
56+
- name: Run integration test (CRA)
57+
run: npm run test:cra
6858

69-
test-nextjs:
70-
name: Run NextJS tests
71-
runs-on: ubuntu-latest
72-
73-
env:
74-
NEXT_PUBLIC_DOMAIN: your-tenant.auth0.com
75-
NEXT_PUBLIC_CLIENT_ID: yourclientid
76-
NEXT_PUBLIC_AUDIENCE: https://api.example.com/users
77-
NEXT_PUBLIC_API_PORT: 3001
78-
79-
steps:
80-
- name: Checkout code
81-
uses: actions/checkout@v4
59+
- name: Run integration test (NextJS)
60+
run: npm run test:nextjs
8261

83-
- name: Run integration test
84-
uses: ./.github/actions/integration
85-
with:
86-
integration: 'nextjs-app'
87-
node: ${{ env.NODE_VERSION }}
62+
- name: Run integration test (Gatsby)
63+
run: npm run test:gatsby

browserstack.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
}
1818
],
1919
"run_settings": {
20-
"cypress_config_file": "./cypress.config.js",
20+
"cypress_config_file": "./cypress-bs.config.js",
2121
"cypress-version": "13.1",
2222
"project_name": "Auth0 React SDK",
2323
"exclude": [],

cypress-bs.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const { defineConfig } = require('cypress');
2+
3+
module.exports = defineConfig({
4+
defaultCommandTimeout: 7500,
5+
chromeWebSecurity: false,
6+
viewportWidth: 1000,
7+
viewportHeight: 1000,
8+
fixturesFolder: false,
9+
reporter: 'junit',
10+
reporterOptions: {
11+
mochaFile: 'test-results/cypress/junit-[hash].xml',
12+
},
13+
e2e: {
14+
setupNodeEvents(on, config) {},
15+
baseUrl: 'http://127.0.0.1:3000',
16+
supportFile: false,
17+
},
18+
});

cypress-bs.json

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

cypress.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const { defineConfig } = require('cypress');
22

33
module.exports = defineConfig({
4+
defaultCommandTimeout: 7500,
45
chromeWebSecurity: false,
56
viewportWidth: 1000,
67
viewportHeight: 1000,
@@ -14,4 +15,4 @@ module.exports = defineConfig({
1415
baseUrl: 'http://localhost:3000',
1516
supportFile: false,
1617
},
17-
});
18+
});

examples/gatsby-app/src/components/Users.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function Users() {
1010
loading,
1111
error,
1212
data: users = [],
13-
} = useApi(`http://localhost:${PORT}/users`, {
13+
} = useApi(`http://127.0.0.1:${PORT}/users`, {
1414
audience: process.env.GATSBY_AUDIENCE,
1515
scope: 'profile email read:users',
1616
});

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"start:api": "npm start --prefix=examples/users-api",
3434
"test:cra": "start-server-and-test start:api 3001 start:cra http-get://127.0.0.1:3000 cypress:run",
3535
"test:cra:watch": "start-server-and-test start:api 3001 start:cra 3000 cypress:open",
36-
"test:gatsby": "start-server-and-test start:api 3001 start:gatsby 3000 cypress:run",
36+
"test:gatsby": "start-server-and-test start:api 3001 start:gatsby http-get://localhost:3000 cypress:run",
3737
"test:gatsby:watch": "start-server-and-test start:api 3001 start:gatsby 3000 cypress:open",
3838
"test:nextjs": "start-server-and-test start:api 3001 start:nextjs 3000 cypress:run",
3939
"test:nextjs:watch": "start-server-and-test start:api 3001 start:nextjs 3000 cypress:open",
@@ -58,7 +58,7 @@
5858
"@testing-library/react": "^14.0.0",
5959
"@testing-library/react-hooks": "^7.0.2",
6060
"@types/jest": "^29.2.3",
61-
"@types/react": "^17.0.52",
61+
"@types/react": "^18.2.22",
6262
"@types/react-dom": "^18.2.7",
6363
"@typescript-eslint/eslint-plugin": "^5.45.0",
6464
"@typescript-eslint/parser": "^5.45.0",

0 commit comments

Comments
 (0)