Files
cypress/system-tests/test/headless_spec.ts
T
Bill Glesias 9e698cea12 breaking: set videoCompression to false by default (#27009)
Update system-tests/projects/ts-proj-5/cypress.config.ts



Update system-tests/projects/vite-simple/cypress.config.js



Update system-tests/projects/react-vite-ts-configured/cypress.config.ts



Update system-tests/projects/svelte-vite/cypress.config.js



Update system-tests/projects/ts-proj-4-5/cypress.config.ts



Update system-tests/projects/webpack-dev-server-ts/cypress.config.ts



Update system-tests/projects/vue3-vite-ts-configured/cypress.config.ts



Update system-tests/projects/vue3-vite-ts-custom-index-html/cypress.config.ts



Update cli/CHANGELOG.md



Update cli/CHANGELOG.md

Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
2023-06-20 15:08:01 -04:00

92 lines
2.3 KiB
TypeScript

import systemTests, { BrowserName } from '../lib/system-tests'
describe('e2e headless', function () {
systemTests.setup()
describe('ELECTRON_RUN_AS_NODE', () => {
const baseSpec = {
spec: 'headless.cy.js',
config: {
env: {
'CI': process.env.CI,
'EXPECT_HEADLESS': '1',
},
},
headed: false,
processEnv: {
// Ensure that electron is spawned as a node process.
ELECTRON_RUN_AS_NODE: 1,
// Ensure that the current xserver is not passed to the test.
DISPLAY: '',
// Debug cypress:server:run to look for a message that electron/xvfb were not spawned.
DEBUG: 'cypress:server:run',
},
}
systemTests.it('pass for browsers that do not need xvfb', {
...baseSpec,
browser: ['chrome', 'firefox'],
expectedExitCode: 0,
onRun (exec) {
return exec().then(({ stderr }) => {
expect(stderr).to.include('running electron as a node process without xvfb')
})
},
})
systemTests.it('fails for browsers that do need xvfb', {
...baseSpec,
expectedExitCode: 1,
browser: ['electron'],
})
})
// cypress run --headless
systemTests.it('tests in headless mode pass', {
spec: 'headless.cy.js',
config: {
env: {
'CI': process.env.CI,
'EXPECT_HEADLESS': '1',
},
},
headed: false,
snapshot: true,
})
// NOTE: cypress run --headed
// currently, Electron differs because it displays a
// "can not record video in headed mode" error
// this trick allows us to have 1 snapshot for electron
// and 1 for every other browser
;([
'electron',
'!electron',
] as BrowserName[]).map((b) => {
systemTests.it(`tests in headed mode pass in ${b}`, {
spec: 'headless.cy.js',
config: {
env: {
'CI': process.env.CI,
},
},
expectedExitCode: 0,
headed: true,
snapshot: true,
browser: b,
})
})
systemTests.it('launches maximized by default in headless mode (1920x1080)', {
headed: false,
project: 'screen-size',
spec: 'default_size.cy.js',
})
systemTests.it('launches at DPR 1x', {
headed: false,
project: 'screen-size',
spec: 'device_pixel_ratio.cy.js',
})
})