Skip to content

Commit

Permalink
Merge branch '10.0-release' into lmiller1990/UNIFY-1402
Browse files Browse the repository at this point in the history
* 10.0-release: (25 commits)
  fix: stop running spec when switching specs (#21038)
  fix: remove asset size warnings and enable nuxt e2e tests (#21074)
  feat: swap the #__cy_root id selector to become data-cy-root for component mounting (#20951)
  fix: Doc changes around vue2 (#21066)
  feat: Add vue2 package from npm/vue/v2 branch (#21026)
  skip failing test
  fix: add possible frameworks to object API config (#21056)
  fix snapshot spacing
  fix system test
  fix snapshot
  update snapshots
  rename spec files
  rename files
  update snapshots
  release 9.5.4 [skip ci]
  fix(regression): cy.pause() should not be ignored with `cypress run --headed --no-exit` (#20877)
  fix: add missing Cypress.Commands.addAll() types (#20894)
  chore: Don't store video and screenshot artifacts for runs (#20979)
  chore: Update Chrome (beta) to 101.0.4951.26 (#20957)
  chore: remove parallelism from test-binary-against-repo jobs (#21004)
  ...
  • Loading branch information
tgriesser committed Apr 14, 2022
2 parents 10c7f92 + aa98f2e commit c190faf
Show file tree
Hide file tree
Showing 212 changed files with 4,475 additions and 107,122 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ cli/types
# cli/react, cli/vue, and cli/mount-utils are all copied from dist'd builds
cli/react
cli/vue
cli/vue2
cli/mount-utils

# packages/example is not linted (think about changing this)
Expand Down Expand Up @@ -69,6 +70,9 @@ npm/cypress-schematic/src/**/*.js
/npm/create-cypress-tests/initial-template
/npm/create-cypress-tests/**/*.template.*

# The global eslint configuration is not set up to parse vue@2 files
/npm/vue2/**/*.vue

packages/data-context/test/unit/codegen/files

# community templates we test against, no need to lint
Expand Down
1 change: 1 addition & 0 deletions .releaserc.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ module.exports = {
],
extends: 'semantic-release-monorepo',
branches: [
'master',
],
}
2 changes: 1 addition & 1 deletion browser-versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"chrome:beta": "101.0.4951.15",
"chrome:beta": "101.0.4951.26",
"chrome:stable": "100.0.4896.75"
}
36 changes: 1 addition & 35 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -695,13 +695,6 @@ commands:
name: Run tests using command
working_directory: /tmp/<<parameters.repo>>/<<parameters.folder>>
command: <<parameters.command>>

- store_artifacts:
name: screenshots
path: /tmp/<<parameters.repo>>/<<parameters.folder>>/cypress/screenshots
- store_artifacts:
name: videos
path: /tmp/<<parameters.repo>>/<<parameters.folder>>/cypress/videos
- unless:
condition: <<parameters.folder>>
steps:
Expand All @@ -719,12 +712,6 @@ commands:
name: Run tests using command
working_directory: /tmp/<<parameters.repo>>
command: <<parameters.command>>
- store_artifacts:
name: screenshots
path: /tmp/<<parameters.repo>>/cypress/screenshots
- store_artifacts:
name: videos
path: /tmp/<<parameters.repo>>/cypress/videos
- store-npm-logs

test-binary-against-repo:
Expand Down Expand Up @@ -844,13 +831,6 @@ commands:
name: Run tests using command
working_directory: /tmp/<<parameters.repo>>/<<parameters.folder>>
command: <<parameters.command>>

- store_artifacts:
name: screenshots
path: /tmp/<<parameters.repo>>/<<parameters.folder>>/cypress/screenshots
- store_artifacts:
name: videos
path: /tmp/<<parameters.repo>>/<<parameters.folder>>/cypress/videos
- unless:
condition: <<parameters.folder>>
steps:
Expand All @@ -868,12 +848,6 @@ commands:
name: Run tests using command
working_directory: /tmp/<<parameters.repo>>
command: <<parameters.command>>
- store_artifacts:
name: screenshots
path: /tmp/<<parameters.repo>>/cypress/screenshots
- store_artifacts:
name: videos
path: /tmp/<<parameters.repo>>/cypress/videos
- store-npm-logs

wait-on-circle-jobs:
Expand Down Expand Up @@ -956,7 +930,7 @@ commands:
command: ls -la types
working_directory: cli/build
- run:
command: ls -la vue mount-utils react
command: ls -la vue vue2 mount-utils react
working_directory: cli/build
- unless:
condition:
Expand Down Expand Up @@ -1565,8 +1539,6 @@ jobs:
working_directory: npm/vite-dev-server
- store_test_results:
path: npm/vite-dev-server/test_results
- store_artifacts:
path: npm/vite-dev-server/cypress/videos
- store-npm-logs

npm-webpack-batteries-included-preprocessor:
Expand Down Expand Up @@ -1774,10 +1746,6 @@ jobs:
name: Run Kitchensink example project
command: |
yarn cypress:run --project /tmp/cypress-example-kitchensink
- store_artifacts:
path: /tmp/cypress-example-kitchensink/cypress/screenshots
- store_artifacts:
path: /tmp/cypress-example-kitchensink/cypress/videos
- store-npm-logs

test-kitchensink-against-staging:
Expand Down Expand Up @@ -2020,15 +1988,13 @@ jobs:

test-binary-against-recipes-chrome:
<<: *defaults
parallelism: 3
steps:
- test-binary-against-repo:
repo: cypress-example-recipes
command: npm run test:ci:chrome

test-binary-against-recipes:
<<: *defaults
parallelism: 3
steps:
- test-binary-against-repo:
repo: cypress-example-recipes
Expand Down
3 changes: 2 additions & 1 deletion cli/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ build
# ignore packages synced at build-time via
# the sync-exported-npm-with-cli.js script
vue
vue2
react
mount-utils
mount-utils
7 changes: 6 additions & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
"types/net-stubbing.ts",
"mount-utils",
"vue",
"react"
"react",
"vue2"
],
"bin": {
"cypress": "bin/cypress"
Expand All @@ -124,6 +125,10 @@
"import": "./vue/dist/cypress-vue.esm-bundler.js",
"require": "./vue/dist/cypress-vue.cjs.js"
},
"./vue2": {
"import": "./vue2/dist/cypress-vue2.esm-bundler.js",
"require": "./vue2/dist/cypress-vue2.cjs.js"
},
"./package.json": {
"import": "./package.json",
"require": "./package.json"
Expand Down
1 change: 1 addition & 0 deletions cli/scripts/post-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const npmModulesToCopy = [
'mount-utils',
'react',
'vue',
'vue2',
]

npmModulesToCopy.forEach((folder) => {
Expand Down
2 changes: 1 addition & 1 deletion cli/scripts/post-install.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ shell.set('-e') // any error is fatal
fs.ensureDirSync(join(__dirname, '..', 'types'))

includeTypes.forEach((folder) => {
const source = resolvePkg(`@types/${folder}`, { cwd: join(__dirname, '..', '..') })
const source = resolvePkg(`@types/${folder}`, { cwd: __dirname })

fs.copySync(source, join(__dirname, '..', 'types', folder))
})
Expand Down
18 changes: 16 additions & 2 deletions cli/types/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@ declare namespace Cypress {
interface CommandFn<T extends keyof ChainableMethods> {
(this: Mocha.Context, ...args: Parameters<ChainableMethods[T]>): ReturnType<ChainableMethods[T]> | void
}
interface CommandFns {
[name: string]: (this: Mocha.Context, ...args: any) => any
}
interface CommandFnWithSubject<T extends keyof ChainableMethods, S> {
(this: Mocha.Context, prevSubject: S, ...args: Parameters<ChainableMethods[T]>): ReturnType<ChainableMethods[T]> | void
}
interface CommandFnsWithSubject<S> {
[name: string]: (this: Mocha.Context, prevSubject: S, ...args: any) => any
}
interface CommandOriginalFn<T extends keyof ChainableMethods> extends CallableFunction {
(...args: Parameters<ChainableMethods[T]>): ReturnType<ChainableMethods[T]>
}
Expand Down Expand Up @@ -467,6 +473,14 @@ declare namespace Cypress {
add<T extends keyof Chainable, S extends PrevSubject>(
name: T, options: CommandOptions & { prevSubject: S[] }, fn: CommandFnWithSubject<T, PrevSubjectMap<void>[S]>,
): void
addAll<T extends keyof Chainable>(fns: CommandFns): void
addAll<T extends keyof Chainable>(options: CommandOptions & {prevSubject: false}, fns: CommandFns): void
addAll<T extends keyof Chainable, S extends PrevSubject>(
options: CommandOptions & { prevSubject: true | S | ['optional'] }, fns: CommandFnsWithSubject<PrevSubjectMap[S]>,
): void
addAll<T extends keyof Chainable, S extends PrevSubject>(
options: CommandOptions & { prevSubject: S[] }, fns: CommandFnsWithSubject<PrevSubjectMap<void>[S]>,
): void
overwrite<T extends keyof Chainable>(name: T, fn: CommandFnWithOriginalFn<T>): void
overwrite<T extends keyof Chainable, S extends PrevSubject>(name: T, fn: CommandFnWithOriginalFnAndSubject<T, PrevSubjectMap[S]>): void
}
Expand Down Expand Up @@ -2987,11 +3001,11 @@ declare namespace Cypress {

type DevServerConfigObject = {
bundler: 'webpack'
framework: 'react'
framework: 'react' | 'vue' | 'vue-cli' | 'nuxt' | 'create-react-app'
webpackConfig?: PickConfigOpt<'webpackConfig'>
} | {
bundler: 'vite'
framework: 'react'
framework: 'react' | 'vue'
viteConfig?: Omit<Exclude<PickConfigOpt<'viteConfig'>, undefined>, 'base' | 'root'>
}

Expand Down
112 changes: 112 additions & 0 deletions cli/types/tests/cypress-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,118 @@ namespace CypressCommandsTests {
arg
return cy.wrap(new Promise<number>((resolve) => { resolve(5) }))
})

Cypress.Commands.addAll({
newCommand(arg) {
// $ExpectType any
arg
this // $ExpectType Context
return
},
newCommand2(arg, arg2) {
// $ExpectType any
arg
// $ExpectType any
arg2
},
newCommand3: (arg) => {
// $ExpectType any
arg
return
},
newCommand4: (arg) => {
// $ExpectType any
arg
},
})
Cypress.Commands.addAll({ prevSubject: true }, {
newCommand: (subject, arg) => {
subject // $ExpectType unknown
arg // $ExpectType any
return
},
})
Cypress.Commands.addAll({ prevSubject: false }, {
newCommand: (arg) => {
arg // $ExpectType any
return
},
})
Cypress.Commands.addAll({ prevSubject: 'optional' }, {
newCommand: (subject, arg) => {
subject // $ExpectType unknown
arg // $ExpectType any
return
},
newCommand2: (subject, arg) => {
subject // $ExpectType unknown
arg // $ExpectType any
},
})
Cypress.Commands.addAll({ prevSubject: ['optional'] }, {
newCommand: (subject, arg) => {
subject // $ExpectType unknown
arg // $ExpectType any
},
})
Cypress.Commands.addAll({ prevSubject: 'document' }, {
newCommand: (subject, arg) => {
subject // $ExpectType Document
arg // $ExpectType any
},
})
Cypress.Commands.addAll({ prevSubject: 'window' }, {
newCommand: (subject, arg) => {
subject // $ExpectType Window
arg // $ExpectType any
},
})
Cypress.Commands.addAll({ prevSubject: 'element' }, {
newCommand: (subject, arg) => {
subject // $ExpectType JQuery<HTMLElement>
arg // $ExpectType any
}
})
Cypress.Commands.addAll({ prevSubject: ['element'] }, {
newCommand: (subject, arg) => {
subject // $ExpectType JQuery<HTMLElement>
arg // $ExpectType any
}
})
Cypress.Commands.addAll({ prevSubject: ['element', 'document', 'window'] }, {
newCommand: (subject, arg) => {
if (subject instanceof Window) {
subject // $ExpectType Window
} else if (subject instanceof Document) {
subject // $ExpectType Document
} else {
subject // $ExpectType JQuery<HTMLElement>
}
arg // $ExpectType any
}
})
Cypress.Commands.addAll({ prevSubject: ['window', 'document', 'optional', 'element'] }, {
newCommand: (subject, arg) => {
if (subject instanceof Window) {
subject // $ExpectType Window
} else if (subject instanceof Document) {
subject // $ExpectType Document
} else if (subject) {
subject // $ExpectType JQuery<HTMLElement>
} else {
subject // $ExpectType void
}
arg // $ExpectType any
}
})
Cypress.Commands.addAll({
newCommand: (arg) => {
// $ExpectType any
arg
return cy.wrap(new Promise<number>((resolve) => { resolve(5) }))
}
})

Cypress.Commands.overwrite('newCommand', (originalFn, arg) => {
arg // $ExpectType string
originalFn // $ExpectedType Chainable['newCommand']
Expand Down
4 changes: 2 additions & 2 deletions npm/angular/cypress/support/component-index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<title>Components App</title>
</head>
<body>
<div id="__cy_root"></div>
<div data-cy-root></div>
</body>
</html>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ describe('init component tests script', () => {
}) as any)

await initComponentTesting({ config: {}, cypressConfigPath, useYarn: true })
expect(execStub).to.be.calledWith('yarn add @cypress/vue@3 --dev')
expect(execStub).to.be.calledWith('yarn add @cypress/vue --dev')
})

it('suggest the right instruction based on user template choice', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,16 @@ type InstallAdapterOptions = {
useYarn: boolean
}

const frameworkDependencies = {
react: '@cypress/react',
'vue@2': '@cypress/vue2',
'vue@3': '@cypress/vue',
}

export async function installFrameworkAdapter (cwd: string, options: InstallAdapterOptions) {
const framework = await guessOrAskForFramework(cwd)

await installDependency(`@cypress/${framework}`, options)
await installDependency(frameworkDependencies[framework], options)

return framework
}
2 changes: 1 addition & 1 deletion npm/design-system/cypress/support/component-index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<title>Components App</title>
</head>
<body>
<div id="__cy_root"></div>
<div data-cy-root></div>
</body>
</html>
Loading

0 comments on commit c190faf

Please sign in to comment.