From 42baf2881e97f5a7f9364d4d8a9cac8e45490e86 Mon Sep 17 00:00:00 2001 From: Oliver Barnwell Date: Mon, 23 Sep 2024 22:34:13 +0100 Subject: [PATCH] remove firefox from our ci pipeline --- .github/workflows/cypress-e2e-firefox.yml | 76 ----------------------- cypress.config.ts | 10 --- cypress/e2e/desktop/index.cy.ts | 19 ++---- cypress/e2e/mobile/edit.cy.ts | 37 ++++------- cypress/e2e/mobile/index.cy.ts | 49 ++++----------- 5 files changed, 30 insertions(+), 161 deletions(-) delete mode 100644 .github/workflows/cypress-e2e-firefox.yml diff --git a/.github/workflows/cypress-e2e-firefox.yml b/.github/workflows/cypress-e2e-firefox.yml deleted file mode 100644 index 87a595668..000000000 --- a/.github/workflows/cypress-e2e-firefox.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: E2E Cypress Tests (Firefox) -on: - push: - branches: - - main - pull_request: -jobs: - cypress-e2e-firefox: - name: Cypress E2E Firefox - runs-on: ubuntu-latest - # Don't run the e2e tests for dependabot prs or if the PR is not labeled as 'safe to test'. - if: ${{ github.event.pull_request.user.login != 'dependabot[bot]' }} - timeout-minutes: 15 - strategy: - # when one test fails, DO NOT cancel the other - # containers, because this will kill Cypress processes - # leaving the Dashboard hanging ... - # https://github.com/cypress-io/github-action/issues/48 - fail-fast: false - matrix: - # run 4 copies of the current job in parallel - containers: [1, 2, 3, 4, 5] - steps: - - name: Setup firefox - id: setup-firefox - uses: browser-actions/setup-firefox@v1 - with: - firefox-version: '123.0' - - name: Checkout - uses: actions/checkout@v4 - # enables use to use the cache in actions/setup-node - - uses: pnpm/action-setup@v4.0.0 - - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - cache: 'pnpm' - - name: Install dependencies - run: pnpm install - - name: Database init - uses: supabase/setup-cli@v1 - with: - version: 1.27.7 - - run: SUPABASE_SCANNER_BUFFER_SIZE=5mb supabase start - - name: Cypress run - uses: cypress-io/github-action@v4 - env: - DATABASE_NAME: toiletmap - VERCEL_URL: http://localhost:3000 - AUTH0_SECRET: ${{ secrets.AUTH0_SECRET }} - AUTH0_ISSUER_BASE_URL: https://gbptm.eu.auth0.com/ - AUTH0_CLIENT_ID: ${{ secrets.AUTH0_CLIENT_ID }} - AUTH0_CLIENT_SECRET: ${{ secrets.AUTH0_CLIENT_SECRET }} - AUTH0_AUDIENCE: https://www.toiletmap.org.uk/graphql - AUTH0_PERMISSIONS_KEY: https://toiletmap.org.uk/permissions - AUTH0_PROFILE_KEY: https://toiletmap.org.uk/profile - CYPRESS_auth0SessionCookieName: 'appSession' - CYPRESS_auth0Username: ${{ secrets.CYPRESS_AUTH0USERNAME }} - CYPRESS_auth0Password: ${{ secrets.CYPRESS_AUTH0PASSWORD }} - CYPRESS_auth0Scope: 'openid profile email' - CYPRESS_auth0Domain: 'gbptm.eu.auth0.com' - CYPRESS_auth0Audience: https://www.toiletmap.org.uk/graphql - CYPRESS_auth0ClientSecret: ${{ secrets.CYPRESS_AUTH0CLIENTSECRET }} - CYPRESS_auth0ClientId: ${{ secrets.CYPRESS_AUTH0CLIENTID }} - CYPRESS_auth0CookieSecret: ${{ secrets.CYPRESS_AUTH0COOKIESECRET }} - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - with: - build: pnpm build - start: pnpm start - wait-on: 'http://localhost:3000/' - wait-on-timeout: 60 - browser: firefox - headless: true - spec: cypress/e2e/**/*.ts - record: true - parallel: true - group: 2. Firefox diff --git a/cypress.config.ts b/cypress.config.ts index e50b8bea5..3d9dad241 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -41,16 +41,6 @@ export default defineConfig({ config = cypressBrowserPermissionsPlugin(on, config); on('before:browser:launch', (browser, launchOptions) => { - if (browser.family === 'firefox') { - // launchOptions.preferences is a map of preference names to values - // eslint-disable-next-line functional/immutable-data - launchOptions.preferences[ - 'network.proxy.testing_localhost_is_secure_when_hijacked' - ] = true; - - return launchOptions; - } - if (browser.name === 'chrome' && browser.isHeadless) { const headlessIndex = launchOptions.args.indexOf('--headless'); if (headlessIndex > -1) { diff --git a/cypress/e2e/desktop/index.cy.ts b/cypress/e2e/desktop/index.cy.ts index e1a531c10..9925c417a 100644 --- a/cypress/e2e/desktop/index.cy.ts +++ b/cypress/e2e/desktop/index.cy.ts @@ -115,7 +115,7 @@ describe('Home page tests', () => { cy.stub(win.navigator.geolocation, 'getCurrentPosition').callsFake( (callback) => { return callback({ coords: { latitude, longitude, accuracy } }); - } + }, ); }); cy.visit('/').wait(500); @@ -147,7 +147,7 @@ describe('Home page tests', () => { cy.stub(win.navigator.geolocation, 'getCurrentPosition').callsFake( (callback) => { return callback({ coords: { latitude, longitude, accuracy } }); - } + }, ); }); cy.visit('/').wait(500); @@ -177,7 +177,7 @@ describe('Home page tests', () => { cy.stub(win.navigator.geolocation, 'getCurrentPosition').callsFake( (callback) => { return callback({ coords: { latitude, longitude, accuracy } }); - } + }, ); }); cy.visit('/').wait(500); @@ -193,11 +193,6 @@ describe('Home page tests', () => { }); it('should update the accessibility overlay list when the user pans or zooms', () => { - // Disable in Firefox as the `type` command is not being recognised for some reason - if (Cypress.isBrowser('firefox')) { - return; - } - cy.visit('/').wait(500); cy.get('[data-toiletid=ddad1ed1b91d99ed2bf3bcdf]').should('exist'); cy.get('#gbptm-map').focus().wait(500); @@ -230,10 +225,6 @@ describe('Home page tests', () => { }); it('should select a toilet using the number key associated with the accessibility overlay list', () => { - // Disable in Firefox as the `type` command is not being recognised for some reason - if (Cypress.isBrowser('firefox')) { - return; - } cy.visit('/').wait(500); cy.get('[data-toiletid=ddad1ed1b91d99ed2bf3bcdf]').should('exist'); // Focus the map, turning on the accessibility overlay @@ -258,7 +249,7 @@ describe('Home page tests', () => { cy.get('#highlighted-loo').invoke('attr', 'data-toiletid', '2671'); // Check that the accessibility view is hidden cy.contains("Use number keys to show a toilet's details").should( - 'not.exist' + 'not.exist', ); cy.contains('Arrow keys pan the map').should('not.exist'); cy.contains('change the map zoom level').should('not.exist'); @@ -576,7 +567,7 @@ describe('Home page tests', () => { cy.get('[data-toiletid=ab2ebfbdadb963aed4cb3b65]').click({ force: true }); cy.intercept('POST', '/api', (req) => { expect(req.body.operationName).to.equal( - 'submitVerificationReportMutation' + 'submitVerificationReportMutation', ); }); cy.findByText('Yes').click(); diff --git a/cypress/e2e/mobile/edit.cy.ts b/cypress/e2e/mobile/edit.cy.ts index 961ce3ad8..d9544201b 100644 --- a/cypress/e2e/mobile/edit.cy.ts +++ b/cypress/e2e/mobile/edit.cy.ts @@ -24,7 +24,7 @@ describe('Edit page tests', () => { cy.contains('Align the crosshair'); cy.findByDisplayValue('outrageous webmail'); cy.findByText('happy-go-lucky toilet!! hence dead jingle!').should( - 'exist' + 'exist', ); cy.findByDisplayValue('£7.99 on entry'); @@ -68,7 +68,7 @@ describe('Edit page tests', () => { ]; const inputChoices = refs.map( - (ref, i) => `${ref[0]}:${inputStates[indexPicks[i]]}` + (ref, i) => `${ref[0]}:${inputStates[indexPicks[i]]}`, ); const detailChecks = refs.map((ref, i) => [ @@ -122,7 +122,7 @@ describe('Edit page tests', () => { cy.get('[name=friday-closes]').clear().type('23:00'); cy.findByPlaceholderText( - 'Add any other useful information about the toilet here' + 'Add any other useful information about the toilet here', ) .clear() .type('I ran out of loo roll! Otherwise good.'); @@ -153,28 +153,15 @@ describe('Edit page tests', () => { it('should update the location of the toilet to where the map is dragged', () => { cy.visit('loos/ca6249ebcd1490e2aaccc5be/edit').wait(500); - // touchstart, touchmove etc are not supported in Firefox - if (Cypress.isBrowser('firefox')) { - cy.get('#gbptm-map') - .trigger('mousedown', { which: 1, force: true }) - .trigger('mousemove', 1000, -1800, { which: 1, force: true }) - .trigger('mouseup', { force: true }) - .wait(100) - .trigger('mousedown', { which: 1, force: true }) - .trigger('mousemove', -1500, 1100, { which: 1, force: true }) - .trigger('mouseup', { force: true }) - .wait(500); - } else { - cy.get('#gbptm-map') - .trigger('touchstart', { which: 1, force: true }) - .trigger('touchmove', 1000, -1800, { which: 1, force: true }) - .trigger('touchend', { force: true }) - .wait(100) - .trigger('touchstart', { which: 1, force: true }) - .trigger('touchmove', -1500, 1100, { which: 1, force: true }) - .trigger('touchend', { force: true }) - .wait(500); - } + cy.get('#gbptm-map') + .trigger('touchstart', { which: 1, force: true }) + .trigger('touchmove', 1000, -1800, { which: 1, force: true }) + .trigger('touchend', { force: true }) + .wait(100) + .trigger('touchstart', { which: 1, force: true }) + .trigger('touchmove', -1500, 1100, { which: 1, force: true }) + .trigger('touchend', { force: true }) + .wait(500); cy.findByText('Update the toilet').click(); diff --git a/cypress/e2e/mobile/index.cy.ts b/cypress/e2e/mobile/index.cy.ts index 9b6ad35f8..f4b42a269 100644 --- a/cypress/e2e/mobile/index.cy.ts +++ b/cypress/e2e/mobile/index.cy.ts @@ -72,28 +72,15 @@ describe('Home page tests', () => { cy.get('[data-toiletid=ddad1ed1b91d99ed2bf3bcdf]').should('exist'); cy.get('[data-toiletid=cc4e5e9b83de8dd9ba87b3eb]').should('not.exist'); - // touchstart, touchmove etc are not supported in Firefox - if (Cypress.isBrowser('firefox')) { - cy.get('#gbptm-map') - .trigger('mousedown', { which: 1 }) - .trigger('mousemove', 1000, -1800, { which: 1, force: true }) - .trigger('mouseup') - .wait(100) - .trigger('mousedown', { which: 1 }) - .trigger('mousemove', -600, 1100, { which: 1, force: true }) - .trigger('mouseup') - .wait(500); - } else { - cy.get('#gbptm-map') - .trigger('touchstart', { which: 1 }) - .trigger('touchmove', 1000, -1800, { which: 1, force: true }) - .trigger('touchend') - .wait(100) - .trigger('touchstart', { which: 1 }) - .trigger('touchmove', -600, 1100, { which: 1, force: true }) - .trigger('touchend') - .wait(500); - } + cy.get('#gbptm-map') + .trigger('touchstart', { which: 1 }) + .trigger('touchmove', 1000, -1800, { which: 1, force: true }) + .trigger('touchend') + .wait(100) + .trigger('touchstart', { which: 1 }) + .trigger('touchmove', -600, 1100, { which: 1, force: true }) + .trigger('touchend') + .wait(500); cy.get('[data-toiletid=ddad1ed1b91d99ed2bf3bcdf]').should('not.exist'); cy.get('[data-toiletid=cc4e5e9b83de8dd9ba87b3eb]').should('exist'); @@ -109,7 +96,7 @@ describe('Home page tests', () => { cy.stub(win.navigator.geolocation, 'getCurrentPosition').callsFake( (callback) => { return callback({ coords: { latitude, longitude, accuracy } }); - } + }, ); }); cy.visit('/').wait(500); @@ -144,7 +131,7 @@ describe('Home page tests', () => { cy.stub(win.navigator.geolocation, 'getCurrentPosition').callsFake( (callback) => { return callback({ coords: { latitude, longitude, accuracy } }); - } + }, ); }); cy.visit('/').wait(500); @@ -165,11 +152,6 @@ describe('Home page tests', () => { }); it('should update the accessibility overlay list when the user pans or zooms', () => { - // Disable in Firefox as the `type` command is not being recognised for some reason - if (Cypress.isBrowser('firefox')) { - return; - } - cy.visit('/').wait(500); cy.get('[data-toiletid=ddad1ed1b91d99ed2bf3bcdf]').should('exist'); cy.get('#gbptm-map').focus().wait(200); @@ -193,11 +175,6 @@ describe('Home page tests', () => { }); it('should select a toilet using the number key associated with the accessibility overlay list', () => { - // Disable in Firefox as the `type` command is not being recognised for some reason - if (Cypress.isBrowser('firefox')) { - return; - } - cy.visit('/').wait(500); cy.get('[data-toiletid=ddad1ed1b91d99ed2bf3bcdf]').should('exist'); // Focus the map, turning on the accessibility overlay @@ -226,7 +203,7 @@ describe('Home page tests', () => { cy.get('#highlighted-loo').invoke('attr', 'data-toiletid', '2671'); // Check that the accessibility view is hidden cy.contains("Use number keys to show a toilet's details").should( - 'not.exist' + 'not.exist', ); cy.contains('Arrow keys pan the map').should('not.exist'); cy.contains('change the map zoom level').should('not.exist'); @@ -441,7 +418,7 @@ describe('Home page tests', () => { cy.get('[data-toiletid=ab2ebfbdadb963aed4cb3b65]').click({ force: true }); cy.intercept('POST', '/api', (req) => { expect(req.body.operationName).to.equal( - 'submitVerificationReportMutation' + 'submitVerificationReportMutation', ); }); cy.findByText('Yes').click();