Files
cypress/system-tests/test/testConfigOverrides_spec.ts
T
Adam Stone-Lord 166b69414c feat: create from React component (#25168)
* feat: server logic for create from React component (#24881)

Co-authored-by: Ryan Manuel <ryanm@cypress.io>
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>

* fix: add default export detection (#24954)

Co-authored-by: astone123 <adams@cypress.io>

* update cache

* update yarn.lock to fix builds

* fix: compilation with webpack preprocessor

* feat: create from React component UI (#24982)

* feat: WIP server logic for create from React component

* feat: add more tests; error handling

* feat: WIP create from React UI

* feat: PR feedback [run CI]

* feat: try committing snapshot cache changes [run ci]

* feat: try re-generating snapshot [run ci]

* fix build

* regenerate cache on darwin

* update caches

* Revert "feat: try re-generating snapshot [run ci]"

This reverts commit d763e1f7a4.

* fix typing error

* types

* fix test

* chore: try using react-docgen@6.0.0-alpha.3

* update test

* regen linux snapshot

* update snapshots for darwin

* re-gen linux snapshot

* yarn install

* update snapshots

* update snapshot metadata

* update snapshots due to babel deps changing slightly

* make react docgen a dep

* update tests

* revert

* snapshots again??

* revert

* update

* update

* try change snapshot

* change snap

* update snap

* feat: remove unnecessary ts-ignore

* feat: add more test cases

* feat: create CodegenActions; other minor refactors

* feat: continue UI work

* feat: ignore config and Cypress-related files

* feat: PR feedback

* update Vue component link

* merge in default export work

* consolidate graphql queries

* other misc feedback

* use network-only policy to fetch files; include cypress/ dir for code gen candidates; fix type error

* add basic e2e test

* fix app integration tests

* refactor and fix app component and webpack dev server tests

* add error state; fix unit tests [skip ci]

* simplify generator show logic [skip ci]

* more testing

* fix types

* style updates [skip ci]

* fix error state [skip ci]

* fix list padding [skip ci]

* use slots (#25079)

* add more tests; fix unit tests

* fix types

* fix test describe

* add percy snapshots for new list

* update trouble rendering banner link [skip ci]

* use collapsible component

* use button for component list items

* fix tests

* build binaries

* revert changes to circle config

* remove eslintignore and extra loading div [skip ci] because we know it will fail

* revert changes to framework glob patterns [skip ci]

Co-authored-by: Ryan Manuel <ryanm@cypress.io>
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>

* feat: pass parser options to allow parsing of tsx files (#25145)

* fix create from component e2e test

* build binaries [run ci]

* fix component tests [run ci]

* regen windows snapshot

Co-authored-by: Ryan Manuel <ryanm@cypress.io>
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Zachary Williams <ZachJW34@gmail.com>
2022-12-19 12:42:14 +10:00

118 lines
3.5 KiB
TypeScript

import fs from 'fs-extra'
import path from 'path'
import systemTests, { expect, BrowserName } from '../lib/system-tests'
import Fixtures from '../lib/fixtures'
const e2ePath = Fixtures.projectPath('e2e')
const outputPath = path.join(e2ePath, 'output.json')
describe('testConfigOverrides', () => {
systemTests.setup()
systemTests.it('successfully runs valid suite-level-only overrides', {
spec: 'testConfigOverrides/valid-suite-only.js',
snapshot: true,
expectedExitCode: 0,
browser: 'electron',
config: {
video: false,
},
})
systemTests.it('fails when passing invalid config value browser', {
spec: 'testConfigOverrides/invalid-browser.js',
snapshot: true,
expectedExitCode: 1,
config: {
video: false,
},
})
systemTests.it('has originalTitle when skipped due to browser config', {
spec: 'testConfigOverrides/skip-browser.js',
snapshot: true,
outputPath,
browser: 'electron',
async onRun (exec) {
await exec()
const results = await fs.readJson(outputPath)
// make sure we've respected test title when creating title path
expect(results.runs[0].tests[0].title).deep.eq(['suite', 'is skipped due to test-level browser override'])
expect(results.runs[0].tests[1].title).deep.eq(['suite 2', 'is skipped due to suite-level browser override'])
},
})
systemTests.it('maintains runnable body when skipped due to browser config', {
spec: 'testConfigOverrides/skip-browser.js',
snapshot: true,
outputPath,
browser: 'electron',
async onRun (exec) {
await exec()
const results = await fs.readJson(outputPath)
console.log(results.runs[0].tests)
// make sure we've respected alway include test body even when skipped
expect(results.runs[0].tests[0].body).eq('() => {}')
expect(results.runs[0].tests[1].body).eq('() => {\n // do something\n }')
},
})
systemTests.it('fails when setting invalid config opt with Cypress.config() in before:test:run', {
spec: 'testConfigOverrides/invalid_before_test_event.js',
snapshot: true,
outputPath,
browser: 'electron',
expectedExitCode: 2,
})
systemTests.it('fails when setting invalid config opt with Cypress.config() in before:test:run:async', {
spec: 'testConfigOverrides/invalid_before_test_async_event.js',
snapshot: true,
outputPath,
browser: 'electron',
expectedExitCode: 2,
})
// window.Error throws differently for firefox. break into
// browser permutations for snapshot comparisons
const permutations: BrowserName[][] = [
['chrome', 'electron'],
['firefox'],
]
permutations.forEach((browserList) => {
systemTests.it(`fails when passing invalid config values - [${browserList}]`, {
spec: 'testConfigOverrides/invalid.js',
snapshot: true,
browser: browserList,
expectedExitCode: 14,
config: {
video: false,
},
})
systemTests.it(`fails when passing invalid config values with beforeEach - [${browserList}]`, {
spec: 'testConfigOverrides/before-invalid.js',
snapshot: true,
browser: browserList,
expectedExitCode: 8,
config: {
video: false,
},
})
systemTests.it(`correctly fails when invalid config values for it.only [${browserList}]`, {
spec: 'testConfigOverrides/only-invalid.js',
snapshot: true,
browser: browserList,
expectedExitCode: 1,
config: {
video: false,
},
})
})
})