Skip to content

Commit 913c45a

Browse files
author
Tiffany Le-Nguyen
authored
chore: cypress action move (#1138)
1 parent 968c1bc commit 913c45a

File tree

11 files changed

+217
-37
lines changed

11 files changed

+217
-37
lines changed

.github/workflows/cypress-demo-nx.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Run e2e
2+
on:
3+
pull_request:
4+
types: [opened, labeled, unlabeled, synchronize]
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- 'demos/nx-next-monorepo-demo/**/*.{js,jsx,ts,tsx}'
10+
- 'cypress/integration/nx/**/*.{ts,js}'
11+
- 'src/**/*.{ts,js}'
12+
jobs:
13+
cypress:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
containers: [1, 2, 3, 4, 5, 6]
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
23+
- name: Generate Github token
24+
uses: navikt/github-app-token-generator@v1
25+
id: get-token
26+
with:
27+
private-key: ${{ secrets.TOKENS_PRIVATE_KEY }}
28+
app-id: ${{ secrets.TOKENS_APP_ID }}
29+
30+
- name: Checkout @netlify/wait-for-deploy-action
31+
uses: actions/checkout@v2
32+
with:
33+
repository: netlify/wait-for-deploy-action
34+
token: ${{ steps.get-token.outputs.token }}
35+
path: ./.github/actions/wait-for-netlify-deploy
36+
37+
- name: Wait for Netlify Deploy
38+
id: deploy
39+
uses: ./.github/actions/wait-for-netlify-deploy
40+
with:
41+
site-name: netlify-plugin-nextjs-nx-monorepo-demo
42+
timeout: 300
43+
44+
- name: Deploy successful
45+
if: ${{ steps.deploy.outputs.origin-url }}
46+
run: echo ${{ steps.deploy.outputs.origin-url }}
47+
48+
- name: Node
49+
uses: actions/setup-node@v2
50+
with:
51+
node-version: '16'
52+
53+
- run: npm install
54+
55+
- name: Cypress run
56+
if: ${{ steps.deploy.outputs.origin-url }}
57+
id: cypress
58+
uses: cypress-io/github-action@v2
59+
with:
60+
browser: chrome
61+
headless: true
62+
record: true
63+
parallel: true
64+
config-file: cypress/config/nx-demo.json
65+
env:
66+
DEBUG: '@cypress/github-action'
67+
CYPRESS_baseUrl: ${{ steps.deploy.outputs.origin-url }}
68+
CYPRESS_NETLIFY_CONTEXT: ${{ steps.deploy.outputs.context }}
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
CYPRESS_RECORD_KEY: ${{ secrets.NX_CYPRESS_RECORD_KEY }}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Run e2e
2+
on:
3+
pull_request:
4+
types: [opened, labeled, unlabeled, synchronize]
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- 'demos/static-root/**/*.{js,jsx,ts,tsx}'
10+
- 'cypress/integration/static/**/*.{ts,js}'
11+
- 'src/**/*.{ts,js}'
12+
jobs:
13+
cypress:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
containers: [1, 2, 3, 4, 5, 6]
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
23+
- name: Generate Github token
24+
uses: navikt/github-app-token-generator@v1
25+
id: get-token
26+
with:
27+
private-key: ${{ secrets.TOKENS_PRIVATE_KEY }}
28+
app-id: ${{ secrets.TOKENS_APP_ID }}
29+
30+
- name: Checkout @netlify/wait-for-deploy-action
31+
uses: actions/checkout@v2
32+
with:
33+
repository: netlify/wait-for-deploy-action
34+
token: ${{ steps.get-token.outputs.token }}
35+
path: ./.github/actions/wait-for-netlify-deploy
36+
37+
- name: Wait for Netlify Deploy
38+
id: deploy
39+
uses: ./.github/actions/wait-for-netlify-deploy
40+
with:
41+
site-name: netlify-plugin-nextjs-static-root-demo
42+
timeout: 300
43+
44+
- name: Deploy successful
45+
if: ${{ steps.deploy.outputs.origin-url }}
46+
run: echo ${{ steps.deploy.outputs.origin-url }}
47+
48+
- name: Node
49+
uses: actions/setup-node@v2
50+
with:
51+
node-version: '16'
52+
53+
- run: npm install
54+
55+
- name: Cypress run
56+
if: ${{ steps.deploy.outputs.origin-url }}
57+
id: cypress
58+
uses: cypress-io/github-action@v2
59+
with:
60+
browser: chrome
61+
headless: true
62+
record: true
63+
parallel: true
64+
config-file: cypress/config/static-root.json
65+
env:
66+
DEBUG: '@cypress/github-action'
67+
CYPRESS_baseUrl: ${{ steps.deploy.outputs.origin-url }}
68+
CYPRESS_NETLIFY_CONTEXT: ${{ steps.deploy.outputs.context }}
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
CYPRESS_RECORD_KEY: ${{ secrets.STATIC_CYPRESS_RECORD_KEY }}

.github/workflows/cypress-demo.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Run e2e
2+
on:
3+
pull_request:
4+
types: [opened, labeled, unlabeled, synchronize]
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- 'demos/default/**/*.{js,jsx,ts,tsx}'
10+
- 'cypress/integration/default/**/*.{ts,js}'
11+
- 'src/**/*.{ts,js}'
12+
jobs:
13+
cypress:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
containers: [1, 2, 3, 4, 5, 6]
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
23+
- name: Generate Github token
24+
uses: navikt/github-app-token-generator@v1
25+
id: get-token
26+
with:
27+
private-key: ${{ secrets.TOKENS_PRIVATE_KEY }}
28+
app-id: ${{ secrets.TOKENS_APP_ID }}
29+
30+
- name: Checkout @netlify/wait-for-deploy-action
31+
uses: actions/checkout@v2
32+
with:
33+
repository: netlify/wait-for-deploy-action
34+
token: ${{ steps.get-token.outputs.token }}
35+
path: ./.github/actions/wait-for-netlify-deploy
36+
37+
- name: Wait for Netlify Deploy
38+
id: deploy
39+
uses: ./.github/actions/wait-for-netlify-deploy
40+
with:
41+
site-name: netlify-plugin-nextjs-demo
42+
timeout: 300
43+
44+
- name: Deploy successful
45+
if: ${{ steps.deploy.outputs.origin-url }}
46+
run: echo ${{ steps.deploy.outputs.origin-url }}
47+
48+
- name: Node
49+
uses: actions/setup-node@v2
50+
with:
51+
node-version: '16'
52+
53+
- run: npm install
54+
55+
- name: Cypress run
56+
if: ${{ steps.deploy.outputs.origin-url }}
57+
id: cypress
58+
uses: cypress-io/github-action@v2
59+
with:
60+
browser: chrome
61+
headless: true
62+
record: true
63+
parallel: true
64+
config-file: cypress/config/ci.json
65+
env:
66+
DEBUG: '@cypress/github-action'
67+
CYPRESS_baseUrl: ${{ steps.deploy.outputs.origin-url }}
68+
CYPRESS_NETLIFY_CONTEXT: ${{ steps.deploy.outputs.context }}
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
CYPRESS_RECORD_KEY: ${{ secrets.DEFAULT_CYPRESS_RECORD_KEY }}

cypress/config/ci.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
{
22
"baseUrl": "http://localhost:3000",
3-
"integrationFolder": "../../cypress/integration/default",
4-
"pluginsFile": "../../cypress/plugins",
5-
"screenshotsFolder": "../../cypress/screenshots",
6-
"supportFile": "../../cypress/support/index.js",
7-
"videoFolder": "../../cypress/videos",
3+
"integrationFolder": "cypress/integration/default",
84
"projectId": "66va58"
95
}

cypress/config/nx-demo.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
{
22
"baseUrl": "http://localhost:4200",
3-
"integrationFolder": "../../cypress/integration/nx",
4-
"pluginsFile": "../../cypress/plugins",
5-
"screenshotsFolder": "../../cypress/screenshots",
6-
"supportFile": "../../cypress/support/index.js",
7-
"videoFolder": "../../cypress/videos",
3+
"integrationFolder": "cypress/integration/nx",
84
"projectId": "ijcdpo"
95
}

cypress/config/static-root.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
{
22
"baseUrl": "http://localhost:3000",
3-
"integrationFolder": "../../cypress/integration/static-root",
4-
"pluginsFile": "../../cypress/plugins",
5-
"screenshotsFolder": "../../cypress/screenshots",
6-
"supportFile": "../../cypress/support/index.js",
7-
"videoFolder": "../../cypress/videos",
3+
"integrationFolder": "cypress/integration/static-root",
84
"projectId": "3tvrbe"
95
}

cypress/integration/default/rewrites-redirects.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ describe('Rewrites and Redirects', () => {
22
it('rewrites: points /old to /', () => {
33
// preview mode is off by default
44
cy.visit('/old')
5-
cy.findByText('Next Demo!')
5+
cy.findByText('NextJS on Netlify (imported Header component)')
66
cy.url().should('eq', `${Cypress.config().baseUrl}/old/`)
77

88
// ensure headers are still set

cypress/integration/default/test.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ describe('TypeScript spec', () => {
44
})
55

66
it('loads home page', () => {
7-
cy.findByText('Next Demo!')
7+
cy.findByText('NextJS on Netlify (imported Header component)')
88
})
99
})

demos/default/netlify.toml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,4 @@ framework = "#static"
1717
package = "./local-plugin"
1818

1919
[[plugins]]
20-
package = "@netlify/plugin-local-install-core"
21-
22-
[[context.deploy-preview.plugins]]
23-
package = "netlify-plugin-cypress"
24-
25-
[context.deploy-preview.plugins.inputs]
26-
record = true
27-
configFile = "../../cypress/config/ci.json"
20+
package = "@netlify/plugin-local-install-core"

demos/nx-next-monorepo-demo/netlify.toml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,3 @@ TERM = "xterm"
1919

2020
[[plugins]]
2121
package = "@netlify/plugin-local-install-core"
22-
23-
[[context.deploy-preview.plugins]]
24-
package = "netlify-plugin-cypress"
25-
26-
[context.deploy-preview.plugins.inputs]
27-
record = true
28-
configFile = "../../cypress/config/nx-demo.json"

demos/static-root/netlify.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,4 @@ package = "./local-plugin"
1818
package = "@netlify/plugin-local-install-core"
1919

2020
[[context.deploy-preview.plugins]]
21-
package = "netlify-plugin-cypress"
22-
23-
[context.deploy-preview.plugins.inputs]
24-
record = true
25-
configFile = "../../cypress/config/static-root.json"
21+
package = "netlify-plugin-cypress"

0 commit comments

Comments
 (0)