-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
chore(multi-domain): adding websocket support for backend and automation requests #19843
Merged
mschile
merged 5 commits into
feature-multidomain
from
issue-19767-multi-domain-backend-automation-request
Jan 26, 2022
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7012d1d
adding websocket support for backend and automation requests
mschile 353b252
updates
mschile b239693
Merge branch 'feature-multidomain' into issue-19767-multi-domain-back…
chrisbreiding 8c0f963
removing skip on writeFile
mschile 23f0b7e
fixing issue with restoring stub
mschile File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
3 changes: 1 addition & 2 deletions
3
packages/driver/cypress/integration/e2e/multi-domain/commands/multi_domain_cookies.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
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 |
---|---|---|
|
@@ -27,9 +27,7 @@ context('multi-domain misc', { experimentalSessionSupport: true, experimentalMul | |
}) | ||
}) | ||
|
||
// FIXME: CypressError: `cy.exec('echo foobar')` timed out after waiting `undefinedms`. | ||
// at eval (webpack:///../driver/src/cy/commands/exec.ts?:89:85) | ||
it.skip('.exec()', () => { | ||
it('.exec()', () => { | ||
cy.switchToDomain('foobar.com', () => { | ||
cy.exec('echo foobar').its('stdout').should('contain', 'foobar') | ||
}) | ||
|
@@ -81,10 +79,7 @@ context('multi-domain misc', { experimentalSessionSupport: true, experimentalMul | |
}) | ||
}) | ||
|
||
// FIXME: CypressError: `cy.task('return:arg')` timed out after waiting `undefinedms`. | ||
// at eval(webpack:///../driver/src/cy/commands/task.ts?:72:78) | ||
// From previous event: at task(webpack:///../driver/src/cy/commands/task.ts?:71:15) | ||
it.skip('.task()', () => { | ||
it('.task()', () => { | ||
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. its nice to see all these tests getting enabled 🎉 |
||
cy.switchToDomain('foobar.com', () => { | ||
cy.task('return:arg', 'works').should('eq', 'works') | ||
}) | ||
|
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { client } from '@packages/socket' | ||
|
||
const webSocket = client({ | ||
path: '/__socket.io', | ||
transports: ['websocket'], | ||
}).connect() | ||
|
||
const onBackendRequest = (...args) => { | ||
webSocket.emit('backend:request', ...args) | ||
} | ||
|
||
const onAutomationRequest = (...args) => { | ||
webSocket.emit('automation:request', ...args) | ||
} | ||
|
||
export const handleSocketEvents = (Cypress) => { | ||
Cypress.on('backend:request', onBackendRequest) | ||
Cypress.on('automation:request', onAutomationRequest) | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The primary driver
writeFile
tests call through to the real implementation of Cypress.backend, so I guess they actually write the file. I think that's fine because we do intend the driver tests to often be e2e or integration tests.It might not necessary to stub
Cypress.backend
here at all. I think we do it in the other tests primarily to test out when it fails and rejects, but just testing the happy path here is fine for now.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does call through in the
beforeEach
but in the actualit
block, it calls.resolves()
to mock thewriteFile()
. I doubt we want to actually write a file unless it was to a temp directory or maybe write to an existing file and check the modified date?