Browse Source

test: Expose set and getVariable in Cypress tests

Partial cherry pick of 4a90d5328

Signed-off-by: Louis Chemineau <louis@chmn.me>
pull/49840/head
Louis Chemineau 9 months ago
parent
commit
bb010b233b
Failed to extract signature
  1. 13
      cypress.config.ts

13
cypress.config.ts

@ -68,6 +68,19 @@ export default defineConfig({
on('task', { removeDirectory })
// This allows to store global data (e.g. the name of a snapshot)
// because Cypress.env() and other options are local to the current spec file.
const data = {}
on('task', {
setVariable({ key, value }) {
data[key] = value
return null
},
getVariable({ key }) {
return data[key] ?? null
},
})
// Disable spell checking to prevent rendering differences
on('before:browser:launch', (browser, launchOptions) => {
if (browser.family === 'chromium' && browser.name !== 'electron') {

Loading…
Cancel
Save