Skip to content
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

feat: Cross Origin Testing Support #18075

Merged
merged 174 commits into from Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from 163 commits
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
6b827dd
chore: Initial work on creating a multidomain bundle (#16230)
chrisbreiding May 26, 2021
f5ec36e
Merge branch 'feature-multidomain' of github.com:cypress-io/cypress i…
chrisbreiding May 27, 2021
8bc9b5d
Merge branch 'develop' into feature-multidomain
chrisbreiding Jun 2, 2021
6400e81
Merge branch 'develop' into feature-multidomain
chrisbreiding Jun 4, 2021
d028437
chore: Implement cross-domain sibling iframe (#16708)
chrisbreiding Jun 7, 2021
2caa04c
Merge branch 'develop' into feature-multidomain
chrisbreiding Jun 8, 2021
b42e418
Merge branch 'feature-multidomain' of github.com:cypress-io/cypress i…
chrisbreiding Jun 8, 2021
1014523
Merge branch 'develop' into feature-multidomain
chrisbreiding Jun 9, 2021
69deb3e
Merge branch 'develop' into feature-multidomain
chrisbreiding Jun 14, 2021
b8658cf
chore: Inject into hard-coded secondary domain (#16873)
chrisbreiding Jun 15, 2021
afc39e9
Merge branch 'develop' into feature-multidomain
chrisbreiding Jun 22, 2021
5d24a55
Merge branch 'develop' into feature-multidomain
chrisbreiding Jun 24, 2021
64250be
Merge branch 'develop' into feature-multidomain
chrisbreiding Jul 6, 2021
12da3bd
Merge branch 'develop' into feature-multidomain
chrisbreiding Jul 7, 2021
e1f3a43
chore: Initialize Cypress before secondary domain page loads (#17262)
chrisbreiding Jul 12, 2021
da6fa94
Merge branch 'develop' into feature-multidomain
chrisbreiding Jul 13, 2021
66d947d
Merge branch 'feature-multidomain' of github.com:cypress-io/cypress i…
chrisbreiding Jul 13, 2021
700636a
chore: Wrap native methods in secondary domain (#17303)
chrisbreiding Jul 14, 2021
b36fdff
Merge branch 'develop' into feature-multidomain
chrisbreiding Jul 16, 2021
51dea49
Merge branch 'feature-multidomain' of github.com:cypress-io/cypress i…
chrisbreiding Jul 16, 2021
4288ce6
Merge branch 'develop' into feature-multidomain
chrisbreiding Jul 20, 2021
53cd6d1
chore: Add event listeners in secondary domain (#17391)
chrisbreiding Jul 20, 2021
548db6e
Merge branch 'develop' into feature-multidomain
chrisbreiding Aug 9, 2021
31e6d3f
Merge branch 'feature-multidomain' of github.com:cypress-io/cypress i…
chrisbreiding Aug 9, 2021
617f321
Merge branch 'develop' into feature-multidomain
chrisbreiding Aug 20, 2021
a3930c2
Merge branch 'develop' into feature-multidomain
chrisbreiding Aug 31, 2021
4323215
Merge branch 'develop' into feature-multidomain
chrisbreiding Sep 8, 2021
f5d326a
Merge branch 'develop' into feature-multidomain
chrisbreiding Sep 8, 2021
3ad6c36
fix issues
chrisbreiding Sep 8, 2021
fef49f4
convert requires to imports
chrisbreiding Sep 9, 2021
16ad6b4
chore: Run command queue in secondary domain and sync up command stat…
chrisbreiding Sep 10, 2021
4e140a2
Merge branch 'develop' into feature-multidomain
chrisbreiding Sep 13, 2021
92932c5
Merge branch 'feature-multidomain' of github.com:cypress-io/cypress i…
chrisbreiding Sep 13, 2021
cc66129
Merge branch 'develop' into feature-multidomain
chrisbreiding Sep 16, 2021
416aabe
chore: Fix rerunning multidomain tests (#18090)
chrisbreiding Sep 21, 2021
2aea225
Merge branch 'develop' into feature-multidomain
chrisbreiding Sep 21, 2021
fb5ff06
Merge branch 'feature-multidomain' of github.com:cypress-io/cypress i…
chrisbreiding Sep 21, 2021
9503b40
Merge branch 'develop' into feature-multidomain
chrisbreiding Sep 29, 2021
8f11635
Merge branch 'develop' into feature-multidomain
chrisbreiding Oct 5, 2021
516100b
Merge branch 'develop' into feature-multidomain
chrisbreiding Oct 19, 2021
c6d2918
Merge branch 'develop' into feature-multidomain
chrisbreiding Nov 1, 2021
2c28961
Merge branch 'develop' into feature-multidomain
chrisbreiding Nov 2, 2021
8ac1ff0
Merge branch 'develop' into feature-multidomain
chrisbreiding Dec 7, 2021
0eeb442
fix errors
chrisbreiding Dec 7, 2021
10264e6
fix issues created by merge
chrisbreiding Dec 9, 2021
b5a135d
Merge branch 'develop' into feature-multidomain
chrisbreiding Dec 9, 2021
37b881e
fix issues caused by merge
chrisbreiding Dec 9, 2021
cd77e08
use registerFetch
chrisbreiding Dec 9, 2021
dacf0a5
fix reference error
chrisbreiding Dec 9, 2021
f716178
chore: Remove need for anticipateMultidomain (#18360)
chrisbreiding Dec 9, 2021
f2c6069
Merge branch 'develop' into feature-multidomain
chrisbreiding Jan 3, 2022
ee6e105
Merge branch 'develop' into feature-multidomain
chrisbreiding Jan 5, 2022
a42e601
Merge branch 'develop' into feature-multidomain
chrisbreiding Jan 6, 2022
a408b36
Merge remote-tracking branch 'origin/develop' into feature-multidomain
chrisbreiding Jan 6, 2022
2ee9893
chore: Remove hardcoded domain for multi-domain (#19323)
chrisbreiding Jan 12, 2022
8e0770f
Merge branch 'develop' into feature-multidomain
chrisbreiding Jan 13, 2022
cc08d12
fix issues after merge
chrisbreiding Jan 13, 2022
2e5fbad
fix types issue
chrisbreiding Jan 13, 2022
d8fa85d
chore: Fix a couple multi-domain bugs (#19698)
chrisbreiding Jan 14, 2022
0601570
fix: secondary domain command state (#19661)
AtofStryker Jan 18, 2022
0b39332
chore: Add specs for all cy commands in multi-domain (#19734)
mschile Jan 18, 2022
d3601f6
Merge branch 'develop' into feature-multidomain
chrisbreiding Jan 19, 2022
7ef104e
Merge branch 'develop' into feature-multidomain
chrisbreiding Jan 19, 2022
c84ace4
chore: adding test for selectFile() in multi-domain (#19786)
mschile Jan 21, 2022
1faed02
Merge branch 'develop' into feature-multidomain
chrisbreiding Jan 21, 2022
89a497f
chore: update switchToDomain 'data' argument to be an array (#19774)
mschile Jan 21, 2022
3295adf
feat: [multi domain] enable window:before:load event (#19828)
mjhenkes Jan 24, 2022
2475b5a
chore(multi-domain): add clock support in multi-domain (#19861)
mschile Jan 25, 2022
1d69100
Merge branch 'develop' into feature-multidomain
chrisbreiding Jan 25, 2022
fdb0c96
chore: Rename and separate multi-domain files (#19825)
chrisbreiding Jan 25, 2022
b50fe56
chore(multi-domain): adding websocket support for backend and automat…
mschile Jan 26, 2022
bab8496
feat: multi domain handle command failures (#19805)
AtofStryker Jan 27, 2022
fe03453
feat: implement uncaught:exception and error in spec bridge (#19922)
AtofStryker Jan 27, 2022
4070270
feat: (multi-domain) handle uncaught errors in the spec bridge (#19976)
mschile Feb 2, 2022
c58a0ee
feat: [Multi-domain]: Yield subject from `switchToDomain` (#19936)
mjhenkes Feb 3, 2022
dc9b694
fix spec, app, and done error serialization in firefox (#20080)
AtofStryker Feb 8, 2022
c198372
Merge branch 'develop' into feature-multidomain
chrisbreiding Feb 8, 2022
92bf23c
feat: (multi-domain) add initial support for cy.screenshot (#20119)
mschile Feb 10, 2022
0639d14
feat: (multi-domain) add support for screenshot blackout (#20150)
mschile Feb 14, 2022
191dc92
feat: [Multi-Domain] Ensure runner shows correct url (#20096)
mjhenkes Feb 14, 2022
8d54632
Merge branch 'develop' into feature-multidomain
chrisbreiding Feb 14, 2022
89ea47d
Merge branch 'feature-multidomain' of github.com:cypress-io/cypress i…
chrisbreiding Feb 14, 2022
b6e1c30
Fix misc test (#20201)
mjhenkes Feb 15, 2022
5f905ee
feat: (multi-domain) add support for pausing timers during screenshot…
mschile Feb 17, 2022
5269f4f
feat: (multi-domain) restore stubs and spies in multi-domain (#20229)
mschile Feb 17, 2022
288f6bd
feat: sync config and env (#20102)
AtofStryker Feb 22, 2022
5b4feaa
feat: support cypress api (#20022)
AtofStryker Feb 22, 2022
0e942ed
chore: Refactor multi-domain communication lifecycle (#20247)
chrisbreiding Feb 23, 2022
fc7149e
Merge branch 'develop' into feature-multidomain
chrisbreiding Feb 23, 2022
b6243f5
chore: [Multi-domain] Validate domain name (#20321)
mjhenkes Feb 23, 2022
c8c2046
chore: [Multi-domain] Clean up basic login spec to look like what we …
mjhenkes Feb 23, 2022
a0c6f00
chore: [Multi-domain]: Support multiple multi-domain commands in a si…
mjhenkes Feb 24, 2022
4c36cf9
feat: (multi-domain) add viewport support (#20266)
mschile Feb 25, 2022
ae65ae6
fix: ensure multi domain passivity (#20442)
AtofStryker Mar 4, 2022
1eb5ab7
chore: [Multi-Domain] enable commands in switchToDomain to use the de…
mjhenkes Mar 7, 2022
74dea89
feat: (multi-domain) adding support for cy.visit in multi-domain (#20…
mschile Mar 8, 2022
ca1857f
test: fix system-tests-firefox downloads flake (#20547)
ryanthemanuel Mar 10, 2022
ca510ce
chore: (multi-domain) support origin and domain name in switchToDomai…
mschile Mar 14, 2022
cd7f99d
chore: (multi-domain) url:changed fix, revert about:blank, use Cypres…
mschile Mar 14, 2022
892d8d9
chore: (multi-domain) add support for visiting relative urls in secon…
mschile Mar 14, 2022
d1c3e4e
fix: standardize error and object serialization (#20520)
AtofStryker Mar 14, 2022
46c0c75
Fix build (#20627)
mjhenkes Mar 15, 2022
7f3a649
chore: [Multi-domain] Enable tests, stability and fail appropriately …
mjhenkes Mar 15, 2022
bc30c68
Merge branch 'develop' into feature-multidomain
chrisbreiding Mar 16, 2022
326fc19
fix type issues
chrisbreiding Mar 16, 2022
9cc3108
Merge branch 'develop' into feature-multidomain
chrisbreiding Mar 16, 2022
0e8c511
fix more types
chrisbreiding Mar 16, 2022
193a01a
fix: prevent serialization issues with retries using multi-domain (#2…
AtofStryker Mar 16, 2022
35501bc
chore: [Multi-domain] Handle stability with delayed navigation (#20642)
mjhenkes Mar 16, 2022
ebb054e
chore: [Multi-domain] Clean up stability code. (#20656)
mjhenkes Mar 18, 2022
432b3d5
fix: make the primary domain communicator a singleton per cypress ins…
AtofStryker Mar 18, 2022
9827b26
chore: [Multi-domain] Improve timeout error message. (#20671)
mjhenkes Mar 21, 2022
f638ba7
fix: [Multi-domain] Fix countLogsByTest (#20719)
mjhenkes Mar 21, 2022
89c0091
fix: firefox 93 error issues (#20695)
AtofStryker Mar 22, 2022
22b35be
fix(multi-domain): Handle SameSite cookies (#20450)
chrisbreiding Mar 22, 2022
a64cdb8
chore(multi-domain): Throw errors for unsupported commands (#20729)
chrisbreiding Mar 22, 2022
c7aa180
fix: [Multi-domain] Preserve switchToDomain command logs between top …
mjhenkes Mar 23, 2022
90d1eb7
chore: Update switchToDomain signature with `args` key (#20722)
AtofStryker Mar 24, 2022
ad176be
chore: Verify cy.request() works in multi-domain callback (#20747)
chrisbreiding Mar 24, 2022
3c19edb
chore: [multi-domain] enable binary builds and more tests for the mul…
mjhenkes Mar 24, 2022
8f7cc74
Merge branch 'develop' into feature-multidomain
mjhenkes Mar 24, 2022
14215e3
chore: [multi-domain] clean up listeners when promise is canceled (#2…
mjhenkes Mar 28, 2022
453d1ca
Merge branch 'develop' into feature-multidomain
mjhenkes Mar 28, 2022
fedb65c
chore: (multi-domain) support multiple remote states (#20752)
mschile Mar 28, 2022
04eabf0
Merge branch 'develop' into feature-multidomain
mjhenkes Mar 29, 2022
3b4b0ef
chore: [multi-domain] clean up the sync:globals event in the event of…
mjhenkes Mar 29, 2022
4c1c18d
fix: (multi-domain) fix injection issue (#20816)
mschile Mar 30, 2022
b77f675
chore: (multi-domain) update visit cross-origin error message (#20831)
mschile Mar 30, 2022
9098744
chore: [Multi-domain] add retry error message for cross domain comman…
mjhenkes Mar 30, 2022
1fa78f5
Merge branch 'develop' into feature-multidomain
mjhenkes Mar 30, 2022
8c9bd2a
Merge branch 'develop' into feature-multidomain
mjhenkes Mar 31, 2022
b3e66e7
chore: [Multi-domain]: Support spec bridges with same domain (#20829)
mjhenkes Mar 31, 2022
8bba681
fix: (multi-domain) electron crash (#20867)
mschile Apr 1, 2022
0c78630
chore: [Multi-domain] Renaming variable and functions to reduce confu…
mjhenkes Apr 4, 2022
15a60c1
chore: [Multi-domain] Renaming variable and functions to reduce confu…
mjhenkes Apr 4, 2022
f45be5e
chore: [Multi-domain] Resolve flaky test (#20917)
mjhenkes Apr 5, 2022
81e9283
Merge branch 'develop' into feature-multidomain
mjhenkes Apr 5, 2022
0772f85
Merge branch 'develop' into feature-multidomain
mjhenkes Apr 6, 2022
17e6bf4
chore: [Multi-domain] Rename switchToDomain to origin (#20927)
mjhenkes Apr 6, 2022
213607f
chore: [Multi-domain] Provide a warning when switchToDomain fails to …
mjhenkes Apr 6, 2022
b65db7b
chore: [Multi-domain] Rename domain events (#20945)
mjhenkes Apr 6, 2022
dcbc68b
chore: (multi-domain) updating experimental flag to experimentalLogin…
mschile Apr 6, 2022
25af921
chore: [Multi-domain] Rename isMultiDomain for the driver and the ser…
mjhenkes Apr 7, 2022
c686922
chore: [Multi-domain] Rename the last of the domain/multi-domain to o…
mjhenkes Apr 7, 2022
8a78b5c
Merge branch 'develop' into feature-multidomain
mjhenkes Apr 7, 2022
782d89f
chore: (multi-domain) update to support path and hash (#20953)
mschile Apr 7, 2022
63c3247
chore: [Multi-domain] Fix uncaught error (#20971)
mjhenkes Apr 8, 2022
a7caf8a
chore: [Multi-domain] Update error messages based on feedback. (#20996)
mjhenkes Apr 8, 2022
f6975f8
chore: audit cross-origin related TODOs/FIXMEs (#20975)
chrisbreiding Apr 8, 2022
a928781
chore: (multi-domain) update cross-origin error (#20999)
mschile Apr 8, 2022
fdfa933
chore: Unskip test that now passes (#20922)
chrisbreiding Apr 8, 2022
8959845
Merge branch 'develop' into feature-multidomain
mjhenkes Apr 11, 2022
836edbf
Merge branch 'develop' into feature-multidomain
mjhenkes Apr 11, 2022
65d75dd
Merge branch 'develop' into feature-multidomain
mjhenkes Apr 11, 2022
f451d05
Merge branch 'develop' into feature-multidomain
mjhenkes Apr 12, 2022
d98d0e1
chore: (multi-domain) add experimentalLoginFlows to the settings page…
mschile Apr 12, 2022
663e5d5
Merge branch 'develop' into feature-multidomain
mjhenkes Apr 12, 2022
dd3557f
chore: [Multi-domain] Reset timeout after transition from `before` to…
mjhenkes Apr 13, 2022
27e1afb
chore: (multi-domain) renaming flag to experimentalSessionAndOrigin (…
mschile Apr 13, 2022
c560caf
feat(multi-origin): Group cy.origin commands (#21046)
chrisbreiding Apr 13, 2022
e4dcb12
Merge branch 'develop' into feature-multidomain
mjhenkes Apr 13, 2022
890bde6
fix(multi-origin): Fix some issues with errors (#21071)
chrisbreiding Apr 15, 2022
f02d750
chore: [Multi-origin] Correctly find the spec bridge if chromeWebSecu…
mjhenkes Apr 18, 2022
d7ce865
chore: (cross-origin) add support for redirecting back to primary (#2…
mschile Apr 21, 2022
e3161a0
chore: [Multi-domain] Break out separate CI tasks to test the driver …
mjhenkes Apr 21, 2022
f819be3
Merge branch 'develop' into feature-multidomain
mschile Apr 21, 2022
f164404
Merge branch 'develop' into feature-multidomain
mjhenkes Apr 21, 2022
885541e
improve error messages for unsupported APIs/commands
AtofStryker Apr 22, 2022
a1101e6
feat: support snapshots and console props within multi-domain (#20949)
AtofStryker Apr 22, 2022
ebaaf18
Merge branch 'develop' into feature-multidomain
mjhenkes Apr 22, 2022
3e6d6bf
chore: Updates based on PR feedback (#21137)
chrisbreiding Apr 22, 2022
d866746
Update packages/runner-shared/src/event-manager.js
mjhenkes Apr 22, 2022
b8ae51e
Remove reference to migration guide
mjhenkes Apr 23, 2022
f473d29
removing migration guide reference
mschile Apr 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/launch.json
Expand Up @@ -5,7 +5,8 @@
"type": "node",
"request": "attach",
"name": "Attach by Process ID",
"processId": "${command:PickProcess}"
"processId": "${command:PickProcess}",
"continueOnAttach": true
},
{
"type": "node",
Expand Down
5 changes: 4 additions & 1 deletion circle.yml
Expand Up @@ -29,6 +29,7 @@ mainBuildFilters: &mainBuildFilters
only:
- develop
- 10.0-release
- feature-multidomain
- unify-1449-beta-slug-length

# usually we don't build Mac app - it takes a long time
Expand All @@ -38,6 +39,7 @@ macWorkflowFilters: &mac-workflow-filters
when:
or:
- equal: [ develop, << pipeline.git.branch >> ]
- equal: [ feature-multidomain, << pipeline.git.branch >> ]
- equal: [ unify-1449-beta-slug-length, << pipeline.git.branch >> ]
- matches:
pattern: "-release$"
Expand All @@ -48,6 +50,7 @@ windowsWorkflowFilters: &windows-workflow-filters
or:
- equal: [ master, << pipeline.git.branch >> ]
- equal: [ develop, << pipeline.git.branch >> ]
- equal: [ feature-multidomain, << pipeline.git.branch >> ]
- equal: [ unify-1449-beta-slug-length, << pipeline.git.branch >> ]
- matches:
pattern: "-release$"
Expand Down Expand Up @@ -1604,7 +1607,7 @@ jobs:
- run:
name: Check current branch to persist artifacts
command: |
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "unify-1449-beta-slug-length" ]]; then
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "unify-1449-beta-slug-length" && "$CIRCLE_BRANCH" != "feature-multidomain" ]]; then
echo "Not uploading artifacts or posting install comment for this branch."
circleci-agent step halt
fi
Expand Down
8 changes: 4 additions & 4 deletions cli/schema/cypress.schema.json
Expand Up @@ -253,15 +253,15 @@
"default": false,
"description": "Allows listening to the `before:run`, `after:run`, `before:spec`, and `after:spec` events in the plugins file during interactive mode."
},
"experimentalSourceRewriting": {
"experimentalSessionAndOrigin": {
"type": "boolean",
"default": false,
"description": "Enables AST-based JS/HTML rewriting. This may fix issues caused by the existing regex-based JS/HTML replacement algorithm."
"description": "Enables cross-origin and improved session support, including the `cy.origin` and `cy.session` commands."
mschile marked this conversation as resolved.
Show resolved Hide resolved
},
"experimentalSessionSupport": {
"experimentalSourceRewriting": {
"type": "boolean",
"default": false,
"description": "Enable experimental session support. See https://on.cypress.io/session"
"description": "Enables AST-based JS/HTML rewriting. This may fix issues caused by the existing regex-based JS/HTML replacement algorithm."
},
"experimentalFetchPolyfill": {
"type": "boolean",
Expand Down
72 changes: 59 additions & 13 deletions cli/types/cypress.d.ts
Expand Up @@ -54,16 +54,12 @@ declare namespace Cypress {
}

interface RemoteState {
auth?: {
username: string
password: string
}
auth?: Auth
domainName: string
strategy: 'file' | 'http'
origin: string
fileServer: string
fileServer: string | null
props: Record<string, any>
visiting: string
mschile marked this conversation as resolved.
Show resolved Hide resolved
}

interface Backend {
Expand Down Expand Up @@ -634,7 +630,7 @@ declare namespace Cypress {
* Trigger action
* @private
*/
action: (action: string, ...args: any[]) => void
action: (action: string, ...args: any[]) => any[] | void

/**
* Load files
Expand Down Expand Up @@ -1059,7 +1055,7 @@ declare namespace Cypress {
/**
* Save/Restore browser Cookies, LocalStorage, and SessionStorage data resulting from the supplied `setup` function.
*
* Only available if the `experimentalSessionSupport` config option is enabled.
* Only available if the `experimentalSessionAndOrigin` config option is enabled.
*
* @see https://on.cypress.io/session
*/
Expand Down Expand Up @@ -1421,6 +1417,29 @@ declare namespace Cypress {
*/
off: Actions

/**
* Enables running Cypress commands in a secondary origin.
* @see https://on.cypress.io/origin
* @example
* cy.origin('example.com', () => {
* cy.get('h1').should('equal', 'Example Domain')
* })
*/
origin(urlOrDomain: string, fn: () => void): Chainable
flotwig marked this conversation as resolved.
Show resolved Hide resolved

/**
* Enables running Cypress commands in a secondary origin.
* @see https://on.cypress.io/origin
* @example
* cy.origin('example.com', { args: { key: 'value', foo: 'foo' } }, ({ key, foo }) => {
* expect(key).to.equal('value')
* expect(foo).to.equal('foo')
* })
*/
origin<T>(urlOrDomain: string, options: {
args: T
}, fn: (args: T) => void): Chainable
flotwig marked this conversation as resolved.
Show resolved Hide resolved

/**
* Get the parent DOM element of a set of DOM elements.
*
Expand Down Expand Up @@ -2817,15 +2836,15 @@ declare namespace Cypress {
*/
scrollBehavior: scrollBehaviorOptions
/**
* Enable experimental session support. See https://on.cypress.io/session
* Allows listening to the `before:run`, `after:run`, `before:spec`, and `after:spec` events in the plugins file during interactive mode.
* @default false
*/
experimentalSessionSupport: boolean
experimentalInteractiveRunEvents: boolean
/**
* Allows listening to the `before:run`, `after:run`, `before:spec`, and `after:spec` events in the plugins file during interactive mode.
* Enables cross-origin and improved session support, including the `cy.origin` and `cy.session` commands.
* @default false
*/
experimentalInteractiveRunEvents: boolean
experimentalSessionAndOrigin: boolean
/**
* Generate and save commands directly to your test suite by interacting with your app as an end user would.
* @default false
Expand Down Expand Up @@ -5447,6 +5466,21 @@ declare namespace Cypress {
(action: 'task', tasks: Tasks): void
}

interface CodeFrame {
frame: string
language: string
line: number
column: number
absoluteFile: string
originalFile: string
relativeFile: string
}

interface CypressError extends Error {
docsUrl?: string
codeFrame?: CodeFrame
}

// for just a few events like "window:alert" it makes sense to allow passing cy.stub() or
// a user callback function. Others probably only need a callback function.

Expand Down Expand Up @@ -5552,7 +5586,7 @@ declare namespace Cypress {
* This event exists because it's extremely useful for debugging purposes.
* @see https://on.cypress.io/catalog-of-events#App-Events
*/
(action: 'fail', fn: (error: Error, mocha: Mocha.Runnable) => void): Cypress
(action: 'fail', fn: (error: CypressError, mocha: Mocha.Runnable) => void): Cypress
/**
* Fires whenever the viewport changes via a `cy.viewport()` or naturally when
* Cypress resets the viewport to the default between tests. Useful for debugging purposes.
Expand Down Expand Up @@ -5586,6 +5620,12 @@ declare namespace Cypress {
* @see https://on.cypress.io/catalog-of-events#App-Events
*/
(action: 'command:end', fn: (command: CommandQueue) => void): Cypress
/**
* Fires when a command is skipped, namely the `should` command.
* Useful for debugging and understanding how commands are handled.
* @see https://on.cypress.io/catalog-of-events#App-Events
*/
(action: 'skipped:command:end', fn: (command: CommandQueue) => void): Cypress
/**
* Fires whenever a command begins its retrying routines.
* This is called on the trailing edge after Cypress has internally
Expand Down Expand Up @@ -5676,10 +5716,13 @@ declare namespace Cypress {
}

interface EnqueuedCommand {
id: string
name: string
args: any[]
type: string
chainerId: string
injected: boolean
mschile marked this conversation as resolved.
Show resolved Hide resolved
userInvocationStack?: string
fn(...args: any[]): any
}

Expand Down Expand Up @@ -5718,6 +5761,7 @@ declare namespace Cypress {
}

interface LogConfig extends Timeoutable {
id: number
mschile marked this conversation as resolved.
Show resolved Hide resolved
/** The JQuery element for the command. This will highlight the command in the main window when debugging */
$el: JQuery
/** The scope of the log entry. If child, will appear nested below parents, prefixed with '-' */
Expand All @@ -5730,6 +5774,8 @@ declare namespace Cypress {
message: any
/** Set to false if you want to control the finishing of the command in the log yourself */
autoEnd: boolean
/** Set to false if you want to control the finishing of the command in the log yourself */
mschile marked this conversation as resolved.
Show resolved Hide resolved
end: boolean
/** Return an object that will be printed in the dev tools console */
consoleProps(): ObjectLike
}
Expand Down
2 changes: 1 addition & 1 deletion cli/types/tests/actions.ts
Expand Up @@ -33,7 +33,7 @@ Cypress.on('url:changed', (url) => {
})

Cypress.on('fail', (error, mocha) => {
error // $ExpectType Error
error // $ExpectType CypressError
mocha // $ExpectType Runnable
})

Expand Down
19 changes: 18 additions & 1 deletion cli/types/tests/cypress-tests.ts
Expand Up @@ -904,7 +904,6 @@ namespace CypressTaskTests {
}

namespace CypressSessionsTests {
Cypress.config('experimentalSessionSupport') // $ExpectType boolean
cy.session('user')
cy.session('user', () => {})
cy.session({ name: 'bob' }, () => {})
Expand Down Expand Up @@ -939,3 +938,21 @@ namespace CypressKeyboardTests {
delay: 500 // $ExpectError
})
}

namespace CypressOriginTests {
cy.origin('example.com', () => {})
cy.origin('example.com', { args: {}}, (value: object) => {})
cy.origin('example.com', { args: { one: 1, key: 'value', bool: true } }, (value: { one: number, key: string, bool: boolean}) => {})
cy.origin('example.com', { args: [1, 'value', true ] }, (value: Array<(number | string | boolean)>) => {})
cy.origin('example.com', { args : 'value'}, (value: string) => {})
cy.origin('example.com', { args: 1 }, (value: number) => {})
cy.origin('example.com', { args: true }, (value: boolean) => {})

cy.origin() // $ExpectError
cy.origin('example.com') // $ExpectError
cy.origin(true) // $ExpectError
cy.origin('example.com', {}) // $ExpectError
cy.origin('example.com', {}, {}) // $ExpectError
cy.origin('example.com', { args: ['value'] }, (value: boolean[]) => {}) // $ExpectError
cy.origin('example.com', {}, (value: undefined) => {}) // $ExpectError
}
11 changes: 6 additions & 5 deletions packages/config/__snapshots__/index_spec.js
@@ -1,16 +1,17 @@
exports['src/index .getBreakingKeys returns list of breaking config keys 1'] = [
exports['config/lib/index .getBreakingKeys returns list of breaking config keys 1'] = [
"blacklistHosts",
"experimentalComponentTesting",
"experimentalGetCookiesSameSite",
"experimentalNetworkStubbing",
"experimentalRunEvents",
"experimentalSessionSupport",
"experimentalShadowDomSupport",
"firefoxGcInterval",
"nodeVersion",
"nodeVersion"
]

exports['src/index .getDefaultValues returns list of public config keys 1'] = {
exports['config/lib/index .getDefaultValues returns list of public config keys 1'] = {
"animationDistanceThreshold": 5,
"baseUrl": null,
"blockHosts": null,
Expand All @@ -25,7 +26,7 @@ exports['src/index .getDefaultValues returns list of public config keys 1'] = {
"execTimeout": 60000,
"experimentalFetchPolyfill": false,
"experimentalInteractiveRunEvents": false,
"experimentalSessionSupport": false,
"experimentalSessionAndOrigin": false,
"experimentalSourceRewriting": false,
"experimentalStudio": false,
"fileServerFolder": "",
Expand Down Expand Up @@ -86,7 +87,7 @@ exports['src/index .getDefaultValues returns list of public config keys 1'] = {
"xhrRoute": "/xhrs/"
}

exports['src/index .getPublicConfigKeys returns list of public config keys 1'] = [
exports['config/lib/index .getPublicConfigKeys returns list of public config keys 1'] = [
"animationDistanceThreshold",
"baseUrl",
"blockHosts",
Expand All @@ -101,7 +102,7 @@ exports['src/index .getPublicConfigKeys returns list of public config keys 1'] =
"execTimeout",
"experimentalFetchPolyfill",
"experimentalInteractiveRunEvents",
"experimentalSessionSupport",
"experimentalSessionAndOrigin",
"experimentalSourceRewriting",
"experimentalStudio",
"fileServerFolder",
Expand Down