Skip to content

chore: cypress action move #1138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/cypress-demo-nx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Run e2e
on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]
push:
branches:
- main
paths:
- 'demos/nx-next-monorepo-demo/**/*.{js,jsx,ts,tsx}'
- 'cypress/integration/nx/**/*.{ts,js}'
- 'src/**/*.{ts,js}'
jobs:
cypress:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3, 4, 5, 6]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Generate Github token
uses: navikt/github-app-token-generator@v1
id: get-token
with:
private-key: ${{ secrets.TOKENS_PRIVATE_KEY }}
app-id: ${{ secrets.TOKENS_APP_ID }}

- name: Checkout @netlify/wait-for-deploy-action
uses: actions/checkout@v2
with:
repository: netlify/wait-for-deploy-action
token: ${{ steps.get-token.outputs.token }}
path: ./.github/actions/wait-for-netlify-deploy

- name: Wait for Netlify Deploy
id: deploy
uses: ./.github/actions/wait-for-netlify-deploy
with:
site-name: netlify-plugin-nextjs-nx-monorepo-demo
timeout: 300

- name: Deploy successful
if: ${{ steps.deploy.outputs.origin-url }}
run: echo ${{ steps.deploy.outputs.origin-url }}

- name: Node
uses: actions/setup-node@v2
with:
node-version: '16'

- run: npm install

- name: Cypress run
if: ${{ steps.deploy.outputs.origin-url }}
id: cypress
uses: cypress-io/github-action@v2
with:
browser: chrome
headless: true
record: true
parallel: true
config-file: cypress/config/nx-demo.json
env:
DEBUG: '@cypress/github-action'
CYPRESS_baseUrl: ${{ steps.deploy.outputs.origin-url }}
CYPRESS_NETLIFY_CONTEXT: ${{ steps.deploy.outputs.context }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_RECORD_KEY: ${{ secrets.NX_CYPRESS_RECORD_KEY }}
70 changes: 70 additions & 0 deletions .github/workflows/cypress-demo-static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Run e2e
on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]
push:
branches:
- main
paths:
- 'demos/static-root/**/*.{js,jsx,ts,tsx}'
- 'cypress/integration/static/**/*.{ts,js}'
- 'src/**/*.{ts,js}'
jobs:
cypress:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3, 4, 5, 6]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Generate Github token
uses: navikt/github-app-token-generator@v1
id: get-token
with:
private-key: ${{ secrets.TOKENS_PRIVATE_KEY }}
app-id: ${{ secrets.TOKENS_APP_ID }}

- name: Checkout @netlify/wait-for-deploy-action
uses: actions/checkout@v2
with:
repository: netlify/wait-for-deploy-action
token: ${{ steps.get-token.outputs.token }}
path: ./.github/actions/wait-for-netlify-deploy

- name: Wait for Netlify Deploy
id: deploy
uses: ./.github/actions/wait-for-netlify-deploy
with:
site-name: netlify-plugin-nextjs-static-root-demo
timeout: 300

- name: Deploy successful
if: ${{ steps.deploy.outputs.origin-url }}
run: echo ${{ steps.deploy.outputs.origin-url }}

- name: Node
uses: actions/setup-node@v2
with:
node-version: '16'

- run: npm install

- name: Cypress run
if: ${{ steps.deploy.outputs.origin-url }}
id: cypress
uses: cypress-io/github-action@v2
with:
browser: chrome
headless: true
record: true
parallel: true
config-file: cypress/config/static-root.json
env:
DEBUG: '@cypress/github-action'
CYPRESS_baseUrl: ${{ steps.deploy.outputs.origin-url }}
CYPRESS_NETLIFY_CONTEXT: ${{ steps.deploy.outputs.context }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_RECORD_KEY: ${{ secrets.STATIC_CYPRESS_RECORD_KEY }}
70 changes: 70 additions & 0 deletions .github/workflows/cypress-demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Run e2e
on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]
push:
branches:
- main
paths:
- 'demos/default/**/*.{js,jsx,ts,tsx}'
- 'cypress/integration/default/**/*.{ts,js}'
- 'src/**/*.{ts,js}'
jobs:
cypress:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3, 4, 5, 6]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Generate Github token
uses: navikt/github-app-token-generator@v1
id: get-token
with:
private-key: ${{ secrets.TOKENS_PRIVATE_KEY }}
app-id: ${{ secrets.TOKENS_APP_ID }}

- name: Checkout @netlify/wait-for-deploy-action
uses: actions/checkout@v2
with:
repository: netlify/wait-for-deploy-action
token: ${{ steps.get-token.outputs.token }}
path: ./.github/actions/wait-for-netlify-deploy

- name: Wait for Netlify Deploy
id: deploy
uses: ./.github/actions/wait-for-netlify-deploy
with:
site-name: netlify-plugin-nextjs-demo
timeout: 300

- name: Deploy successful
if: ${{ steps.deploy.outputs.origin-url }}
run: echo ${{ steps.deploy.outputs.origin-url }}

- name: Node
uses: actions/setup-node@v2
with:
node-version: '16'

- run: npm install

- name: Cypress run
if: ${{ steps.deploy.outputs.origin-url }}
id: cypress
uses: cypress-io/github-action@v2
with:
browser: chrome
headless: true
record: true
parallel: true
config-file: cypress/config/ci.json
env:
DEBUG: '@cypress/github-action'
CYPRESS_baseUrl: ${{ steps.deploy.outputs.origin-url }}
CYPRESS_NETLIFY_CONTEXT: ${{ steps.deploy.outputs.context }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_RECORD_KEY: ${{ secrets.DEFAULT_CYPRESS_RECORD_KEY }}
6 changes: 1 addition & 5 deletions cypress/config/ci.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"baseUrl": "http://localhost:3000",
"integrationFolder": "../../cypress/integration/default",
"pluginsFile": "../../cypress/plugins",
"screenshotsFolder": "../../cypress/screenshots",
"supportFile": "../../cypress/support/index.js",
"videoFolder": "../../cypress/videos",
"integrationFolder": "cypress/integration/default",
"projectId": "66va58"
}
6 changes: 1 addition & 5 deletions cypress/config/nx-demo.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"baseUrl": "http://localhost:4200",
"integrationFolder": "../../cypress/integration/nx",
"pluginsFile": "../../cypress/plugins",
"screenshotsFolder": "../../cypress/screenshots",
"supportFile": "../../cypress/support/index.js",
"videoFolder": "../../cypress/videos",
"integrationFolder": "cypress/integration/nx",
"projectId": "ijcdpo"
}
6 changes: 1 addition & 5 deletions cypress/config/static-root.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"baseUrl": "http://localhost:3000",
"integrationFolder": "../../cypress/integration/static-root",
"pluginsFile": "../../cypress/plugins",
"screenshotsFolder": "../../cypress/screenshots",
"supportFile": "../../cypress/support/index.js",
"videoFolder": "../../cypress/videos",
"integrationFolder": "cypress/integration/static-root",
"projectId": "3tvrbe"
}
2 changes: 1 addition & 1 deletion cypress/integration/default/rewrites-redirects.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ describe('Rewrites and Redirects', () => {
it('rewrites: points /old to /', () => {
// preview mode is off by default
cy.visit('/old')
cy.findByText('Next Demo!')
cy.findByText('NextJS on Netlify (imported Header component)')
cy.url().should('eq', `${Cypress.config().baseUrl}/old/`)

// ensure headers are still set
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/default/test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ describe('TypeScript spec', () => {
})

it('loads home page', () => {
cy.findByText('Next Demo!')
cy.findByText('NextJS on Netlify (imported Header component)')
})
})
9 changes: 1 addition & 8 deletions demos/default/netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,4 @@ framework = "#static"
package = "./local-plugin"

[[plugins]]
package = "@netlify/plugin-local-install-core"

[[context.deploy-preview.plugins]]
package = "netlify-plugin-cypress"

[context.deploy-preview.plugins.inputs]
record = true
configFile = "../../cypress/config/ci.json"
package = "@netlify/plugin-local-install-core"
7 changes: 0 additions & 7 deletions demos/nx-next-monorepo-demo/netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,3 @@ TERM = "xterm"

[[plugins]]
package = "@netlify/plugin-local-install-core"

[[context.deploy-preview.plugins]]
package = "netlify-plugin-cypress"

[context.deploy-preview.plugins.inputs]
record = true
configFile = "../../cypress/config/nx-demo.json"
6 changes: 1 addition & 5 deletions demos/static-root/netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,4 @@ package = "./local-plugin"
package = "@netlify/plugin-local-install-core"

[[context.deploy-preview.plugins]]
package = "netlify-plugin-cypress"

[context.deploy-preview.plugins.inputs]
record = true
configFile = "../../cypress/config/static-root.json"
package = "netlify-plugin-cypress"