Skip to content

Commit

Permalink
some more Cypress test improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
thecristen committed Mar 5, 2024
1 parent 3f6009c commit bd4d82c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/use-deploy-ecs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,15 @@ jobs:
- run: npx --prefix assets cypress run --spec cypress/e2e/smoke.cy.js
env:
CYPRESS_BASE_URL: ${{ needs.deploy.outputs.deployment-url }}

- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
if-no-files-found: ignore
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-videos
path: cypress/videos
if-no-files-found: ignore
1 change: 0 additions & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const port = process.env.PORT;
module.exports = {
screenshotsFolder: "cypress/snapshots/actual",
trashAssetsBeforeRuns: true,

env: {
Expand Down
18 changes: 18 additions & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,21 @@ Cypress.Screenshot.defaults({
capture: "fullPage",
disableTimersAndAnimations: false
});

Cypress.on("uncaught:exception", (err, runnable) => {
// Catch known third-party test failures

// from leaflet/react-leaflet on the schedule pages
// https://mbtace.sentry.io/issues/4903788314/
if (err.message.includes("Cannot read properties of undefined (reading '_leaflet_pos')")) {
return false
}

// from Google Translate's JS library
if (err.message.includes("Failed to execute 'createElement' on 'Document': The tag name provided ('[object Arguments]') is not a valid name.") || /translate_http/.test(err.stack)) {
return false
}

// we still want to ensure there are no other unexpected
// errors, so we let them fail the test
})

0 comments on commit bd4d82c

Please sign in to comment.