diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index cba28da9b7..1529faccaf 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -135,10 +135,6 @@ jobs: persist-credentials: false path: matrix-react-sdk - # This is necessary as Cypress relies on eval for passing functions between processes - - name: Allow CSP script-src unsafe-eval - run: sed -i "s/script-src /script-src 'unsafe-eval' /" webapp/index.html - - name: Run Cypress tests uses: cypress-io/github-action@59c3b9b4a1a6e623c29806797d849845443487d1 with: diff --git a/cypress/support/axe.ts b/cypress/support/axe.ts index 4040a983d9..c0e7a6332a 100644 --- a/cypress/support/axe.ts +++ b/cypress/support/axe.ts @@ -67,3 +67,35 @@ Cypress.Commands.overwrite( ); }, ); + +// Load axe-core into the window under test. +// +// The injectAxe in cypress-axe attempts to load axe via an `eval`. That conflicts with our CSP +// which disallows "unsafe-eval". So, replace it with an implementation that loads it via an +// injected