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

Config option - injecting document.domain #5974

Open
wants to merge 8 commits into
base: release/14.0.0
Choose a base branch
from

Conversation

cacieprins
Copy link
Contributor

(draft pr for work relating to cypress-io/cypress#29590)

Comment on lines 37 to 38
the two origins are in the same superdomain. This behavior can be disabled with
the `injectDocumentDomain` configuration option, to allow a transition period.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
the two origins are in the same superdomain. This behavior can be disabled with
the `injectDocumentDomain` configuration option, to allow a transition period.
the two origins are in the same superdomain. This behavior can be disabled by setting the `injectDocumentDomain` configuration option to `true`, to allow a smooth transition of tests to the new behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in 644aa61

docs/app/guides/cross-origin-testing.mdx Outdated Show resolved Hide resolved
2. [`.submit()`](/api/commands/submit) a `<form>` that causes your web server to
redirect you a different superdomain where additional Cypress commands are
redirect you a different origin where additional Cypress commands are
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
redirect you a different origin where additional Cypress commands are
redirect you to a different origin where additional Cypress commands are

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in 644aa61


:::

:::tip

<Icon name="check-circle" color="green" /> You **can** [visit](/api/commands/visit)
two or more domains of different origin in **different** tests without needing [`cy.origin()`](/api/commands/origin).
two or origins in **different** tests without needing [`cy.origin()`](/api/commands/origin).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
two or origins in **different** tests without needing [`cy.origin()`](/api/commands/origin).
two or more origins in **different** tests without needing [`cy.origin()`](/api/commands/origin).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in 644aa61

This option is <Badge type="caution">deprecated</Badge>, and will be removed in the next
major version of Cypress.

Set this configuration option is `true` to instruct Cypress to
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Set this configuration option is `true` to instruct Cypress to
Set this configuration option to `true` to instruct Cypress to

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in 644aa61

Comment on lines +616 to +617
to behave in unexpected ways. This is especially true if a site your tests visit
sets the [`Origin-Agent-Cluster`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin-Agent-Cluster)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
to behave in unexpected ways. This is especially true if a site your tests visit
sets the [`Origin-Agent-Cluster`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin-Agent-Cluster)
to behave in unexpected ways. This is especially true if the site under test
sets the [`Origin-Agent-Cluster`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin-Agent-Cluster)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in 644aa61

@@ -68,6 +68,44 @@ For users with the existing `experimentalJustInTimeCompile` flag set, you can re

:::

### Changes to `cy.origin()`

To support sites that use [origin-keyed agent clusters](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin-Agent-Cluster), Cypress no longer injects `document.domain` into `text/html` content by default.
Copy link
Member

Choose a reason for hiding this comment

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

I'd like to mention the document.domain deprecation somewhere here: https://developer.chrome.com/blog/document-domain-setter-deprecation - just want to give context that these are outward changes enforcing this direction.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 644aa61

Copy link

cypress bot commented Nov 4, 2024

cypress-documentation    Run #193

Run Properties:  status check passed Passed #193  •  git commit c7ff618f07: Update docs/app/references/configuration.mdx
Project cypress-documentation
Branch Review config/inject-document-domain
Run status status check passed Passed #193
Run duration 03m 21s
Commit git commit c7ff618f07: Update docs/app/references/configuration.mdx
Committer Cacie Prins
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 279
View all changes introduced in this branch ↗︎
UI Coverage  10.89%
  Untested elements 2227  
  Tested elements 3  
Accessibility  95.68%
  Failed rules  2 critical   5 serious   4 moderate   0 minor
  Failed elements 530  

| Option | Default | Description |
| ------------------------- | ------- | --------------------------------------------------------------------------------------------------------- |
| `experimentalStudio` | `false` | Generate and save commands directly to your test suite by interacting with your app as an end user would. |
| `experimentalRunAllSpecs` | `false` | Enables the "Run All Specs" UI feature, allowing the execution of multiple specs sequentially. |
Copy link
Member

Choose a reason for hiding this comment

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

@cacieprins Did you mean to remove experimentalOriginDependencies here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Accidental - resolved in 644aa61

docs/partials/_document-domain-workaround.mdx Outdated Show resolved Hide resolved
docs/app/references/configuration.mdx Outdated Show resolved Hide resolved
@cacieprins cacieprins marked this pull request as ready for review December 20, 2024 18:30
@@ -64,7 +76,7 @@ const hits = getHits()
cy.visit('https://example.cypress.io/history/founder')
// To interact with cross-origin content, move this inside cy.origin() callback
cy.get('h1').contains('About our Founder')
// Domain must be a precise match including subdomain, i.e. example.cypress.io
// Origin must be a precise match including scheme, subdomain and port, i.e. https://example.cypress.io
cy.origin('cypress.io', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

should we update this example then to be an origin, like http://docs.cypress.io?

@@ -113,17 +108,6 @@ used.
Read on to learn about
[working around these common problems](#Common-Workarounds).

#### What is a superdomain?

But what is same superdomain? It's actually very similar to that of same
Copy link
Contributor

Choose a reason for hiding this comment

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

yay to superdomain no more!


The URLs below, however, will have different superdomains/origins compared to
`https://www.cypress.io`.
An `origin` is comprised of a URL's `scheme`, `hostname`, _and_ `port`. Given the URLs
Copy link
Contributor

Choose a reason for hiding this comment

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

this is so much easier to interpret now as a normal web user IMO

docs/app/references/configuration.mdx Outdated Show resolved Hide resolved
#### Known Incompatibilities

Setting this configuration value to `true` can cause the application you are testing
to behave in unexpected ways. This is especially true if a site your tests visit
Copy link
Contributor

Choose a reason for hiding this comment

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

there are implications if your site sets it, but there are also implications where the browser defaults the origin-agent-cluster into buckets, which can cause problems. I think this is also worth mentioning

Co-authored-by: Bill Glesias <bglesias@gmail.com>
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