mirror of
https://github.com/luxfi/safe-wallet.git
synced 2026-10-30 15:19:21 +00:00
* chore: fix Argos parallel idempotency and remove Chromatic E2E - Pin ARGOS_PARALLEL_NONCE to github.run_id so retries upload to the same Argos build instead of creating a new one - Use ARGOS_PARALLEL_TOTAL=-1 with explicit finalize job so the build doesn't depend on a fixed shard count - Replace Cypress Cloud parallel mode with deterministic round-robin spec sharding so each container always runs the same specs on retry - Remove continue-on-error to surface failures - Remove Chromatic E2E workflow and @chromatic-com/cypress dependency in favor of Argos as the sole visual regression tool * chore: add reference branch/commit inputs to Argos workflow Allows specifying a custom Argos baseline branch and commit SHA when triggering the workflow manually. --------- Co-authored-by: Hanzo Dev <[email protected]>
100 lines
3.5 KiB
JavaScript
100 lines
3.5 KiB
JavaScript
// ***********************************************************
|
|
// This example support/e2e.js is processed and
|
|
// loaded automatically before your test files.
|
|
//
|
|
// This is a great place to put global configuration and
|
|
// behavior that modifies Cypress.
|
|
//
|
|
// You can change the location of this file or turn off
|
|
// automatically serving support files with the
|
|
// 'supportFile' configuration option.
|
|
//
|
|
// You can read more here:
|
|
// https://on.cypress.io/configuration
|
|
// ***********************************************************
|
|
|
|
// Import commands.js using ES2015 syntax:
|
|
import '@testing-library/cypress/add-commands'
|
|
import './commands'
|
|
import './safe-apps-commands'
|
|
import * as constants from './constants'
|
|
import * as ls from './localstorage_data'
|
|
|
|
// Alternatively you can use CommonJS syntax:
|
|
// require('./commands')
|
|
|
|
// Argos visual regression — no-op when ARGOS_TOKEN is absent
|
|
import '@argos-ci/cypress/support'
|
|
|
|
const beamer = JSON.parse(Cypress.env('BEAMER_DATA_E2E') || '{}')
|
|
const productID = beamer.PRODUCT_ID
|
|
|
|
Cypress.on('test:before:run', () => {
|
|
Cypress.automation('remote:debugger:protocol', {
|
|
command: 'Emulation.setLocaleOverride',
|
|
params: {
|
|
locale: 'en-US',
|
|
},
|
|
})
|
|
})
|
|
|
|
before(() => {
|
|
Cypress.on('uncaught:exception', (err, runnable) => {
|
|
return false
|
|
})
|
|
cy.on('log:added', (ev) => {
|
|
if (Cypress.config('hideXHR')) {
|
|
const app = window.top
|
|
if (app && !app.document.head.querySelector('[data-hide-command-log-request]')) {
|
|
const style = app.document.createElement('style')
|
|
style.innerHTML = '.command-name-request, .command-name-xhr { display: none }'
|
|
style.setAttribute('data-hide-command-log-request', '')
|
|
app.document.head.appendChild(style)
|
|
}
|
|
}
|
|
const originalConsoleLog = console.log
|
|
console.log = (...args) => {
|
|
if (typeof args[0] === 'string' && !args[0].includes('Intercepted request with headers')) {
|
|
originalConsoleLog(...args)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
beforeEach(() => {
|
|
cy.setupInterceptors()
|
|
cy.clearAllSessionStorage()
|
|
cy.clearLocalStorage()
|
|
cy.clearCookies()
|
|
|
|
cy.window().then((window) => {
|
|
const getDate = () => new Date().toISOString()
|
|
const beamerKey1 = `_BEAMER_FIRST_VISIT_${productID}`
|
|
const beamerKey2 = `_BEAMER_BOOSTED_ANNOUNCEMENT_DATE_${productID}`
|
|
const cookiesKey = 'SAFE_v2__cookies_terms'
|
|
const safeLabsTermsKey = 'SAFE_v2__safe-labs-terms'
|
|
const outreachWindowKey = 'SAFE_v2__outreachPopup_session_v2'
|
|
window.localStorage.setItem(beamerKey1, getDate())
|
|
window.localStorage.setItem(beamerKey2, getDate())
|
|
window.localStorage.setItem(cookiesKey, ls.cookies.acceptedCookies)
|
|
window.localStorage.setItem(safeLabsTermsKey, ls.safeLabsTerms.acceptedTerms)
|
|
window.localStorage.setItem(
|
|
constants.localStorageKeys.SAFE_v2__SafeApps__infoModal,
|
|
ls.appPermissions(constants.safeTestAppurl).infoModalAccepted,
|
|
)
|
|
window.sessionStorage.setItem(outreachWindowKey, Date.now())
|
|
cy.wrap(window.localStorage).invoke('getItem', cookiesKey).should('equal', ls.cookies.acceptedCookies)
|
|
})
|
|
})
|
|
|
|
// After each visual test, capture Argos screenshot.
|
|
const argosCSS = '* { scrollbar-width: none !important; } ::-webkit-scrollbar { display: none !important; }'
|
|
|
|
afterEach(() => {
|
|
const isVisualTest = Cypress.spec.relative.includes('/visual/')
|
|
if (!isVisualTest) return
|
|
|
|
// capture: 'viewport' avoids full-page scroll stitching which duplicates sticky elements
|
|
cy.argosScreenshot(Cypress.currentTest.titlePath.join(' > '), { argosCSS, capture: 'viewport' })
|
|
})
|