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

chore: (multi-domain) support origin and domain name in switchToDomain #20564

Merged

Conversation

mschile
Copy link
Contributor

@mschile mschile commented Mar 10, 2022

User facing changelog

n/a

Additional details

Users are currently only able to setup the spec bridge using the domain name. The prevents them from specifying a protocol (http vs https) and from specifying a specific port. This change allows users to provide an origin or a domain name.

Note: the messaging is still assuming a single domain so while this change allows an origin to be passed, only one spec bridge for a particular domain will be created.

  • updated switchToDomain command to accept an origin or domain
    • if no protocol is provided, https is assumed
      • i.e. foobar.com -> https://foobar.com
    • errors is given a path, hash, or query params
  • created spec bridge using the origin policy (protocol, super domain, and port)
  • removed window.specBridgeDomain as unicode domains no longer need it
  • updated all of the switchToDomain calls to use origin https://foobar.com:3500 instead of just foobar.com

Supported:

http://example.com
https://example.com
http://example.com:3500
example.com
example.com:3500
app.example.com
sub.app.herokuapp.com
localhost
127.1.1.1
はじめよう.みんな
machine-name

Not currently supported:

http://[0000:0000:0000:0000:0000:0000:0000:0001]

Not supported:

example.com/path
example.com?foo=bar
example.com/#path

How has the user experience changed?

Users are now able to pass an origin or domain into switchToDomain.

PR Tasks

  • Have tests been added/updated?
  • [na] Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • [na] Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?
  • [na] Have new configuration options been added to the cypress.schema.json?

@mschile mschile requested a review from a team as a code owner March 10, 2022 18:56
@mschile mschile requested review from jennifer-shehane and removed request for a team March 10, 2022 18:56
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Mar 10, 2022

Thanks for taking the time to open a PR!

@mschile mschile requested review from AtofStryker, mjhenkes and chrisbreiding and removed request for jennifer-shehane March 10, 2022 18:56
@mschile mschile changed the title feat: support origin and domain name in switchToDomain chore: (multi-domain) support origin and domain name in switchToDomain Mar 10, 2022
@cypress
Copy link

cypress bot commented Mar 10, 2022



Test summary

20286 0 326 4Flakiness 2


Run details

Project cypress
Status Passed
Commit 250b8f8
Started Mar 11, 2022 11:26 PM
Ended Mar 11, 2022 11:39 PM
Duration 13:08 💡
OS Linux Debian - 10.10
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

cypress/integration/commands/net_stubbing_spec.ts Flakiness
1 network stubbing > intercepting response > can 'delay' a proxy response using Promise.delay
2 network stubbing > waiting and aliasing > can timeout waiting on a single request using "alias.request"

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

Copy link
Contributor

@AtofStryker AtofStryker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Depending on the order things get merged we probably need to update the system-tests in #20520 and #20552 to reflect correct origin policy.

@mschile mschile merged commit ca510ce into feature-multidomain Mar 14, 2022
@mschile mschile deleted the issue-19901-multi-domain-origin-and-domain branch March 14, 2022 14:41
AtofStryker added a commit that referenced this pull request Mar 14, 2022
* Refactor error serialization to rely on structuredClone over clone and
other means.

* add system test to verify stack trace is corrected for multi-domain errors

* remove redundant code and update documentation/tests

* address comments from code review

* remove 'to map' from serialization error message

* make all errors truthy before emitting through spec bridge to prevent sending unecessary values through postMessage

* fix falsy error serialization in firefox

* move reify errors into the primaryDomainCommunicator

* address comment made in review #20520 (comment)

* update switchToDomain to contain fully qualified URL to be compatible with #20564
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants