-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Initialize Cypress before secondary domain page loads (#17262)
- Loading branch information
1 parent
12da3bd
commit e1f3a43
Showing
11 changed files
with
70 additions
and
69 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
packages/driver/cypress/fixtures/multidomain-secondary.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
<p></p> | ||
|
||
<script> | ||
if (window.Cypress) { | ||
document.querySelector('p').innerText = 'From a secondary domain with window.Cypress' | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
packages/driver/cypress/integration/e2e/multidomain_spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
// FIXME: Skip this for now since it's flaky | ||
it.skip('verifies initial implementation of sibling iframe and switchToDomain', (done) => { | ||
top.addEventListener('message', (event) => { | ||
if (event.data && event.data.text) { | ||
expect(event.data.text).to.equal('Foo') | ||
if (event.data && event.data.textFromParagraph !== undefined) { | ||
expect(event.data.host).to.equal('127.0.0.1:3501') | ||
expect(event.data.textFromParagraph).to.equal('From a secondary domain with window.Cypress') | ||
done() | ||
} | ||
}, false) | ||
|
||
cy.state('anticipateMultidomain', true) | ||
cy.viewport(900, 300) | ||
cy.visit('/fixtures/multidomain.html') | ||
// @ts-ignore | ||
cy.anticipateMultidomain() | ||
cy.get('a').click() | ||
// @ts-ignore | ||
cy.switchToDomain('127.0.0.1:3501', () => { | ||
// @ts-ignore | ||
cy.now('get', '.foo').then(($el) => { | ||
top.postMessage({ host: location.host, text: $el.text() }, '*') | ||
cy.now('get', 'p').then(($el) => { | ||
top.postMessage({ host: location.host, textFromParagraph: $el.text() }, '*') | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1 @@ | ||
import { initialize } from '@packages/driver/src/multidomain' | ||
|
||
initialize(window.parent.frames[0]) | ||
|
||
/* | ||
Need: | ||
- Cypress | ||
- cy, with | ||
- built-in commands | ||
- user-defined commands | ||
Commands need: | ||
- state | ||
- config | ||
- events | ||
Don't need: | ||
- UI components | ||
- spec runner | ||
- mocha | ||
- wasm / source map utils | ||
*/ | ||
import '@packages/driver/src/multidomain' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters