-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat: Fix detached DOM errors for all Cypress commands #24417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3c74ac8
ed9765b
6e408b3
c27dae2
4bfdec8
a881c11
4dc9134
7a62f79
a58e46b
f62277a
ed852c2
e481858
5b73353
b1b7b38
94f3d3f
7fc0859
4b511da
0eecaed
aab9565
6e69496
6a43c68
570b349
6776613
a080940
34fd50e
f8f89cd
6a4a168
4b1a0f6
10bde23
14b5e23
a675694
e1e7eca
652fd06
7cb9377
7fe6442
e982e05
66262d4
7a29d46
a051a28
9224571
ea6e11e
6a492c2
3cb0f56
dfd440c
e775659
e8e5809
62acc80
b90ef7a
d037686
2c5f801
d7526d8
0bf6daa
bf40c37
4c56a53
ecb5aa9
757953b
bf4dff7
ab3b3ed
17fe330
22b10f4
ed990f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,9 @@ declare namespace Cypress { | |
interface CommandFnWithOriginalFnAndSubject<T extends keyof Chainable, S> { | ||
(this: Mocha.Context, originalFn: CommandOriginalFnWithSubject<T, S>, prevSubject: S, ...args: Parameters<ChainableMethods[T]>): ReturnType<ChainableMethods[T]> | void | ||
} | ||
interface QueryFn<T extends keyof ChainableMethods> { | ||
(...args: Parameters<ChainableMethods[T]>): (subject: any) => any | ||
} | ||
interface ObjectLike { | ||
[key: string]: any | ||
} | ||
|
@@ -462,30 +465,92 @@ declare namespace Cypress { | |
*/ | ||
log(options: Partial<LogConfig>): Log | ||
|
||
/** | ||
* @see https://on.cypress.io/api/commands | ||
*/ | ||
Commands: { | ||
/** | ||
* Add a custom command | ||
* @see https://on.cypress.io/api/commands | ||
*/ | ||
add<T extends keyof Chainable>(name: T, fn: CommandFn<T>): void | ||
|
||
/** | ||
* Add a custom parent command | ||
* @see https://on.cypress.io/api/commands#Parent-Commands | ||
*/ | ||
add<T extends keyof Chainable>(name: T, options: CommandOptions & {prevSubject: false}, fn: CommandFn<T>): void | ||
|
||
/** | ||
* Add a custom child command | ||
* @see https://on.cypress.io/api/commands#Child-Commands | ||
*/ | ||
add<T extends keyof Chainable, S = any>(name: T, options: CommandOptions & {prevSubject: true}, fn: CommandFnWithSubject<T, S>): void | ||
|
||
/** | ||
* Add a custom child or dual command | ||
* @see https://on.cypress.io/api/commands#Validations | ||
*/ | ||
add<T extends keyof Chainable, S extends PrevSubject>( | ||
name: T, options: CommandOptions & { prevSubject: S | ['optional'] }, fn: CommandFnWithSubject<T, PrevSubjectMap[S]>, | ||
): void | ||
|
||
/** | ||
* Add a custom command that allows multiple types as the prevSubject | ||
* @see https://on.cypress.io/api/commands#Validations#Allow-Multiple-Types | ||
*/ | ||
add<T extends keyof Chainable, S extends PrevSubject>( | ||
name: T, options: CommandOptions & { prevSubject: S[] }, fn: CommandFnWithSubject<T, PrevSubjectMap<void>[S]>, | ||
): void | ||
|
||
/** | ||
* Add one or more custom commands | ||
* @see https://on.cypress.io/api/commands | ||
*/ | ||
addAll<T extends keyof Chainable>(fns: CommandFns): void | ||
|
||
/** | ||
* Add one or more custom parent commands | ||
* @see https://on.cypress.io/api/commands#Parent-Commands | ||
*/ | ||
addAll<T extends keyof Chainable>(options: CommandOptions & {prevSubject: false}, fns: CommandFns): void | ||
|
||
/** | ||
* Add one or more custom child commands | ||
* @see https://on.cypress.io/api/commands#Child-Commands | ||
*/ | ||
addAll<T extends keyof Chainable, S = any>(options: CommandOptions & { prevSubject: true }, fns: CommandFnsWithSubject<S>): void | ||
|
||
/** | ||
* Add one or more custom commands that validate their prevSubject | ||
* @see https://on.cypress.io/api/commands#Validations | ||
*/ | ||
addAll<T extends keyof Chainable, S extends PrevSubject>( | ||
options: CommandOptions & { prevSubject: S | ['optional'] }, fns: CommandFnsWithSubject<PrevSubjectMap[S]>, | ||
): void | ||
|
||
/** | ||
* Add one or more custom commands that allow multiple types as their prevSubject | ||
* @see https://on.cypress.io/api/commands#Allow-Multiple-Types | ||
*/ | ||
addAll<T extends keyof Chainable, S extends PrevSubject>( | ||
options: CommandOptions & { prevSubject: S[] }, fns: CommandFnsWithSubject<PrevSubjectMap<void>[S]>, | ||
): void | ||
|
||
/** | ||
* Overwrite an existing Cypress command with a new implementation | ||
* @see https://on.cypress.io/api/commands#Overwrite-Existing-Commands | ||
*/ | ||
overwrite<T extends keyof Chainable>(name: T, fn: CommandFnWithOriginalFn<T>): void | ||
|
||
/** | ||
* Overwrite an existing Cypress command with a new implementation | ||
* @see https://on.cypress.io/api/commands#Overwrite-Existing-Commands | ||
*/ | ||
overwrite<T extends keyof Chainable, S extends PrevSubject>(name: T, fn: CommandFnWithOriginalFnAndSubject<T, PrevSubjectMap[S]>): void | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Huh, kinda surprised that there aren't type comments for any of these. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Links to docs at least would be nice! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call - some comments here can definitely help make sense of the mess of TS definitions. I'm adding links to a couple of anchors that don't exist yet:
I'll be creating these in the docs PR, which isn't ready yet. |
||
/** | ||
* Add a custom query | ||
* @see https://on.cypress.io/api/commands#Queries | ||
*/ | ||
addQuery<T extends keyof Chainable>(name: T, fn: QueryFn<T>): void | ||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
"@intlify/vite-plugin-vue-i18n": "2.4.0", | ||
"@packages/frontend-shared": "0.0.0-development", | ||
"@percy/cypress": "^3.1.0", | ||
"@testing-library/cypress": "8.0.0", | ||
"@testing-library/cypress": "BlueWinds/cypress-testing-library#119054b5963b0d2e064b13c5cc6fc9db32c8b7b5", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a fork of cypress-testing-library which uses queries. My current plan is to wait for this PR to merge into I was running into issues while pointing only to the fork / branch, where the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 Specific commit is always the way to go, IMO. Using a branch causes the caching issue/bug with |
||
"@types/faker": "5.5.8", | ||
"@urql/core": "2.4.4", | ||
"@urql/vue": "0.6.2", | ||
|
Uh oh!
There was an error while loading. Please reload this page.