diff --git a/.github/workflows/cypress-demo-nx.yml b/.github/workflows/cypress-demo-nx.yml new file mode 100644 index 0000000000..5919d302b7 --- /dev/null +++ b/.github/workflows/cypress-demo-nx.yml @@ -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 }} diff --git a/.github/workflows/cypress-demo-static.yml b/.github/workflows/cypress-demo-static.yml new file mode 100644 index 0000000000..57bd169249 --- /dev/null +++ b/.github/workflows/cypress-demo-static.yml @@ -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 }} diff --git a/.github/workflows/cypress-demo.yml b/.github/workflows/cypress-demo.yml new file mode 100644 index 0000000000..f3485aaa56 --- /dev/null +++ b/.github/workflows/cypress-demo.yml @@ -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 }} diff --git a/cypress/config/ci.json b/cypress/config/ci.json index edc4eaeb7f..7d2ef0c958 100644 --- a/cypress/config/ci.json +++ b/cypress/config/ci.json @@ -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" } \ No newline at end of file diff --git a/cypress/config/nx-demo.json b/cypress/config/nx-demo.json index b72b2ca9b2..61105cf2d8 100644 --- a/cypress/config/nx-demo.json +++ b/cypress/config/nx-demo.json @@ -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" } \ No newline at end of file diff --git a/cypress/config/static-root.json b/cypress/config/static-root.json index b9cc14fcf1..a1fdbfc88a 100644 --- a/cypress/config/static-root.json +++ b/cypress/config/static-root.json @@ -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" } diff --git a/cypress/integration/default/rewrites-redirects.spec.ts b/cypress/integration/default/rewrites-redirects.spec.ts index bf62ef27b3..1462f7aef0 100644 --- a/cypress/integration/default/rewrites-redirects.spec.ts +++ b/cypress/integration/default/rewrites-redirects.spec.ts @@ -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 diff --git a/cypress/integration/default/test.spec.ts b/cypress/integration/default/test.spec.ts index 341034cb44..4e54c77fe7 100644 --- a/cypress/integration/default/test.spec.ts +++ b/cypress/integration/default/test.spec.ts @@ -4,6 +4,6 @@ describe('TypeScript spec', () => { }) it('loads home page', () => { - cy.findByText('Next Demo!') + cy.findByText('NextJS on Netlify (imported Header component)') }) }) \ No newline at end of file diff --git a/demos/default/netlify.toml b/demos/default/netlify.toml index 48c7461d28..5d29f00779 100644 --- a/demos/default/netlify.toml +++ b/demos/default/netlify.toml @@ -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" \ No newline at end of file diff --git a/demos/nx-next-monorepo-demo/netlify.toml b/demos/nx-next-monorepo-demo/netlify.toml index ee3c16d70e..04b61ce83d 100644 --- a/demos/nx-next-monorepo-demo/netlify.toml +++ b/demos/nx-next-monorepo-demo/netlify.toml @@ -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" diff --git a/demos/static-root/netlify.toml b/demos/static-root/netlify.toml index 6270955a9d..288149fe89 100644 --- a/demos/static-root/netlify.toml +++ b/demos/static-root/netlify.toml @@ -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" \ No newline at end of file