Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/app/references/error-messages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -498,18 +498,18 @@ as-is:
```javascript
it('navigates to docs.cypress.io', () => {
cy.visit('http://localhost:3000')
cy.visit('https://docs.cypress.io') // visit a different superdomain
cy.visit('https://docs.cypress.io') // visit a different domain
})
```

However, when the newly visited URL is not considered the same superdomain, the
However, when the newly visited URL is not considered the same domain, the
[`cy.origin()`](/api/commands/origin) command **must** be used to interact with
the newly visited domain. The following test is incorrect:

```javascript
it('navigates to docs.cypress.io and runs additional commands', () => {
cy.visit('http://localhost:3000')
cy.visit('https://docs.cypress.io') // visit a different superdomain
cy.visit('https://docs.cypress.io') // visit a different domain
cy.get('h1').should('contain', 'Why Cypress?') // fails
})
```
Expand All @@ -525,10 +525,10 @@ In order to fix this, our `cy.get()` command **must** be wrapped with the
[`cy.origin()`](/api/commands/origin) command, like so:

```javascript
it('navigates to example.cypress.io and runs additional commands', () => {
it('navigates to docs.cypress.io and runs additional commands', () => {
cy.visit('http://localhost:3000')
cy.visit('https://example.cypress.io') // visit a different superdomain
cy.origin('https://example.cypress.io', () => {
cy.visit('https://docs.cypress.io') // visit a different domain
cy.origin('https://docs.cypress.io', () => {
cy.get('h1').should('contain', 'Why Cypress?') // now succeeds!
})
})
Expand Down