Removed experimentalComponentTesting flag

This commit is contained in:
Adam Gastineau
2021-03-29 10:47:52 -07:00
parent 03c8da01fa
commit fa780634ca
52 changed files with 71 additions and 153 deletions
+2 -4
View File
@@ -390,8 +390,7 @@ module.exports = {
})
program
// TODO make this command public once CT will be merged completely
.command('open-ct', { hidden: true })
.command('open-ct')
.usage('[options]')
.description('Opens Cypress component testing interactive mode.')
.option('-b, --browser <browser-path>', text('browserOpenMode'))
@@ -411,8 +410,7 @@ module.exports = {
})
program
// TODO make this command public once CT will be merged completely
.command('run-ct', { hidden: true })
.command('run-ct')
.usage('[options]')
.description('Runs all Cypress Component Testing suites')
.option('-b, --browser <browser-name-or-path>', text('browserRunMode'))
-1
View File
@@ -197,7 +197,6 @@ const parseOpts = (opts) => {
'cacheClear',
'cachePrune',
'ciBuildId',
'componentTesting',
'config',
'configFile',
'cypressVersion',
+1 -6
View File
@@ -108,11 +108,6 @@
"default": "cypress/downloads",
"description": "Path to folder where files downloaded during a test are saved"
},
"experimentalComponentTesting": {
"type": "boolean",
"default": false,
"description": "Enabled experimental component testing, see https://github.com/cypress-io/cypress/issues/5922"
},
"componentFolder": {
"type": [
"string",
@@ -288,4 +283,4 @@
"description": "Any e2e runner specific overrides"
}
}
}
}
+1 -5
View File
@@ -113,7 +113,7 @@ declare namespace Cypress {
/**
* Spec type for the given test. "integration" is the default, but
* tests run using experimentalComponentTesting will be "component"
* tests run using `open-ct` will be "component"
*
* @see https://on.cypress.io/experiments
*/
@@ -2687,10 +2687,6 @@ declare namespace Cypress {
* Path to folder containing component test files.
*/
componentFolder: string
/**
* Whether component testing is enabled.
*/
experimentalComponentTesting: boolean
/**
* Hosts mappings to IP addresses.
*/
@@ -1,6 +1,5 @@
exports['Injected overridden webpack template cypress.json'] = `
{
"experimentalComponentTesting": true,
"componentFolder": "cypress/component",
"testFiles": "**/*.spec.{js,ts,jsx,tsx}"
}
@@ -25,7 +24,6 @@ import "./commands.js";
exports['injects guessed next.js template cypress.json'] = `
{
"experimentalComponentTesting": true,
"componentFolder": "src",
"testFiles": "**/*.spec.{js,ts,jsx,tsx}"
}
@@ -240,7 +240,6 @@ describe('init component tests script', () => {
expect(injectedCode).to.equal(JSON.stringify(
{
experimentalComponentTesting: true,
componentFolder: 'cypress/component',
testFiles: '**/*.spec.{js,ts,jsx,tsx}',
},
@@ -56,7 +56,6 @@ async function injectAndShowCypressJsonConfig (
componentFolder: string,
) {
const configToInject = {
experimentalComponentTesting: true,
componentFolder,
testFiles: '**/*.spec.{js,ts,jsx,tsx}',
}
+1 -2
View File
@@ -12,7 +12,6 @@
"**/__image_snapshots__/*"
],
"componentFolder": "src",
"experimentalComponentTesting": true,
"experimentalFetchPolyfill": true,
"fixturesFolder": false
}
}
+1 -2
View File
@@ -11,6 +11,5 @@
"**/__snapshots__/*",
"**/__image_snapshots__/*"
],
"experimentalComponentTesting": true,
"experimentalFetchPolyfill": true
}
}
+2 -3
View File
@@ -3,6 +3,5 @@
"fixturesFolder": false,
"testFiles": "**/*spec.js",
"viewportWidth": 500,
"viewportHeight": 500,
"experimentalComponentTesting": true
}
"viewportHeight": 500
}
+1 -2
View File
@@ -3,10 +3,9 @@
"testFiles": "**/*.spec.{js,jsx}",
"viewportWidth": 500,
"viewportHeight": 800,
"experimentalComponentTesting": true,
"experimentalFetchPolyfill": true,
"componentFolder": "cypress/components",
"env": {
"coverage": true
}
}
}
@@ -4,6 +4,5 @@
"testFiles": "**/*cy-spec.js",
"viewportWidth": 500,
"viewportHeight": 800,
"experimentalComponentTesting": true,
"componentFolder": "cypress/component"
}
}
@@ -3,7 +3,6 @@
"testFiles": "**/*cy-spec.js",
"viewportWidth": 500,
"viewportHeight": 800,
"experimentalComponentTesting": true,
"experimentalFetchPolyfill": true,
"componentFolder": "src"
}
}
+1 -2
View File
@@ -1,8 +1,7 @@
{
"video": false,
"testFiles": "**/*spec.{ts,tsx}",
"experimentalComponentTesting": true,
"experimentalFetchPolyfill": true,
"componentFolder": "src",
"fixturesFolder": false
}
}
+1 -2
View File
@@ -4,10 +4,9 @@
"testFiles": "**/*spec.*",
"viewportWidth": 500,
"viewportHeight": 500,
"experimentalComponentTesting": true,
"componentFolder": "src",
"nodeVersion": "system",
"env": {
"coverage": true
}
}
}
+1 -2
View File
@@ -4,7 +4,6 @@
"testFiles": "**/*-spec.js",
"viewportWidth": 500,
"viewportHeight": 500,
"experimentalComponentTesting": true,
"ignoreTestFiles": [
"**/__snapshots__/*",
"**/__image_snapshots__/*"
@@ -14,4 +13,4 @@
"prettier": true
}
}
}
}
+1 -2
View File
@@ -4,9 +4,8 @@
"testFiles": "**/*cy-spec.js",
"viewportWidth": 500,
"viewportHeight": 500,
"experimentalComponentTesting": true,
"componentFolder": "src",
"env": {
"coverage": true
}
}
}
@@ -4,6 +4,5 @@
"testFiles": "**/*spec.tsx",
"viewportWidth": 500,
"viewportHeight": 500,
"experimentalComponentTesting": true,
"componentFolder": "src"
}
}
+1 -2
View File
@@ -4,6 +4,5 @@
"testFiles": "**/*spec.js",
"viewportWidth": 500,
"viewportHeight": 500,
"experimentalComponentTesting": true,
"componentFolder": "src"
}
}
@@ -4,6 +4,5 @@
"testFiles": "**/*cy-spec.js",
"viewportWidth": 1000,
"viewportHeight": 1000,
"experimentalComponentTesting": true,
"componentFolder": "src"
}
}
@@ -4,9 +4,8 @@
"testFiles": "**/*spec.js",
"viewportWidth": 1000,
"viewportHeight": 1000,
"experimentalComponentTesting": true,
"componentFolder": "src",
"env": {
"coverage": false
}
}
}
@@ -3,6 +3,5 @@
"testFiles": "**/*cy-spec.js",
"viewportWidth": 400,
"viewportHeight": 700,
"experimentalComponentTesting": true,
"componentFolder": "src"
}
}
@@ -4,6 +4,5 @@
"testFiles": "**/*cy-spec.js",
"viewportWidth": 500,
"viewportHeight": 500,
"experimentalComponentTesting": true,
"componentFolder": "src"
}
}
+2 -3
View File
@@ -3,6 +3,5 @@
"fixturesFolder": false,
"testFiles": "**/*cy-spec.js",
"viewportWidth": 500,
"viewportHeight": 500,
"experimentalComponentTesting": true
}
"viewportHeight": 500
}
@@ -3,6 +3,5 @@
"fixturesFolder": false,
"testFiles": "**/*cy-spec.js",
"viewportWidth": 500,
"viewportHeight": 500,
"experimentalComponentTesting": true
}
"viewportHeight": 500
}
+1 -2
View File
@@ -1,7 +1,6 @@
{
"experimentalComponentTesting": true,
"pluginsFile": "cypress/plugins.js",
"testFiles": "**/*.spec.*",
"componentFolder": "cypress/components",
"supportFile": "cypress/support/support.js"
}
}
+1 -2
View File
@@ -5,6 +5,5 @@
"responseTimeout": 2500,
"projectId": "134ej7",
"testFiles": "**/*spec.js",
"experimentalComponentTesting": true,
"experimentalFetchPolyfill": true
}
}
+1 -2
View File
@@ -1,6 +1,5 @@
{
"experimentalComponentTesting": true,
"componentFolder": "src",
"testFiles": "**/*.spec.ts",
"fixturesFolder": false
}
}
+1 -2
View File
@@ -1,7 +1,6 @@
{
"experimentalComponentTesting": true,
"testFiles": "**/*.spec.*",
"pluginsFile": "./plugins.js",
"componentFolder": "./src",
"componentSupportFile": "./component-helpers.js"
}
}
@@ -22,7 +22,7 @@ interface MakeWebpackConfigOptions extends CypressCTOptionsPluginOptions, UserWe
isOpenMode: boolean
}
const mergePublicPath = (baseValue, userValue = '/') => {
const mergePublicPath = (baseValue: string, userValue = '/') => {
return path.join(baseValue, userValue, '/')
}
+1 -2
View File
@@ -13,10 +13,9 @@
},
"nodeVersion": "system",
"testFiles": "**/*_spec.{js,jsx}",
"experimentalComponentTesting": true,
"componentFolder": "src",
"reporter": "../../node_modules/cypress-multi-reporters/index.js",
"reporterOptions": {
"configFile": "../../mocha-reporter-config.json"
}
}
}
-9
View File
@@ -148,15 +148,6 @@ export default class Iframes extends Component {
this.autIframe.showBlankContents()
// specs with type "component" can only arrive if the server has "componentTesting" experiment on
if (this.props.config.spec.specType === 'component') {
// In mount mode we need to render something right from spec file
// So load application tests to the aut frame
$autIframe.prop('src', specSrc)
return $autIframe
}
const $specIframe = $('<iframe />', {
id: `Your Spec: '${specSrc}'`,
class: 'spec-iframe',
@@ -1,6 +1,5 @@
{
"integrationFolder": "tests/e2e",
"experimentalComponentTesting": true,
"experimentalFetchPolyfill": true,
"timeout": 3000,
"defaultCommandTimeout": 3000,
@@ -10,4 +9,4 @@
"screenshotOnRunFailure": false,
"viewportHeight": 1000,
"viewportWidth": 1600
}
}
+2 -3
View File
@@ -1,5 +1,4 @@
{
"testFiles": "**/*.spec.*",
"componentFolder": "src",
"experimentalComponentTesting": true
}
"componentFolder": "src"
}
+4 -5
View File
@@ -74,11 +74,6 @@ export const options = [
name: 'execTimeout',
defaultValue: 60000,
validation: v.isNumber,
}, {
name: 'experimentalComponentTesting',
defaultValue: false,
validation: v.isBoolean,
isExperimental: true,
}, {
name: 'experimentalFetchPolyfill',
defaultValue: false,
@@ -304,6 +299,10 @@ export const breakingOptions = [
name: 'blacklistHosts',
errorKey: 'RENAMED_CONFIG_OPTION',
newName: 'blockHosts',
}, {
name: 'experimentalComponentTesting',
errorKey: 'EXPERIMENTAL_COMPONENT_TESTING_REMOVED',
isWarning: false,
}, {
name: 'experimentalGetCookiesSameSite',
errorKey: 'EXPERIMENTAL_SAMESITE_REMOVED',
+2 -2
View File
@@ -80,7 +80,7 @@ module.exports = {
const getSpecsHelper = () => {
// grab all of the specs if this is ci
const experimentalComponentTestingEnabled = _.get(config, 'resolved.experimentalComponentTesting.value', false)
const componentTestingEnabled = _.get(config, 'resolved.testingType.value', 'e2e') === 'component'
if (spec === '__all') {
debug('returning all specs')
@@ -91,7 +91,7 @@ module.exports = {
}))
.filter(specFilterFn)
.filter((foundSpec) => {
if (experimentalComponentTestingEnabled) {
if (componentTestingEnabled) {
return foundSpec.specType === specTypeFilter
}
-5
View File
@@ -149,11 +149,6 @@ module.exports = {
debug('from argv %o got options %o', argv, options)
// Allow for Cypress to test locally, but do not allow users to access component testing
if (options.componentTesting && !process.env.CYPRESS_INTERNAL_ENV) {
throw new Error('Component testing mode is not implemented. But coming 🥳.')
}
if (options.headless) {
// --headless is same as --headed false
if (options.headed) {
+9
View File
@@ -923,6 +923,15 @@ const getMsgByType = function (type, arg1 = {}, arg2, arg3) {
The \`experimentalGetCookiesSameSite\` configuration option was removed in Cypress version \`5.0.0\`. Yielding the \`sameSite\` property is now the default behavior of the \`cy.cookie\` commands.
You can safely remove this option from your config.`
case 'EXPERIMENTAL_COMPONENT_TESTING_REMOVED':
return stripIndent`\
The ${chalk.yellow(`\`experimentalComponentTesting\``)} configuration option was removed in Cypress version \`7.0.0\`. Please remove this flag from \`cypress.json\`.
Cypress Component Testing is now a standalone command. You can now run your component tests with:
${chalk.yellow(`\`cypress open-ct\``)}
https://on.cypress.io/migration-guide`
case 'EXPERIMENTAL_SHADOW_DOM_REMOVED':
return stripIndent`\
The \`experimentalShadowDomSupport\` configuration option was removed in Cypress version \`5.2.0\`. It is no longer necessary when utilizing the \`includeShadowDom\` option.
+2 -4
View File
@@ -46,12 +46,11 @@ interface StringValues {
* @example
```
{
experimentalComponentTesting: 'Allows mounting and testing framework-specific components'
experimentalFetchPolyfill: 'Polyfills `window.fetch` to enable Network spying and stubbing.'
}
```
*/
const _summaries: StringValues = {
experimentalComponentTesting: 'Framework-specific component testing, uses `componentFolder` to load component specs.',
experimentalFetchPolyfill: 'Polyfills `window.fetch` to enable Network spying and stubbing.',
experimentalSourceRewriting: 'Enables AST-based JS/HTML rewriting. This may fix issues caused by the existing regex-based JS/HTML replacement algorithm.',
experimentalStudio: 'Generate and save commands directly to your test suite by interacting with your app as an end user would.',
@@ -63,12 +62,11 @@ const _summaries: StringValues = {
* @example
```
{
experimentalComponentTesting: 'Component Testing'
experimentalFetchPolyfill: 'Fetch polyfill'
}
```
*/
const _names: StringValues = {
experimentalComponentTesting: 'Component Testing',
experimentalFetchPolyfill: 'Fetch polyfill',
experimentalSourceRewriting: 'Improved source rewriting',
experimentalStudio: 'Studio',
+5 -5
View File
@@ -167,9 +167,9 @@ const moduleFactory = () => {
)
}
const experimentalComponentTestingEnabled = _.get(cfg, 'resolved.experimentalComponentTesting.value', false)
const componentTestingEnabled = _.get(cfg, 'resolved.testingType.value', 'e2e') === 'component'
if (experimentalComponentTestingEnabled) {
if (componentTestingEnabled) {
// separate specs into integration and component lists
// note: _.remove modifies the array in place and returns removed elements
const component = _.remove(specs, { specType: 'component' })
@@ -222,9 +222,9 @@ const moduleFactory = () => {
const createSpecsWatcher = (cfg) => {
// TODO I keep repeating this to get the resolved value
// probably better to have a single function that does this
const experimentalComponentTestingEnabled = _.get(cfg, 'resolved.experimentalComponentTesting.value', false)
const componentTestingEnabled = _.get(cfg, 'resolved.testingType.value', 'e2e') === 'component'
debug('createSpecWatch component testing enabled', experimentalComponentTestingEnabled)
debug('createSpecWatch component testing enabled', componentTestingEnabled)
if (!this.specsWatcher) {
debug('watching integration test files: %s in %s', cfg.testFiles, cfg.integrationFolder)
@@ -240,7 +240,7 @@ const moduleFactory = () => {
this.specsWatcher.on('unlink', checkForSpecUpdates)
}
if (experimentalComponentTestingEnabled && !this.componentSpecsWatcher) {
if (componentTestingEnabled && !this.componentSpecsWatcher) {
debug('watching component test files: %s in %s', cfg.testFiles, cfg.componentFolder)
this.componentSpecsWatcher = chokidar.watch(cfg.testFiles, {
+2 -2
View File
@@ -66,9 +66,9 @@ const filesSizesAreSame = (files, index) => {
}
const componentTestingEnabled = (config) => {
const experimentalComponentTestingEnabled = _.get(config, 'resolved.experimentalComponentTesting.value', false)
const componentTestingEnabled = _.get(config, 'resolved.testingType.value', 'e2e') === 'component'
return experimentalComponentTestingEnabled && !isDefault(config, 'componentFolder')
return componentTestingEnabled && !isDefault(config, 'componentFolder')
}
const isNewProject = (integrationFolder) => {
-6
View File
@@ -308,12 +308,6 @@ module.exports = {
options.config = {}
}
// TODO: this is a quick hack to trick cypress into
// thinking experimental component testing is enabled
if (options.componentTesting) {
options.config.experimentalComponentTesting = true
}
_.extend(options.config, configValues)
// remove them from the root options object
+2 -2
View File
@@ -76,7 +76,7 @@ module.exports = {
getAbsolutePathToSpec (spec, config) {
debug('get absolute path to spec %o', { spec })
const experimentalComponentTestingEnabled = _.get(config, 'resolved.experimentalComponentTesting.value', false)
const componentTestingEnabled = _.get(config, 'resolved.testingType.value', 'e2e') === 'component'
// if our file is an integration test
// then figure out the absolute path
@@ -93,7 +93,7 @@ module.exports = {
return resolved
}
if (experimentalComponentTestingEnabled && isComponentTestRe.test(spec)) {
if (componentTestingEnabled && isComponentTestRe.test(spec)) {
spec = getRelativePathToSpec(spec)
const resolved = path.join(config.componentFolder, spec)
+1 -1
View File
@@ -94,7 +94,7 @@ module.exports = {
},
isComponentTesting (options = {}) {
return options.experimentalComponentTesting || options.componentTesting || options.testingType === 'component'
return options.testingType === 'component'
},
configFile (options = {}) {
+4 -4
View File
@@ -185,10 +185,10 @@ function findSpecsOfType (searchOptions, specPattern) {
const find = (config, specPattern) => {
const commonSearchOptions = ['fixturesFolder', 'supportFile', 'projectRoot', 'javascripts', 'testFiles', 'ignoreTestFiles']
const experimentalComponentTestingEnabled = _.get(config, 'resolved.experimentalComponentTesting.value', false)
const componentTestingEnabled = _.get(config, 'resolved.testingType.value', 'e2e') === 'component'
debug('experimentalComponentTesting %o', experimentalComponentTestingEnabled)
if (experimentalComponentTestingEnabled) {
debug('componentTesting %o', componentTestingEnabled)
if (componentTestingEnabled) {
debug('component folder %o', config.componentFolder)
// component tests are new beasts, and they change how we mount the
// code into the test frame.
@@ -211,7 +211,7 @@ const find = (config, specPattern) => {
}
const findComponentSpecs = () => {
if (!experimentalComponentTestingEnabled) {
if (!componentTestingEnabled) {
return []
}
+2 -2
View File
@@ -13,7 +13,7 @@
"repl": "node repl.js",
"start": "node ../../scripts/cypress open --dev --global",
"test": "node ./test/scripts/run.js",
"test-e2e": "node ./test/scripts/run.js --glob-in-dir=test/e2e",
"test-e2e": "node ./test/scripts/run.js ./test/unit/specs_spec.js",
"test-integration": "node ./test/scripts/run.js --glob-in-dir=test/integration",
"test-performance": "node ./test/scripts/run.js --glob-in-dir=test/performance",
"test-unit": "node ./test/scripts/run.js --glob-in-dir=test/unit",
@@ -205,4 +205,4 @@
"optionalDependencies": {
"registry-js": "1.13.0"
}
}
}
@@ -63,7 +63,6 @@ describe('e2e component tests', () => {
project,
config: {
video: false,
experimentalComponentTesting: true,
testingType: 'component',
},
expectedExitCode: 2,
@@ -1,4 +1,3 @@
{
"experimentalComponentTesting": true,
"componentFolder": "cypress/component-tests"
}
}
-2
View File
@@ -1328,7 +1328,6 @@ describe('lib/config', () => {
e2e: { from: 'default', value: {} },
env: {},
execTimeout: { value: 60000, from: 'default' },
experimentalComponentTesting: { value: false, from: 'default' },
experimentalFetchPolyfill: { value: false, from: 'default' },
experimentalSourceRewriting: { value: false, from: 'default' },
experimentalStudio: { value: false, from: 'default' },
@@ -1410,7 +1409,6 @@ describe('lib/config', () => {
downloadsFolder: { value: 'cypress/downloads', from: 'default' },
e2e: { from: 'default', value: {} },
execTimeout: { value: 60000, from: 'default' },
experimentalComponentTesting: { value: false, from: 'default' },
experimentalFetchPolyfill: { value: false, from: 'default' },
experimentalSourceRewriting: { value: false, from: 'default' },
experimentalStudio: { value: false, from: 'default' },
@@ -150,7 +150,6 @@ describe('lib/scaffold', () => {
})
it('does not create any files if using component testing', function () {
this.cfg.resolved.experimentalComponentTesting.value = true
this.cfg.resolved.componentFolder.from = 'config'
return scaffold.integration(this.integrationFolder, this.cfg)
@@ -412,7 +411,6 @@ describe('lib/scaffold', () => {
})
it('leaves out integration tests if using component testing', function () {
this.cfg.resolved.experimentalComponentTesting.value = true
this.cfg.resolved.componentFolder.from = 'config'
return scaffold.fileTree(this.cfg).then(snapshot)
@@ -115,24 +115,6 @@ describe('lib/settings', () => {
})
})
it('promises cypress.json and merges CT specific properties for via componentTesting: true', function () {
return this.setup({ a: 'b', component: { a: 'c' } })
.then(() => {
return settings.read(projectRoot, { componentTesting: true })
}).then((obj) => {
expect(obj).to.deep.eq({ a: 'c' })
})
})
it('promises cypress.json and merges CT specific properties for via experimentalComponentTesting: true', function () {
return this.setup({ a: 'b', component: { a: 'c' } })
.then(() => {
return settings.read(projectRoot, { experimentalComponentTesting: true })
}).then((obj) => {
expect(obj).to.deep.eq({ a: 'c' })
})
})
it('promises cypress.json and merges e2e specific properties', function () {
return this.setup({ a: 'b', e2e: { a: 'c' } })
.then(() => {
+3 -6
View File
@@ -62,6 +62,8 @@ describe('lib/util/specs', () => {
it('finds integration and component tests', () => {
return config.get(FixturesHelper.projectPath('component-tests'))
.then((cfg) => {
cfg.resolved.testingType = 'component'
return specsUtil.find(cfg)
}).then(R.project(['relative', 'specType']))
.then((files) => {
@@ -84,12 +86,7 @@ describe('lib/util/specs', () => {
it('finds integration tests if component testing is disabled', () => {
return config.get(FixturesHelper.projectPath('component-tests'))
.then((cfg) => {
expect(cfg.resolved.experimentalComponentTesting.value).to.be.true
cfg.resolved.experimentalComponentTesting.value = false
return specsUtil.find(cfg)
}).then(R.project(['relative', 'specType']))
.then((cfg) => specsUtil.find(cfg)).then(R.project(['relative', 'specType']))
.then((files) => {
expect(files).to.deep.equal([
{