-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: do not set document.referrer while using cy.visit (#18658)
Co-authored-by: David Munechika <david@cypress.io>
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
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,20 @@ | ||
// https://github.com/cypress-io/cypress/issues/4295 | ||
it('rewrites document.referrer on the AUT to be empty string on visit', () => { | ||
cy.visit('http://localhost:3500/fixtures/generic.html') | ||
|
||
cy.window().its('document').its('referrer').should('equal', '') | ||
}) | ||
|
||
it('rewrites document.referrer on the AUT to be empty string on visit before user calls onBeforeLoad', () => { | ||
cy.visit('http://localhost:3500/fixtures/generic.html', { onBeforeLoad: (contentWindow) => { | ||
expect(contentWindow.document.referrer).to.equal('') | ||
} }) | ||
}) | ||
|
||
it('does not rewrite document.referrer if navigation was triggered by click on a link', () => { | ||
cy.visit('http://localhost:3500/fixtures/generic.html') | ||
|
||
cy.get('#dimensions').click() | ||
|
||
cy.window().its('document').its('referrer').should('equal', 'http://localhost:3500/fixtures/generic.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