From 0a1086bd22ca1b42a34b1865d6a3613257aac8a1 Mon Sep 17 00:00:00 2001 From: Bill Glesias Date: Mon, 19 Sep 2022 16:33:31 -0400 Subject: [PATCH] chore: refactor spec bridges to strictly enforce same origin fix: wrap fullCrossOrigin injection around feature flag inside buffered response --- .../cypress/e2e/commands/navigation.cy.js | 2 +- .../cypress/e2e/e2e/origin/basic_login.cy.ts | 34 +++--- .../e2e/e2e/origin/commands/actions.cy.ts | 66 +++++------ .../e2e/e2e/origin/commands/aliasing.cy.ts | 6 +- .../e2e/e2e/origin/commands/assertions.cy.ts | 4 +- .../e2e/e2e/origin/commands/connectors.cy.ts | 14 +-- .../e2e/e2e/origin/commands/cookies.cy.ts | 26 ++-- .../e2e/e2e/origin/commands/files.cy.ts | 10 +- .../e2e/origin/commands/local_storage.cy.ts | 4 +- .../e2e/e2e/origin/commands/location.cy.ts | 12 +- .../cypress/e2e/e2e/origin/commands/log.cy.ts | 4 +- .../e2e/e2e/origin/commands/misc.cy.ts | 26 ++-- .../e2e/e2e/origin/commands/navigation.cy.ts | 48 ++++---- .../origin/commands/network_requests.cy.ts | 12 +- .../e2e/e2e/origin/commands/querying.cy.ts | 26 ++-- .../e2e/origin/commands/querying_shadow.cy.ts | 4 +- .../e2e/e2e/origin/commands/screenshot.cy.ts | 46 ++++---- .../origin/commands/spies_stubs_clocks.cy.ts | 22 ++-- .../e2e/e2e/origin/commands/traversal.cy.ts | 72 ++++++------ .../commands/unsupported_commands.cy.ts | 10 +- .../e2e/e2e/origin/commands/viewport.cy.ts | 24 ++-- .../e2e/e2e/origin/commands/waiting.cy.ts | 8 +- .../e2e/e2e/origin/commands/window.cy.ts | 12 +- .../cypress/e2e/e2e/origin/config_env.cy.ts | 38 +++--- .../e2e/e2e/origin/cookie_behavior.cy.ts | 16 +-- .../cypress/e2e/e2e/origin/cookie_login.cy.ts | 111 +++++++++--------- .../cypress/e2e/e2e/origin/cypress_api.cy.ts | 46 ++++---- .../cypress/e2e/e2e/origin/events.cy.ts | 26 ++-- .../cypress/e2e/e2e/origin/integrity.cy.ts | 8 +- .../cypress/e2e/e2e/origin/logging.cy.ts | 8 +- .../cypress/e2e/e2e/origin/origin.cy.ts | 40 +++---- .../driver/cypress/e2e/e2e/origin/rerun.cy.ts | 2 +- .../cypress/e2e/e2e/origin/snapshots.cy.ts | 12 +- .../cypress/e2e/e2e/origin/spec_bridge.cy.ts | 2 +- .../e2e/e2e/origin/uncaught_errors.cy.ts | 60 +++++----- .../e2e/e2e/origin/user_agent_override.cy.ts | 2 +- .../cypress/e2e/e2e/origin/validation.cy.ts | 42 ++++--- .../driver/cypress/e2e/e2e/origin/yield.cy.ts | 30 ++--- .../driver/cypress/fixtures/auth/index.html | 2 +- packages/driver/cypress/plugins/server.js | 8 +- packages/network/lib/cors.ts | 8 ++ packages/proxy/lib/http/request-middleware.ts | 2 +- .../proxy/lib/http/response-middleware.ts | 18 ++- packages/server/lib/remote_states.ts | 3 +- .../server/test/unit/remote_states.spec.ts | 18 ++- .../e2e/cypress/e2e/cy_origin_error.cy.ts | 2 +- 46 files changed, 522 insertions(+), 474 deletions(-) diff --git a/packages/driver/cypress/e2e/commands/navigation.cy.js b/packages/driver/cypress/e2e/commands/navigation.cy.js index aeb12ad05931..f3d5ce8dbec7 100644 --- a/packages/driver/cypress/e2e/commands/navigation.cy.js +++ b/packages/driver/cypress/e2e/commands/navigation.cy.js @@ -1553,7 +1553,7 @@ describe('src/cy/commands/navigation', () => { ${experimentalMessage} \`cy.visit('http://localhost:3500/fixtures/generic.html')\` \`\`\n - \`cy.origin('http://foobar.com:3500', () => {\` + \`cy.origin('http://www.foobar.com:3500', () => {\` \` cy.visit('http://www.foobar.com:3500/fixtures/generic.html')\` \` \` \`})\`\n diff --git a/packages/driver/cypress/e2e/e2e/origin/basic_login.cy.ts b/packages/driver/cypress/e2e/e2e/origin/basic_login.cy.ts index a06c7a1a4406..f70894cf2c46 100644 --- a/packages/driver/cypress/e2e/e2e/origin/basic_login.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/basic_login.cy.ts @@ -4,7 +4,7 @@ describe('basic login', () => { it('logs in with idp redirect', () => { cy.visit('/fixtures/auth/index.html') // Establishes primary origin cy.get('[data-cy="login-idp"]').click() // Takes you to idp.com - cy.origin('http://idp.com:3500', () => { + cy.origin('http://www.idp.com:3500', () => { cy.get('[data-cy="username"]').type('BJohnson') cy.get('[data-cy="login"]').click() }) @@ -23,7 +23,7 @@ describe('basic login', () => { win.location.href = 'http://www.idp.com:3500/fixtures/auth/idp.html' }) - cy.origin('http://idp.com:3500', () => { + cy.origin('http://www.idp.com:3500', () => { cy.get('[data-cy="username"]').type('FJohnson') cy.get('[data-cy="login"]').click() }) @@ -37,7 +37,7 @@ describe('basic login', () => { it('visits foobar first', () => { cy.visit('http://www.foobar.com:3500/fixtures/auth/index.html') // Establishes primary origin cy.get('[data-cy="login-idp"]').click() // Takes you to idp.com - cy.origin('http://idp.com:3500', () => { + cy.origin('http://www.idp.com:3500', () => { cy.get('[data-cy="username"]').type('BJohnson') cy.get('[data-cy="login"]').click() }) @@ -60,7 +60,7 @@ describe('basic login', () => { // Primary established via base url // TODO: baseUrl does not establish primary without a visit it.skip('logs in with primary set via baseurl', { baseUrl: 'http://localhost:3500' }, () => { - cy.origin('http://idp.com:3500', () => { // primary origin is localhost + cy.origin('http://www.idp.com:3500', () => { // primary origin is localhost cy.visit('http://www.idp.com:3500/fixtures/auth/idp.html') cy.get('[data-cy="username"]').type('FJohnson') cy.get('[data-cy="login"]').click() @@ -77,7 +77,7 @@ describe('basic login', () => { it('logs in with primary set via visit', () => { cy.visit('/fixtures/auth/index.html') - cy.origin('http://idp.com:3500', () => { // primary origin is localhost + cy.origin('http://www.idp.com:3500', () => { // primary origin is localhost cy.visit('http://www.idp.com:3500/fixtures/auth/idp.html') cy.get('[data-cy="username"]').type('FJohnson') cy.get('[data-cy="login"]').click() @@ -94,7 +94,7 @@ describe('basic login', () => { const login = (name) => { cy.session(name, () => { // Note, this assumes localhost is the primary origin, ideally we'd be able to specify this directly. - cy.origin('http://idp.com:3500', { args: name }, (name) => { + cy.origin('http://www.idp.com:3500', { args: name }, (name) => { cy.visit('http://www.idp.com:3500/fixtures/auth/idp.html') cy.get('[data-cy="username"]').type(name) cy.get('[data-cy="login"]').click() @@ -154,9 +154,9 @@ describe('Multi-step Auth', () => { cy.visit('/fixtures/auth/index.html') cy.get('[data-cy="login-with-approval"]').click() // takes you to foobar.com.../approval cy.url() //fail - cy.origin('http://foobar.com:3500', () => { // Parent origin is localhost + cy.origin('http://www.foobar.com:3500', () => { // Parent origin is localhost cy.get('[data-cy="approve-orig"]').click() // takes you to idp.com - cy.origin('http://idp.com:3500', () => { // Parent origin is foobar.com + cy.origin('http://www.idp.com:3500', () => { // Parent origin is foobar.com cy.get('[data-cy="username"]').type('MarkyMark') cy.get('[data-cy="login"]').click() // Takes you back to localhost }) // Does not wait on foobar.com because there are no subsequent commands (would wait forever) @@ -172,11 +172,11 @@ describe('Multi-step Auth', () => { it.skip('final-auth redirects back to localhost - flat', () => { cy.visit('/fixtures/auth/index.html') cy.get('[data-cy="login-with-approval"]').click() // takes you to foobar.com.../approval - cy.origin('http://foobar.com:3500', () => { // Parent origin is localhost + cy.origin('http://www.foobar.com:3500', () => { // Parent origin is localhost cy.get('[data-cy="approve-orig"]').click() // takes you to idp.com }) // Exits and moves on to the next command - cy.origin('http://idp.com:3500', () => { // Parent origin is localhost + cy.origin('http://www.idp.com:3500', () => { // Parent origin is localhost cy.get('[data-cy="username"]').type('MarkyMark') cy.get('[data-cy="login"]').click() // Takes you back to localhost }) // Exits and moves on to the next command @@ -189,10 +189,10 @@ describe('Multi-step Auth', () => { // TODO: cy.origin does not work in cy.origin yet. it.skip('final auth redirects back to localhost - nested - approval first', () => { - cy.origin('http://foobar.com:3500', () => { // parent origin is localhost + cy.origin('http://www.foobar.com:3500', () => { // parent origin is localhost cy.visit('http://www.foobar.com:3500/fixtures/auth/approval.html') cy.get('[data-cy="approve-orig"]').click() // takes you to idp.com - cy.origin('http://idp.com:3500', () => { // parent origin is foobar.com + cy.origin('http://www.idp.com:3500', () => { // parent origin is foobar.com cy.get('[data-cy="username"]').type('MarkyMark') cy.get('[data-cy="login"]').click() // Takes you back to localhost }) // Does not wait on foobar.com because there are no subsequent commands (would wait forever) @@ -208,9 +208,9 @@ describe('Multi-step Auth', () => { it.skip('final auth redirects back to approval page - nested', () => { cy.visit('/fixtures/auth/index.html') cy.get('[data-cy="login-with-approval"]').click() // takes you to foobar.com.../approval - cy.origin('http://foobar.com:3500', () => { // parent origin is localhost + cy.origin('http://www.foobar.com:3500', () => { // parent origin is localhost cy.get('[data-cy="approve-me"]').click() // takes you to idp.com - cy.origin('http://idp.com:3500', () => { // parent origin is foobar.com + cy.origin('http://www.idp.com:3500', () => { // parent origin is foobar.com cy.get('[data-cy="username"]').type('MarkyMark') cy.get('[data-cy="login"]').click() // Takes you back to foobar.com.../approval }) // Exits and moves on to the next command @@ -227,16 +227,16 @@ describe('Multi-step Auth', () => { it('final auth redirects back to approval page - flat', () => { cy.visit('/fixtures/auth/index.html') cy.get('[data-cy="login-with-approval"]').click() // takes you to foobar.com.../approval - cy.origin('http://foobar.com:3500', () => { // parent origin is localhost + cy.origin('http://www.foobar.com:3500', () => { // parent origin is localhost cy.get('[data-cy="approve-me"]').click() // takes you to idp.com }) // waits on localhost forever, this breaks - cy.origin('http://idp.com:3500', () => { // parent origin is localhost + cy.origin('http://www.idp.com:3500', () => { // parent origin is localhost cy.get('[data-cy="username"]').type('MarkyMark') cy.get('[data-cy="login"]').click() // Takes you back to foobar.com.../approval }) // Exits and moves on to the next command - cy.origin('http://foobar.com:3500', () => { // parent origin is localhost + cy.origin('http://www.foobar.com:3500', () => { // parent origin is localhost cy.get('[data-cy="login-success"]').click() // Takes you back to localhost }) // Exits and moves on to the next command diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/actions.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/actions.cy.ts index c5d3adccf0b8..ac5324b31d31 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/actions.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/actions.cy.ts @@ -8,7 +8,7 @@ context('cy.origin actions', () => { it('.type()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#input').type('foo') .should('have.value', 'foo') }) @@ -17,7 +17,7 @@ context('cy.origin actions', () => { it('.focus()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#input').focus() .should('be.focused') }) @@ -26,7 +26,7 @@ context('cy.origin actions', () => { it('.blur()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#input').type('foo').blur() .should('not.be.focused') }) @@ -35,7 +35,7 @@ context('cy.origin actions', () => { it('.clear()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#input') .type('foo').should('have.value', 'foo') .clear().should('have.value', '') @@ -45,7 +45,7 @@ context('cy.origin actions', () => { it('.submit()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const afterFormSubmitted = new Promise((resolve) => { cy.once('form:submitted', resolve) }) @@ -58,7 +58,7 @@ context('cy.origin actions', () => { it('.click()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#button').then(($btn) => { const onClick = new Promise((resolve) => { $btn.on('click', () => resolve()) @@ -73,7 +73,7 @@ context('cy.origin actions', () => { it('.dblclick()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#button').then(($btn) => { const afterDblClick = new Promise((resolve) => { $btn.on('dblclick', () => resolve()) @@ -88,7 +88,7 @@ context('cy.origin actions', () => { it('.rightclick()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#button').then(($btn) => { const afterContextmenu = new Promise((resolve) => { $btn.on('contextmenu', () => resolve()) @@ -103,7 +103,7 @@ context('cy.origin actions', () => { it('.check()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get(':checkbox[name="colors"][value="blue"]') .check().should('be.checked') }) @@ -112,7 +112,7 @@ context('cy.origin actions', () => { it('.uncheck()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get(':checkbox[name="colors"][value="blue"]') .check().should('be.checked') .uncheck().should('not.be.checked') @@ -122,7 +122,7 @@ context('cy.origin actions', () => { it('.select()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('select[name="foods"]') .select('Japanese').should('have.value', 'Japanese') }) @@ -131,7 +131,7 @@ context('cy.origin actions', () => { it('.scrollIntoView()', () => { cy.get('a[data-cy="scrolling-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#scroll-into-view-vertical h5') .should('not.be.visible') .scrollIntoView().should('be.visible') @@ -141,7 +141,7 @@ context('cy.origin actions', () => { it('.scrollTo()', () => { cy.get('a[data-cy="scrolling-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#scroll-into-view-vertical h5').should('not.be.visible') cy.get('#scroll-into-view-vertical').scrollTo(0, 300) cy.get('#scroll-into-view-vertical h5').should('be.visible') @@ -151,7 +151,7 @@ context('cy.origin actions', () => { it('.trigger()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#button').then(($btn) => { const afterClick = new Promise((resolve) => { $btn.on('click', () => resolve()) @@ -166,7 +166,7 @@ context('cy.origin actions', () => { it('.selectFile()', () => { cy.get('a[data-cy="files-form-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.wrap(Cypress.Buffer.from('foo')).as('foo') cy.get('#basic') @@ -193,7 +193,7 @@ context('cy.origin actions', () => { it('.get()', { defaultCommandTimeout: 50 }, (done) => { cy.on('fail', (err) => { expect(err.message).to.include(`Timed out retrying after 50ms:`) - expect(err.message).to.include(`The command was expected to run against origin \`http://localhost:3500\` but the application is at origin \`http://foobar.com:3500\`.`) + expect(err.message).to.include(`The command was expected to run against origin \`http://localhost:3500\` but the application is at origin \`http://www.foobar.com:3500\`.`) expect(err.message).to.include(`This commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.`) // make sure that the secondary origin failures do NOT show up as spec failures or AUT failures expect(err.message).not.to.include(`The following error originated from your test code, not from Cypress`) @@ -220,7 +220,7 @@ context('cy.origin actions', () => { it('.get()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#button') }) @@ -242,7 +242,7 @@ context('cy.origin actions', () => { it('.alias()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#button').as('buttonAlias') }) @@ -266,7 +266,7 @@ context('cy.origin actions', () => { it('.click()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#button-inside-a').click() }) @@ -319,7 +319,7 @@ context('cy.origin actions', () => { it('.dblclick()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#button').dblclick() }) @@ -367,7 +367,7 @@ context('cy.origin actions', () => { it('.rightclick()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#button').rightclick() }) @@ -415,7 +415,7 @@ context('cy.origin actions', () => { it('.type()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('input#input').type('foo') }) @@ -487,7 +487,7 @@ context('cy.origin actions', () => { // TODO: fix flaky test https://github.com/cypress-io/cypress/issues/23480 it.skip('.submit()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('form#multiple-inputs-and-input-submit input[name="fname"]').type('foo') cy.get('form#multiple-inputs-and-input-submit input[name="lname"]').type('bar') cy.get('form#multiple-inputs-and-input-submit').submit() @@ -522,7 +522,7 @@ context('cy.origin actions', () => { it('.focus()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#input').focus() }) @@ -545,7 +545,7 @@ context('cy.origin actions', () => { it('.blur()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { // FIXME: snapshot shows the primary domain (before type). Should be secondary cy.get('#input').type('foo').blur() }) @@ -569,7 +569,7 @@ context('cy.origin actions', () => { it('.clear()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { // FIXME: snapshot shows the primary domain. Should be secondary cy.get('#input').type('foo').clear() }) @@ -595,7 +595,7 @@ context('cy.origin actions', () => { it('.check()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get(':checkbox[name="colors"][value="blue"]').check() }) @@ -639,7 +639,7 @@ context('cy.origin actions', () => { it('.uncheck()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get(':checkbox[name="colors"][value="blue"]') .check().uncheck() }) @@ -684,7 +684,7 @@ context('cy.origin actions', () => { it('.select()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { // TODO: wrong selected value is displayed in the snapshot after cy.get('select[name="foods"]').select('Japanese') }) @@ -730,7 +730,7 @@ context('cy.origin actions', () => { it('.scrollIntoView()', () => { cy.get('a[data-cy="scrolling-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { // FIXME: snapshot of primary is showing for scrollIntoView cy.get('#scroll-into-view-vertical h5') .should('not.be.visible') @@ -758,7 +758,7 @@ context('cy.origin actions', () => { it('.scrollTo()', () => { cy.get('a[data-cy="scrolling-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#scroll-into-view-vertical h5').should('not.be.visible') cy.get('#scroll-into-view-vertical').scrollTo(0, 300) }) @@ -778,7 +778,7 @@ context('cy.origin actions', () => { it('.trigger()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#button').trigger('click') }) @@ -803,7 +803,7 @@ context('cy.origin actions', () => { it('.selectFile()', () => { cy.get('a[data-cy="files-form-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#basic').selectFile({ contents: Cypress.Buffer.from('foo'), fileName: 'foo.txt' }) }) diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/aliasing.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/aliasing.cy.ts index e225b4270f97..2d6f77ebbc9d 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/aliasing.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/aliasing.cy.ts @@ -9,7 +9,7 @@ context('cy.origin aliasing', () => { it('supports dom elements inside origin', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get(':checkbox[name="colors"][value="blue"]').as('checkbox') cy.get('@checkbox').click().should('be.checked') }) @@ -23,7 +23,7 @@ context('cy.origin aliasing', () => { cy.get('[data-cy="cross-origin-secondary-link"]').as('link') - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('@link').click() }) }) @@ -43,7 +43,7 @@ context('cy.origin aliasing', () => { it('.as()', () => { cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#button').as('buttonAlias') }) diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/assertions.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/assertions.cy.ts index 2dd1ae3ba854..6e12063ae998 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/assertions.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/assertions.cy.ts @@ -7,7 +7,7 @@ context('cy.origin assertions', () => { }) it('.should() and .and()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get(':checkbox[name="colors"][value="blue"]') .should('not.be.checked').and('not.be.disabled') }) @@ -33,7 +33,7 @@ context('cy.origin assertions', () => { // TODO: fix flaky test https://github.com/cypress-io/cypress/issues/23148 it.skip('.should() and .and()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get(':checkbox[name="colors"][value="blue"]') .should('not.be.checked').and('not.be.disabled') }) diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/connectors.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/connectors.cy.ts index 5790fb55920c..ab8690605a3b 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/connectors.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/connectors.cy.ts @@ -7,7 +7,7 @@ context('cy.origin connectors', () => { }) it('.each()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-name>[name="colors"]').each(($element, index) => { expect($element.prop('type')).to.equal('checkbox') }) @@ -15,19 +15,19 @@ context('cy.origin connectors', () => { }) it('.its()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id>input').its('length').should('eq', 3) }) }) it('.invoke()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#button').invoke('text').should('eq', 'button') }) }) it('.spread()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const arr = ['foo', 'bar', 'baz'] cy.wrap(arr).spread((foo, bar, baz) => { @@ -39,7 +39,7 @@ context('cy.origin connectors', () => { }) it('.then()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id>input').then(($list) => { expect($list).to.have.length(3) }) @@ -58,7 +58,7 @@ context('cy.origin connectors', () => { }) it('.its()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id>input').its('length') }) @@ -92,7 +92,7 @@ context('cy.origin connectors', () => { }) it('.invoke()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#button').invoke('text') }) diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/cookies.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/cookies.cy.ts index 5bd9d056ea61..4887980fdc22 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/cookies.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/cookies.cy.ts @@ -8,7 +8,7 @@ describe('cy.origin cookies', () => { }) it('.getCookie(), .getCookies(), and .setCookie()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.getCookies().should('be.empty') cy.setCookie('foo', 'bar') @@ -19,7 +19,7 @@ describe('cy.origin cookies', () => { }) it('.clearCookie()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.setCookie('foo', 'bar') cy.getCookie('foo').should('not.be.null') cy.clearCookie('foo') @@ -28,7 +28,7 @@ describe('cy.origin cookies', () => { }) it('.clearCookies()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.setCookie('foo', 'bar') cy.setCookie('faz', 'baz') @@ -58,7 +58,7 @@ describe('cy.origin cookies', () => { expect(logs[0].get('state')).to.eq('failed') expect(logs[0].get('name')).to.eq('getCookie') expect(logs[0].get('message')).to.eq('foo') - expect(err.message).to.eq('Timed out retrying after 100ms: The command was expected to run against origin `http://localhost:3500` but the application is at origin `http://foobar.com:3500`.\n\nThis commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.') + expect(err.message).to.eq('Timed out retrying after 100ms: The command was expected to run against origin `http://localhost:3500` but the application is at origin `http://www.foobar.com:3500`.\n\nThis commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.') done() }) @@ -73,7 +73,7 @@ describe('cy.origin cookies', () => { expect(logs[0].get('state')).to.eq('failed') expect(logs[0].get('name')).to.eq('getCookies') expect(logs[0].get('message')).to.eq('') - expect(err.message).to.eq('Timed out retrying after 100ms: The command was expected to run against origin `http://localhost:3500` but the application is at origin `http://foobar.com:3500`.\n\nThis commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.') + expect(err.message).to.eq('Timed out retrying after 100ms: The command was expected to run against origin `http://localhost:3500` but the application is at origin `http://www.foobar.com:3500`.\n\nThis commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.') done() }) @@ -88,7 +88,7 @@ describe('cy.origin cookies', () => { expect(logs[0].get('state')).to.eq('failed') expect(logs[0].get('name')).to.eq('setCookie') expect(logs[0].get('message')).to.eq('foo, bar') - expect(err.message).to.eq('Timed out retrying after 100ms: The command was expected to run against origin `http://localhost:3500` but the application is at origin `http://foobar.com:3500`.\n\nThis commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.') + expect(err.message).to.eq('Timed out retrying after 100ms: The command was expected to run against origin `http://localhost:3500` but the application is at origin `http://www.foobar.com:3500`.\n\nThis commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.') done() }) @@ -103,7 +103,7 @@ describe('cy.origin cookies', () => { expect(logs[0].get('state')).to.eq('failed') expect(logs[0].get('name')).to.eq('clearCookie') expect(logs[0].get('message')).to.eq('foo') - expect(err.message).to.eq('Timed out retrying after 100ms: The command was expected to run against origin `http://localhost:3500` but the application is at origin `http://foobar.com:3500`.\n\nThis commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.') + expect(err.message).to.eq('Timed out retrying after 100ms: The command was expected to run against origin `http://localhost:3500` but the application is at origin `http://www.foobar.com:3500`.\n\nThis commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.') done() }) @@ -118,7 +118,7 @@ describe('cy.origin cookies', () => { expect(logs[0].get('state')).to.eq('failed') expect(logs[0].get('name')).to.eq('clearCookies') expect(logs[0].get('message')).to.eq('') - expect(err.message).to.eq('Timed out retrying after 100ms: The command was expected to run against origin `http://localhost:3500` but the application is at origin `http://foobar.com:3500`.\n\nThis commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.') + expect(err.message).to.eq('Timed out retrying after 100ms: The command was expected to run against origin `http://localhost:3500` but the application is at origin `http://www.foobar.com:3500`.\n\nThis commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.') done() }) @@ -140,7 +140,7 @@ describe('cy.origin cookies', () => { }) it('.getCookie()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.getCookies().should('be.empty') cy.setCookie('foo', 'bar') cy.getCookie('foo').its('value').should('equal', 'bar') @@ -161,7 +161,7 @@ describe('cy.origin cookies', () => { }) it('.getCookies()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.getCookies().should('be.empty') cy.setCookie('foo', 'bar') @@ -189,7 +189,7 @@ describe('cy.origin cookies', () => { }) it('.setCookie()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.getCookies().should('be.empty') cy.setCookie('foo', 'bar') @@ -210,7 +210,7 @@ describe('cy.origin cookies', () => { }) it('.clearCookie()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.setCookie('foo', 'bar') cy.getCookie('foo').should('not.be.null') cy.clearCookie('foo') @@ -232,7 +232,7 @@ describe('cy.origin cookies', () => { }) it('.clearCookies()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.setCookie('foo', 'bar') cy.setCookie('faz', 'baz') diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/files.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/files.cy.ts index d688ad1ed37f..ec90c2d88038 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/files.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/files.cy.ts @@ -7,7 +7,7 @@ context('cy.origin files', () => { }) it('.fixture()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.fixture('example.json').then((json) => { expect(json).to.be.an('object') expect(json.example).to.be.true @@ -16,7 +16,7 @@ context('cy.origin files', () => { }) it('.readFile()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.readFile('cypress/fixtures/example.json').then((json) => { expect(json).to.be.an('object') expect(json.example).to.be.true @@ -25,7 +25,7 @@ context('cy.origin files', () => { }) it('.writeFile()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const contents = JSON.stringify({ foo: 'bar' }) cy.stub(Cypress, 'backend').resolves({ @@ -59,7 +59,7 @@ context('cy.origin files', () => { }) it('.readFile()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.readFile('cypress/fixtures/example.json') }) @@ -73,7 +73,7 @@ context('cy.origin files', () => { }) it('.writeFile()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const contents = JSON.stringify({ foo: 'bar' }) cy.stub(Cypress, 'backend').resolves({ diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/local_storage.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/local_storage.cy.ts index 77a1294480a3..7debeaa90432 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/local_storage.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/local_storage.cy.ts @@ -7,7 +7,7 @@ context('cy.origin local storage', () => { }) it('.clearLocalStorage()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.window().then((win) => { win.localStorage.setItem('foo', 'bar') expect(win.localStorage.getItem('foo')).to.equal('bar') @@ -32,7 +32,7 @@ context('cy.origin local storage', () => { }) it('.clearLocalStorage()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.window().then((win) => { win.localStorage.setItem('foo', 'bar') expect(win.localStorage.getItem('foo')).to.equal('bar') diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/location.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/location.cy.ts index 84cef0977dbd..1060d3fda025 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/location.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/location.cy.ts @@ -7,13 +7,13 @@ context('cy.origin location', () => { }) it('.hash()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.hash().should('be.empty') }) }) it('.location()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.location().should((location) => { expect(location.href).to.equal('http://www.foobar.com:3500/fixtures/secondary-origin.html') expect(location.origin).to.equal('http://www.foobar.com:3500') @@ -22,7 +22,7 @@ context('cy.origin location', () => { }) it('.url()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.url().should('equal', 'http://www.foobar.com:3500/fixtures/secondary-origin.html') }) }) @@ -39,7 +39,7 @@ context('cy.origin location', () => { }) it('.hash()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.hash() }) @@ -51,7 +51,7 @@ context('cy.origin location', () => { }) it('.location()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.location() }) @@ -78,7 +78,7 @@ context('cy.origin location', () => { }) it('.url()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.url() }) diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/log.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/log.cy.ts index 859f714cce26..2db1a85c41a7 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/log.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/log.cy.ts @@ -16,7 +16,7 @@ context('cy.origin log', () => { }) it('logs in primary and secondary origins', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const afterLogAdded = new Promise((resolve) => { const listener = (attrs) => { if (attrs.message === 'test log in cy.origin') { @@ -42,7 +42,7 @@ context('cy.origin log', () => { }) it('has a different id in a second test', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const afterLogAdded = new Promise((resolve) => { const listener = (attrs) => { if (attrs.message === 'test log in cy.origin') { diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/misc.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/misc.cy.ts index 5aca750195f3..113baf5fb671 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/misc.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/misc.cy.ts @@ -7,37 +7,37 @@ context('cy.origin misc', () => { }) it('.end()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#button').end().should('be.null') }) }) it('.exec()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.exec('echo foobar').its('stdout').should('contain', 'foobar') }) }) it('.focused()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#button').click().focused().should('have.id', 'button') }) }) it('.wrap()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.wrap({ foo: 'bar' }).should('deep.equal', { foo: 'bar' }) }) }) it('.debug()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#button').debug().should('have.id', 'button') }) }) it('.pause()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const afterPaused = new Promise((resolve) => { cy.once('paused', () => { Cypress.emit('resume:all') @@ -54,7 +54,7 @@ context('cy.origin misc', () => { }) it('.task()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.task('return:arg', 'works').should('eq', 'works') }) }) @@ -71,7 +71,7 @@ context('cy.origin misc', () => { }) it('.exec()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.exec('echo foobar') }) @@ -87,7 +87,7 @@ context('cy.origin misc', () => { }) it('.focused()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#button').click().focused() }) @@ -108,7 +108,7 @@ context('cy.origin misc', () => { }) it('.wrap()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const arr = ['foo', 'bar', 'baz'] cy.wrap(arr).spread((foo, bar, baz) => { @@ -129,7 +129,7 @@ context('cy.origin misc', () => { }) it('.debug()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#button').debug() }) @@ -149,7 +149,7 @@ context('cy.origin misc', () => { }) it('.pause()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const afterPaused = new Promise((resolve) => { cy.once('paused', () => { Cypress.emit('resume:all') @@ -178,7 +178,7 @@ context('cy.origin misc', () => { }) it('.task()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.task('return:arg', 'works') }) diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/navigation.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/navigation.cy.ts index 73392bcafa7f..835033c76cbc 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/navigation.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/navigation.cy.ts @@ -6,7 +6,7 @@ context('cy.origin navigation', () => { cy.visit('/fixtures/primary-origin.html') cy.get('a[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/dom.html') cy.go('back') @@ -21,7 +21,7 @@ context('cy.origin navigation', () => { cy.visit('/fixtures/primary-origin.html') cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.window().then((localWindow) => { // Define a custom property on window that we can assert the presence of. // After reloading, this property should not exist. @@ -57,7 +57,7 @@ context('cy.origin navigation', () => { expect(primaryVisitLoadSpy).to.be.calledOnce }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const secondaryCyBeforeLoadSpy = cy.spy() const secondaryCyLoadSpy = cy.spy() const secondaryVisitBeforeLoadSpy = cy.spy() @@ -86,7 +86,7 @@ context('cy.origin navigation', () => { it('supports visiting primary first', () => { cy.visit('/fixtures/primary-origin.html') - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/secondary-origin.html') cy.get('[data-cy="dom-check"]').should('have.text', 'From a secondary origin') @@ -94,7 +94,7 @@ context('cy.origin navigation', () => { }) it('supports skipping visiting primary first', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/secondary-origin.html') cy.get('[data-cy="dom-check"]').should('have.text', 'From a secondary origin') @@ -105,7 +105,7 @@ context('cy.origin navigation', () => { it.skip('supports nesting a third origin', () => { cy.visit('/fixtures/primary-origin.html') - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/secondary-origin.html') cy.get('[data-cy="dom-check"]').should('have.text', 'From a secondary origin') @@ -121,7 +121,7 @@ context('cy.origin navigation', () => { cy.get('a[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('[data-cy="dom-check"]').should('have.text', 'From a secondary origin') cy.visit('http://www.foobar.com:3500/fixtures/dom.html') @@ -162,7 +162,7 @@ context('cy.origin navigation', () => { cy.get('a[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/secondary-origin.html#hashchange') cy.location('hash').should('equal', '#hashchange') @@ -170,7 +170,7 @@ context('cy.origin navigation', () => { }) it('navigates back to primary', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/secondary-origin.html') cy.get('[data-cy="dom-check"]').should('have.text', 'From a secondary origin') }) @@ -185,7 +185,7 @@ context('cy.origin navigation', () => { cy.visit('/fixtures/primary-origin.html') cy.get('a[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { // this call should succeed because we can visit a cross-origin cy.visit('http://www.idp.com:3500/fixtures/dom.html') }) @@ -203,7 +203,7 @@ context('cy.origin navigation', () => { In order to visit a different origin, you can enable the \`experimentalSessionAndOrigin\` flag and use \`cy.origin()\`:\n \`cy.visit('http://localhost:3500/fixtures/primary-origin.html')\` \`\`\n - \`cy.origin('http://foobar.com:3500', () => {\` + \`cy.origin('http://www.foobar.com:3500', () => {\` \` cy.visit('http://www.foobar.com:3500/fixtures/dom.html')\` \` \` \`})\`\n @@ -227,7 +227,7 @@ context('cy.origin navigation', () => { it('supports the query string option', () => { cy.visit('/fixtures/primary-origin.html') - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/secondary-origin.html', { qs: { foo: 'bar' } }) cy.location('search').should('equal', '?foo=bar') @@ -256,7 +256,7 @@ context('cy.origin navigation', () => { cy.visit('/fixtures/primary-origin.html') - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/secondary-origin.html') cy.get('[data-cy="dom-check"]').should('have.text', 'From a secondary origin') @@ -265,7 +265,7 @@ context('cy.origin navigation', () => { it('succeeds when the secondary is already defined but the AUT is still on the primary', () => { // setup the secondary to be on the secondary origin - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/secondary-origin.html') cy.get('[data-cy="dom-check"]').should('have.text', 'From a secondary origin') @@ -275,7 +275,7 @@ context('cy.origin navigation', () => { cy.visit('/fixtures/primary-origin.html') // verify there aren't any issues when the AUT is on primary but the spec bridge is on secondary (cross-origin) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/secondary-origin.html') cy.get('[data-cy="dom-check"]').should('have.text', 'From a secondary origin') @@ -287,7 +287,7 @@ context('cy.origin navigation', () => { cy.on('window:load', primaryCyLoadSpy) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const secondaryCyLoadSpy = cy.spy() cy.on('window:load', secondaryCyLoadSpy) @@ -339,7 +339,7 @@ context('cy.origin navigation', () => { }) it('supports auth options and adding auth to subsequent requests', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/basic_auth', { auth: { username: 'cypress', @@ -365,7 +365,7 @@ context('cy.origin navigation', () => { }) }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('body').should('have.text', 'basic auth worked') }) @@ -376,7 +376,7 @@ context('cy.origin navigation', () => { win.location.href = 'http://www.foobar.com:3500/basic_auth' }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('body').should('have.text', 'basic auth worked') }) }) @@ -395,7 +395,7 @@ context('cy.origin navigation', () => { win.location.href = 'http://www.foobar.com:3500/fixtures/primary-origin.html' }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.window().then((win) => { win.location.href = 'http://www.foobar.com:3500/basic_auth' }) @@ -432,7 +432,7 @@ context('cy.origin navigation', () => { cy.visit('/fixtures/primary-origin.html') cy.get('a[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.window().then((win) => { win.location.href = 'http://www.foobar.com:3500/fixtures/dom.html' }) @@ -456,7 +456,7 @@ context('cy.origin navigation', () => { cy.visit('/fixtures/primary-origin.html') cy.get('a[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/dom.html') cy.go('back') @@ -477,7 +477,7 @@ context('cy.origin navigation', () => { cy.visit('/fixtures/primary-origin.html') cy.get('a[data-cy="dom-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.reload() }) @@ -495,7 +495,7 @@ context('cy.origin navigation', () => { it('visit()', () => { cy.visit('/fixtures/primary-origin.html') - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/secondary-origin.html') cy.get('[data-cy="dom-check"]').should('have.text', 'From a secondary origin') diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/network_requests.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/network_requests.cy.ts index d4925cd4616f..7e05cfa03a90 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/network_requests.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/network_requests.cy.ts @@ -7,8 +7,8 @@ context('cy.origin network requests', () => { }) it('.request() to secondary origin', () => { - cy.origin('http://foobar.com:3500', () => { - cy.request('http://www.foobar.com:3500/fixtures/example.json').should((response) => { + cy.origin('http://www.foobar.com:3500', () => { + cy.request('/fixtures/example.json').should((response) => { expect(response.status).to.equal(200) expect(response.allRequestResponses[0]['Request URL']).to.equal('http://www.foobar.com:3500/fixtures/example.json') }) @@ -25,7 +25,7 @@ context('cy.origin network requests', () => { }) it('.request() to primary origin', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.request('http://localhost:3500/fixtures/example.json').should((response) => { expect(response.status).to.equal(200) expect(response.allRequestResponses[0]['Request URL']).to.equal('http://localhost:3500/fixtures/example.json') @@ -45,8 +45,8 @@ context('cy.origin network requests', () => { }) it('.request()', () => { - cy.origin('http://foobar.com:3500', () => { - cy.request('http://www.foobar.com:3500/fixtures/example.json') + cy.origin('http://www.foobar.com:3500', () => { + cy.request('/fixtures/example.json') }) cy.shouldWithTimeout(() => { @@ -67,7 +67,7 @@ context('cy.origin network requests', () => { expect(consoleProps.Yielded).to.have.property('status').that.equals(200) expect(renderProps).to.have.property('indicator').that.equals('successful') - expect(renderProps).to.have.property('message').that.equals('GET 200 http://www.foobar.com:3500/fixtures/example.json') + expect(renderProps).to.have.property('message').that.equals('GET 200 /fixtures/example.json') }) }) }) diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/querying.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/querying.cy.ts index a78d7fa5dd4c..615d5fdadd64 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/querying.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/querying.cy.ts @@ -7,19 +7,19 @@ context('cy.origin querying', () => { }) it('.get()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#input') }) }) it('.contains()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.contains('Nested Find') }) }) it('.within()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id').within(() => { cy.get('#input') }) @@ -27,7 +27,7 @@ context('cy.origin querying', () => { }) it('.root()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.root().should('match', 'html') }) }) @@ -36,7 +36,7 @@ context('cy.origin querying', () => { it('.get()', (done) => { cy.on('fail', (err) => { expect(err.message).to.include(`Timed out retrying after 50ms:`) - expect(err.message).to.include(`The command was expected to run against origin \`http://localhost:3500\` but the application is at origin \`http://foobar.com:3500\`.`) + expect(err.message).to.include(`The command was expected to run against origin \`http://localhost:3500\` but the application is at origin \`http://www.foobar.com:3500\`.`) expect(err.message).to.include(`This commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.`) // make sure that the secondary origin failures do NOT show up as spec failures or AUT failures expect(err.message).not.to.include(`The following error originated from your test code, not from Cypress`) @@ -50,7 +50,7 @@ context('cy.origin querying', () => { it('.contains()', (done) => { cy.on('fail', (err) => { expect(err.message).to.include(`Timed out retrying after 50ms:`) - expect(err.message).to.include(`The command was expected to run against origin \`http://localhost:3500\` but the application is at origin \`http://foobar.com:3500\`.`) + expect(err.message).to.include(`The command was expected to run against origin \`http://localhost:3500\` but the application is at origin \`http://www.foobar.com:3500\`.`) expect(err.message).to.include(`This commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.`) // make sure that the secondary origin failures do NOT show up as spec failures or AUT failures expect(err.message).not.to.include(`The following error originated from your test code, not from Cypress`) @@ -64,7 +64,7 @@ context('cy.origin querying', () => { it('.within()', (done) => { cy.on('fail', (err) => { expect(err.message).to.include(`Timed out retrying after 50ms:`) - expect(err.message).to.include(`The command was expected to run against origin \`http://localhost:3500\` but the application is at origin \`http://foobar.com:3500\`.`) + expect(err.message).to.include(`The command was expected to run against origin \`http://localhost:3500\` but the application is at origin \`http://www.foobar.com:3500\`.`) expect(err.message).to.include(`This commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.`) // make sure that the secondary origin failures do NOT show up as spec failures or AUT failures expect(err.message).not.to.include(`The following error originated from your test code, not from Cypress`) @@ -80,7 +80,7 @@ context('cy.origin querying', () => { it('.root()', (done) => { cy.on('fail', (err) => { expect(err.message).to.include(`Timed out retrying after 50ms:`) - expect(err.message).to.include(`The command was expected to run against origin \`http://localhost:3500\` but the application is at origin \`http://foobar.com:3500\`.`) + expect(err.message).to.include(`The command was expected to run against origin \`http://localhost:3500\` but the application is at origin \`http://www.foobar.com:3500\`.`) expect(err.message).to.include(`This commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.`) // make sure that the secondary origin failures do NOT show up as spec failures or AUT failures expect(err.message).not.to.include(`The following error originated from your test code, not from Cypress`) @@ -94,7 +94,7 @@ context('cy.origin querying', () => { it('does not get elements in the runner', (done) => { cy.on('fail', (err) => { expect(err.message).to.include(`Timed out retrying after 50ms:`) - expect(err.message).to.include(`The command was expected to run against origin \`http://localhost:3500\` but the application is at origin \`http://foobar.com:3500\`.`) + expect(err.message).to.include(`The command was expected to run against origin \`http://localhost:3500\` but the application is at origin \`http://www.foobar.com:3500\`.`) expect(err.message).to.include(`This commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.`) // make sure that the secondary origin failures do NOT show up as spec failures or AUT failures expect(err.message).not.to.include(`The following error originated from your test code, not from Cypress`) @@ -108,7 +108,7 @@ context('cy.origin querying', () => { it('does not contain elements in the runner', (done) => { cy.on('fail', (err) => { expect(err.message).to.include(`Timed out retrying after 50ms:`) - expect(err.message).to.include(`The command was expected to run against origin \`http://localhost:3500\` but the application is at origin \`http://foobar.com:3500\`.`) + expect(err.message).to.include(`The command was expected to run against origin \`http://localhost:3500\` but the application is at origin \`http://www.foobar.com:3500\`.`) expect(err.message).to.include(`This commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.`) // make sure that the secondary origin failures do NOT show up as spec failures or AUT failures expect(err.message).not.to.include(`The following error originated from your test code, not from Cypress`) @@ -132,7 +132,7 @@ context('cy.origin querying', () => { }) it('.contains()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.contains('Nested Find') }) @@ -155,7 +155,7 @@ context('cy.origin querying', () => { }) it('.within()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id').within(() => { cy.get('#input') }) @@ -177,7 +177,7 @@ context('cy.origin querying', () => { }) it('.root()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.root() }) diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/querying_shadow.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/querying_shadow.cy.ts index 43117e65f5c1..60077167cb1a 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/querying_shadow.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/querying_shadow.cy.ts @@ -7,7 +7,7 @@ context('cy.origin shadow dom', () => { }) it('.shadow()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#shadow-element-1').shadow().find('p.shadow-1') .should('have.text', 'Shadow Content 1') }) @@ -25,7 +25,7 @@ context('cy.origin shadow dom', () => { }) it('.shadow()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#shadow-element-1').shadow() }) diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/screenshot.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/screenshot.cy.ts index 5c677e7f438e..e39368c6bff5 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/screenshot.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/screenshot.cy.ts @@ -23,7 +23,7 @@ context('cy.origin screenshot', () => { }) it('captures the fullPage', function () { - cy.origin('http://foobar.com:3500', { args: this.serverResult }, (serverResult) => { + cy.origin('http://www.foobar.com:3500', { args: this.serverResult }, (serverResult) => { const automationStub = cy.stub(Cypress, 'automation').withArgs('take:screenshot').resolves(serverResult) cy.screenshot({ capture: 'fullPage' }) @@ -37,7 +37,7 @@ context('cy.origin screenshot', () => { }) it('captures the runner', function () { - cy.origin('http://foobar.com:3500', { args: this.serverResult }, (serverResult) => { + cy.origin('http://www.foobar.com:3500', { args: this.serverResult }, (serverResult) => { const automationStub = cy.stub(Cypress, 'automation').withArgs('take:screenshot').resolves(serverResult) cy.screenshot({ capture: 'runner' }) @@ -49,7 +49,7 @@ context('cy.origin screenshot', () => { }) it('captures the viewport', function () { - cy.origin('http://foobar.com:3500', { args: this.serverResult }, (serverResult) => { + cy.origin('http://www.foobar.com:3500', { args: this.serverResult }, (serverResult) => { const automationStub = cy.stub(Cypress, 'automation').withArgs('take:screenshot').resolves(serverResult) cy.screenshot({ capture: 'viewport' }) @@ -81,7 +81,7 @@ context('cy.origin screenshot', () => { }) it('supports multiple titles', function () { - cy.origin('http://foobar.com:3500', { args: this.serverResult }, (serverResult) => { + cy.origin('http://www.foobar.com:3500', { args: this.serverResult }, (serverResult) => { const automationStub = cy.stub(Cypress, 'automation').withArgs('take:screenshot').resolves(serverResult) cy.screenshot() @@ -92,7 +92,7 @@ context('cy.origin screenshot', () => { }) it('supports the blackout option', function () { - cy.origin('http://foobar.com:3500', { args: this.serverResult }, (serverResult) => { + cy.origin('http://www.foobar.com:3500', { args: this.serverResult }, (serverResult) => { cy.stub(Cypress, 'automation').withArgs('take:screenshot').resolves(serverResult) cy.screenshot({ @@ -110,7 +110,7 @@ context('cy.origin screenshot', () => { }) it('supports element screenshots', function () { - cy.origin('http://foobar.com:3500', { args: this.serverResult }, (serverResult) => { + cy.origin('http://www.foobar.com:3500', { args: this.serverResult }, (serverResult) => { const automationStub = cy.stub(Cypress, 'automation').withArgs('take:screenshot').resolves(serverResult) cy.get('.tall-element').screenshot() @@ -122,7 +122,7 @@ context('cy.origin screenshot', () => { }) it('supports screenshot retrying with appropriate naming', function () { - cy.origin('http://foobar.com:3500', { args: this.serverResult }, (serverResult) => { + cy.origin('http://www.foobar.com:3500', { args: this.serverResult }, (serverResult) => { const automationStub = cy.stub(Cypress, 'automation').withArgs('take:screenshot').resolves(serverResult) cy.state('runnable')._currentRetry = 2 @@ -135,7 +135,7 @@ context('cy.origin screenshot', () => { }) it('calls the onBeforeScreenshot callback', function () { - cy.origin('http://foobar.com:3500', { args: this.serverResult }, (serverResult) => { + cy.origin('http://www.foobar.com:3500', { args: this.serverResult }, (serverResult) => { cy.stub(Cypress, 'automation').withArgs('take:screenshot').resolves(serverResult) const onBeforeScreenshot = cy.stub() @@ -145,7 +145,7 @@ context('cy.origin screenshot', () => { }) it('calls the onAfterScreenshot callback', function () { - cy.origin('http://foobar.com:3500', { args: this.serverResult }, (serverResult) => { + cy.origin('http://www.foobar.com:3500', { args: this.serverResult }, (serverResult) => { cy.stub(Cypress, 'automation').withArgs('take:screenshot').resolves(serverResult) const onAfterScreenshot = cy.stub() @@ -155,7 +155,7 @@ context('cy.origin screenshot', () => { }) it('supports the Cypress.screenshot callbacks', function () { - cy.origin('http://foobar.com:3500', { args: this.serverResult }, (serverResult) => { + cy.origin('http://www.foobar.com:3500', { args: this.serverResult }, (serverResult) => { cy.stub(Cypress, 'automation').withArgs('take:screenshot').resolves(serverResult) const onAfterScreenshot = cy.stub() const onBeforeScreenshot = cy.stub() @@ -172,7 +172,7 @@ context('cy.origin screenshot', () => { }) it('supports pausing timers', function () { - cy.origin('http://foobar.com:3500', { args: this.serverResult }, (serverResult) => { + cy.origin('http://www.foobar.com:3500', { args: this.serverResult }, (serverResult) => { cy.stub(Cypress, 'automation').withArgs('take:screenshot').returns(Cypress.Promise.delay(500, serverResult)) cy.window().then((win) => { @@ -205,7 +205,7 @@ context('cy.origin screenshot', () => { }) it('does not pause timers when disableTimersAndAnimations is false', function () { - cy.origin('http://foobar.com:3500', { args: this.serverResult }, (serverResult) => { + cy.origin('http://www.foobar.com:3500', { args: this.serverResult }, (serverResult) => { cy.stub(Cypress, 'automation').withArgs('take:screenshot').returns(Cypress.Promise.delay(500, serverResult)) cy.window().then((win) => { @@ -235,7 +235,7 @@ context('cy.origin screenshot', () => { expect(err.message).to.include('setTimeout error after screenshot') }) - cy.origin('http://foobar.com:3500', { args: this.serverResult }, (serverResult) => { + cy.origin('http://www.foobar.com:3500', { args: this.serverResult }, (serverResult) => { cy.stub(Cypress, 'automation').withArgs('take:screenshot').returns(Cypress.Promise.delay(100, serverResult)) cy.window().then((win) => { @@ -260,7 +260,7 @@ context('cy.origin screenshot', () => { expect(err.docsUrl).to.deep.eq(['https://on.cypress.io/uncaught-exception-from-application']) }) - cy.origin('http://foobar.com:3500', { args: this.serverResult }, (serverResult) => { + cy.origin('http://www.foobar.com:3500', { args: this.serverResult }, (serverResult) => { cy.stub(Cypress, 'automation').withArgs('take:screenshot').returns(Cypress.Promise.delay(100, serverResult)) cy.window().then((win) => { @@ -283,7 +283,7 @@ context('cy.origin screenshot', () => { cy.viewport(600, 400) cy.visit('/') - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/screenshot-color.html?color=yellow') const screenShotPromiseWithPath = new Promise((resolve) => { cy.screenshot('crop-check', { @@ -309,7 +309,7 @@ context('cy.origin screenshot', () => { cy.viewport(600, 200) cy.visit('/') - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/screenshot-full-page.html') const screenShotPromiseWithPath = new Promise((resolve) => { cy.screenshot('fullPage', { @@ -335,7 +335,7 @@ context('cy.origin screenshot', () => { cy.viewport(600, 200) cy.visit('/') - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/screenshot-full-page-same.html') const screenShotPromiseWithPath = new Promise((resolve) => { @@ -362,7 +362,7 @@ context('cy.origin screenshot', () => { cy.viewport(600, 200) cy.visit('/') - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/screenshot-element.html') const screenShotPromiseWithPath = new Promise((resolve) => { @@ -389,7 +389,7 @@ context('cy.origin screenshot', () => { cy.viewport(600, 200) cy.visit('/') - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/screenshot-color.html?color=yellow') const screenShotPromiseWithPath = new Promise((resolve) => { cy.screenshot('app-clip', { @@ -415,7 +415,7 @@ context('cy.origin screenshot', () => { cy.viewport(600, 200) cy.visit('/') - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/screenshot-color.html?color=yellow') const screenShotPromiseWithPath = new Promise((resolve) => { @@ -442,7 +442,7 @@ context('cy.origin screenshot', () => { cy.viewport(600, 200) cy.visit('/') - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/screenshot-full-page.html') const screenShotPromiseWithPath = new Promise((resolve) => { @@ -469,7 +469,7 @@ context('cy.origin screenshot', () => { cy.viewport(600, 200) cy.visit('/') - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/screenshot-element.html') const screenShotPromiseWithPath = new Promise((resolve) => { cy.get('.element').screenshot('element-clip', { @@ -509,7 +509,7 @@ context('cy.origin screenshot', () => { }) it('.screenshot()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.screenshot({ capture: 'fullPage' }) }) diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/spies_stubs_clocks.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/spies_stubs_clocks.cy.ts index ad06cd0f2f05..3634e120004c 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/spies_stubs_clocks.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/spies_stubs_clocks.cy.ts @@ -7,7 +7,7 @@ context('cy.origin spies, stubs, and clock', () => { }) it('spy()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const foo = { bar () { } } cy.spy(foo, 'bar') @@ -17,7 +17,7 @@ context('cy.origin spies, stubs, and clock', () => { }) it('stub()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const foo = { bar () { } } cy.stub(foo, 'bar') @@ -28,7 +28,7 @@ context('cy.origin spies, stubs, and clock', () => { context('resets stubs', () => { it('creates the stub', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const stubEnv = cy.stub(Cypress, 'env').withArgs('foo').returns('bar') expect(Cypress.env('foo')).to.equal('bar') @@ -39,7 +39,7 @@ context('cy.origin spies, stubs, and clock', () => { }) it('verifies the stub got restored', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { expect(Cypress.env('foo')).to.be.undefined // @ts-ignore expect(Cypress.env.isSinonProxy).to.be.undefined @@ -49,7 +49,7 @@ context('cy.origin spies, stubs, and clock', () => { context('resets spies', () => { it('creates the spy', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const stubEnv = cy.spy(Cypress, 'env') Cypress.env() @@ -60,7 +60,7 @@ context('cy.origin spies, stubs, and clock', () => { }) it('verifies the spy got restored', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { // @ts-ignore expect(Cypress.env.isSinonProxy).to.be.undefined }) @@ -68,7 +68,7 @@ context('cy.origin spies, stubs, and clock', () => { }) it('clock() and tick()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const now = Date.UTC(2022, 0, 12) cy.clock(now) @@ -101,7 +101,7 @@ context('cy.origin spies, stubs, and clock', () => { }) it('spy()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const foo = { bar () { } } cy.spy(foo, 'bar') @@ -119,7 +119,7 @@ context('cy.origin spies, stubs, and clock', () => { }) it('.stub()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const foo = { bar () { } } cy.stub(foo, 'bar') @@ -137,7 +137,7 @@ context('cy.origin spies, stubs, and clock', () => { }) it('.clock()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const now = Date.UTC(2022, 0, 12) cy.clock(now) @@ -157,7 +157,7 @@ context('cy.origin spies, stubs, and clock', () => { }) it('.tick()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const now = Date.UTC(2022, 0, 12) cy.clock(now) diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/traversal.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/traversal.cy.ts index 7e8510170fba..af34204be873 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/traversal.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/traversal.cy.ts @@ -7,110 +7,110 @@ context('cy.origin traversal', () => { }) it('.children()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id').children().should('have.length', 3) }) }) it('.closest()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id').closest('form') }) }) it('.eq()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id>input').eq(1).should('have.id', 'name') }) }) it('.filter()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-name>input') .filter('[name="dogs"]').should('have.length', 4) }) }) it('.find()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id').find('input').should('have.length', 3) }) }) it('.first()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id>input').first().should('have.id', 'input') }) }) it('.last()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id>input').last().should('have.id', 'age') }) }) it('.next()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#input').next().should('have.id', 'name') }) }) it('.nextAll()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#input').nextAll().should('have.length', 2) }) }) it('.nextUntil()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#input').nextUntil('#age').should('have.length', 1) }) }) it('.not()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id>input').not('#age').should('have.length', 2) }) }) it('.parent()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id').parent().should('have.id', 'dom') }) }) it('.parents()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id').parents().should('have.length', 3) }) }) it('.parentsUntil()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id').parentsUntil('body').should('have.length', 1) }) }) it('.prev()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#age').prev().should('have.id', 'name') }) }) it('.prevAll()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#age').prevAll().should('have.length', 2) }) }) it('.prevUntil()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#age').prevUntil('#input').should('have.length', 1) }) }) it('.siblings()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#input').siblings().should('have.length', 2) }) }) @@ -128,7 +128,7 @@ context('cy.origin traversal', () => { }) it('.children()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id').children() }) @@ -157,7 +157,7 @@ context('cy.origin traversal', () => { }) it('.closest()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id').closest('form') }) @@ -184,7 +184,7 @@ context('cy.origin traversal', () => { }) it('.eq()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id>input').eq(1) }) @@ -214,7 +214,7 @@ context('cy.origin traversal', () => { }) it('.filter()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-name>input') .filter('[name="dogs"]') }) @@ -243,7 +243,7 @@ context('cy.origin traversal', () => { }) it('.find()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id').find('input') }) @@ -274,7 +274,7 @@ context('cy.origin traversal', () => { }) it('.first()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id>input').first() }) @@ -305,7 +305,7 @@ context('cy.origin traversal', () => { }) it('.last()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id>input').last() }) @@ -336,7 +336,7 @@ context('cy.origin traversal', () => { }) it('.next()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#input').next() }) @@ -362,7 +362,7 @@ context('cy.origin traversal', () => { }) it('.nextAll()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#input').nextAll() }) @@ -391,7 +391,7 @@ context('cy.origin traversal', () => { }) it('.nextUntil()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#input').nextUntil('#age') }) @@ -417,7 +417,7 @@ context('cy.origin traversal', () => { }) it('.not()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id>input').not('#age') }) @@ -451,7 +451,7 @@ context('cy.origin traversal', () => { }) it('.parent()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id').parent() }) @@ -477,7 +477,7 @@ context('cy.origin traversal', () => { }) it('.parents()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id').parents() }) @@ -506,7 +506,7 @@ context('cy.origin traversal', () => { }) it('.parentsUntil()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#by-id').parentsUntil('body') }) @@ -532,7 +532,7 @@ context('cy.origin traversal', () => { }) it('.prev()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#age').prev() }) @@ -558,7 +558,7 @@ context('cy.origin traversal', () => { }) it('.prevAll()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#age').prevAll() }) @@ -587,7 +587,7 @@ context('cy.origin traversal', () => { }) it('.prevUntil()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#age').prevUntil('#input') }) @@ -613,7 +613,7 @@ context('cy.origin traversal', () => { }) it('.siblings()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#input').siblings() }) diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/unsupported_commands.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/unsupported_commands.cy.ts index facd558ef6e0..c10d24347bf8 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/unsupported_commands.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/unsupported_commands.cy.ts @@ -11,7 +11,7 @@ context('cy.origin unsupported commands', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.route('api') }) }) @@ -23,7 +23,7 @@ context('cy.origin unsupported commands', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.server() }) }) @@ -35,7 +35,7 @@ context('cy.origin unsupported commands', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.origin('barbaz.com', () => {}) }) }) @@ -47,7 +47,7 @@ context('cy.origin unsupported commands', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.intercept('/foo') }) }) @@ -59,7 +59,7 @@ context('cy.origin unsupported commands', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.session('/foo') }) }) diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/viewport.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/viewport.cy.ts index 02bdf8cd553b..dfad1287405a 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/viewport.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/viewport.cy.ts @@ -8,7 +8,7 @@ context('cy.origin viewport', () => { cy.visit('/fixtures/primary-origin.html') cy.get('a[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const viewportChangedSpy = cy.spy() cy.on('viewport:changed', viewportChangedSpy) @@ -33,7 +33,7 @@ context('cy.origin viewport', () => { context('.viewport()', () => { it('changes the viewport', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.window().then((win) => { expect(win.innerHeight).to.equal(660) expect(win.innerWidth).to.equal(1000) @@ -47,7 +47,7 @@ context('cy.origin viewport', () => { }) it('resets the viewport between tests', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.window().then((win) => { expect(win.innerHeight).to.equal(660) expect(win.innerWidth).to.equal(1000) @@ -57,7 +57,7 @@ context('cy.origin viewport', () => { context('cy.on(\'viewport:changed\')', () => { it('calls viewport:changed handler in cy.origin', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const viewportChangedSpy = cy.spy() cy.on('viewport:changed', viewportChangedSpy) @@ -73,7 +73,7 @@ context('cy.origin viewport', () => { cy.on('viewport:changed', viewportChangedSpy) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.viewport(320, 480) }).then(() => { expect(viewportChangedSpy).not.to.be.called @@ -86,7 +86,7 @@ context('cy.origin viewport', () => { before(() => { viewportChangedSpyPrimary = cy.spy() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { // using global since a function can't be passed to cy.origin // and we need to be able to remove the listener in the 'after' hook globalThis.viewportChangedSpySecondary = cy.spy() @@ -95,7 +95,7 @@ context('cy.origin viewport', () => { after(() => { Cypress.off('viewport:changed', viewportChangedSpyPrimary) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { Cypress.off('viewport:changed', globalThis.viewportChangedSpySecondary) }) @@ -103,7 +103,7 @@ context('cy.origin viewport', () => { }) it('calls viewport:changed handler in cy.origin', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { Cypress.on('viewport:changed', globalThis.viewportChangedSpySecondary) cy.viewport(320, 480).then(() => { @@ -115,7 +115,7 @@ context('cy.origin viewport', () => { it('does NOT call viewport:changed handler of primary', () => { Cypress.on('viewport:changed', viewportChangedSpyPrimary) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.viewport(320, 480) }).then(() => { expect(viewportChangedSpyPrimary).not.to.be.called @@ -128,7 +128,7 @@ context('cy.origin viewport', () => { cy.on('viewport:changed', viewportChangedSpy) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { // change the viewport in the secondary first cy.viewport(320, 480) @@ -149,7 +149,7 @@ context('cy.origin viewport', () => { }) it('syncs the viewport across multiple origins', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.viewport(320, 480) cy.window().its('innerHeight').should('eq', 480) @@ -190,7 +190,7 @@ context('cy.origin viewport', () => { }) it('.viewport()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.viewport(320, 480) }) diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/waiting.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/waiting.cy.ts index f758ff1300e1..9e8c2572a11f 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/waiting.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/waiting.cy.ts @@ -24,7 +24,7 @@ const abortRequests = () => { context('cy.origin waiting', () => { before(() => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { let reqQueue: XMLHttpRequest[] = [] window.xhrGet = (url) => { @@ -45,7 +45,7 @@ context('cy.origin waiting', () => { let logs: Map beforeEach(() => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { window.abortRequests() }) @@ -62,7 +62,7 @@ context('cy.origin waiting', () => { context('number', () => { it('waits for the specified value', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const delay = cy.spy(Cypress.Promise, 'delay') cy.wait(50).then(() => { @@ -332,7 +332,7 @@ context('cy.origin waiting', () => { context('#consoleProps', () => { it('number', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.wait(200) }) diff --git a/packages/driver/cypress/e2e/e2e/origin/commands/window.cy.ts b/packages/driver/cypress/e2e/e2e/origin/commands/window.cy.ts index c878244d2e34..2f7a4d835c0d 100644 --- a/packages/driver/cypress/e2e/e2e/origin/commands/window.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/commands/window.cy.ts @@ -7,19 +7,19 @@ context('cy.origin window', () => { }) it('.window()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.window().should('have.property', 'top') }) }) it('.document()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.document().should('have.property', 'charset').and('eq', 'UTF-8') }) }) it('.title()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.title().should('include', 'DOM Fixture') }) }) @@ -36,7 +36,7 @@ context('cy.origin window', () => { }) it('.window()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.window() }) @@ -49,7 +49,7 @@ context('cy.origin window', () => { }) it('.document()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.document() }) @@ -62,7 +62,7 @@ context('cy.origin window', () => { }) it('.title()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.title() }) diff --git a/packages/driver/cypress/e2e/e2e/origin/config_env.cy.ts b/packages/driver/cypress/e2e/e2e/origin/config_env.cy.ts index 61fb510b38ac..a6df37a4b7a2 100644 --- a/packages/driver/cypress/e2e/e2e/origin/config_env.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/config_env.cy.ts @@ -24,7 +24,7 @@ done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { // @ts-ignore Cypress.config('chromeWebSecurity', false) }) @@ -34,7 +34,7 @@ context('serializable', () => { it(`syncs initial Cypress.${fnName}() from the primary origin to the secondary (synchronously)`, () => { Cypress[fnName](USED_KEYS.foo, 'bar') - cy.origin('http://foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { + cy.origin('http://www.foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { const bar = Cypress[fnName](USED_KEYS.foo) expect(bar).to.equal('bar') @@ -43,7 +43,7 @@ it(`syncs serializable values in the Cypress.${fnName}() again to the secondary even after spec bridge is created`, () => { Cypress[fnName](USED_KEYS.foo, 'baz') - cy.origin('http://foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { + cy.origin('http://www.foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { const baz = Cypress[fnName](USED_KEYS.foo) expect(baz).to.equal('baz') @@ -51,7 +51,7 @@ }) it(`syncs serializable Cypress.${fnName}() values outwards from secondary (synchronously)`, () => { - cy.origin('http://foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { + cy.origin('http://www.foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { Cypress[fnName](USED_KEYS.bar, 'baz') }).then(() => { const baz = Cypress[fnName](USED_KEYS.bar) @@ -63,7 +63,7 @@ it(`syncs serializable Cypress.${fnName}() values outwards from secondary even if the value is undefined`, () => { Cypress[fnName](USED_KEYS.foo, 'bar') - cy.origin('http://foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { + cy.origin('http://www.foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { Cypress[fnName](USED_KEYS.foo, undefined) }).then(() => { expect(Cypress[fnName]('foo')).to.be.undefined @@ -71,7 +71,7 @@ }) it(`syncs serializable Cypress.${fnName}() values outwards from secondary (commands/async)`, () => { - cy.origin('http://foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { + cy.origin('http://www.foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { cy.then(() => { Cypress[fnName](USED_KEYS.bar, 'quux') }) @@ -83,7 +83,7 @@ }) it(`persists Cypress.${fnName}() changes made in the secondary, assuming primary has not overwritten with a serializable value`, () => { - cy.origin('http://foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { + cy.origin('http://www.foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { const quux = Cypress[fnName](USED_KEYS.bar) expect(quux).to.equal('quux') @@ -97,7 +97,7 @@ }, }, () => { return new Promise((resolve) => { - cy.origin('http://foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { + cy.origin('http://www.foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { setTimeout(() => { // this value STILL gets set, but will be blown away on the next origin with whatever exists in the primary Cypress[fnName](USED_KEYS.baz, 'qux') @@ -119,7 +119,7 @@ [USED_KEYS.baz]: 'quux', }, }, () => { - cy.origin('http://foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { + cy.origin('http://www.foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { // in previous test, 'baz' was set to 'qux' after the callback window was closed. // this should be overwritten by 'quux' that exists in the primary const quux = Cypress[fnName](USED_KEYS.baz) @@ -134,7 +134,7 @@ [USED_KEYS.baz]: undefined, }, }, () => { - cy.origin('http://foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { + cy.origin('http://www.foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { const isNowUndefined = Cypress[fnName](USED_KEYS.baz) expect(isNowUndefined).to.be.undefined @@ -147,7 +147,7 @@ it('does not sync unserializable values from the primary to the secondary', () => { Cypress[fnName](USED_KEYS.unserializable, unserializableFunc) - cy.origin('http://foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { + cy.origin('http://www.foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { const isUndefined = Cypress[fnName](USED_KEYS.unserializable) expect(isUndefined).to.be.undefined @@ -156,7 +156,7 @@ it('does not overwrite unserializable values in the primary when none exist in the secondary', () => { Cypress[fnName](USED_KEYS.unserializable, unserializableFunc) - cy.origin('http://foobar.com:3500', () => undefined) + cy.origin('http://www.foobar.com:3500', () => undefined) const isFunc = Cypress[fnName](USED_KEYS.unserializable) @@ -165,7 +165,7 @@ it('overwrites unserializable values in the primary when serializable values of same key exist in secondary', () => { Cypress[fnName](USED_KEYS.unserializable, unserializableFunc) - cy.origin('http://foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { + cy.origin('http://www.foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { Cypress[fnName](USED_KEYS.unserializable, undefined) }).then(() => { const isNowUndefined = Cypress[fnName](USED_KEYS.unserializable) @@ -175,7 +175,7 @@ }) it('overwrites unserializable values in the secondary when serializable values of same key exist in primary', () => { - cy.origin('http://foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { + cy.origin('http://www.foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { const unserializableFuncSecondary = () => undefined Cypress[fnName](USED_KEYS.unserializable, unserializableFuncSecondary) @@ -183,7 +183,7 @@ Cypress[fnName](USED_KEYS.unserializable, undefined) }) - cy.origin('http://foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { + cy.origin('http://www.foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { const isUndefined = Cypress[fnName](USED_KEYS.unserializable) expect(isUndefined).to.be.undefined @@ -196,7 +196,7 @@ it('does not overwrite unserializable values in the primary when unserializable values of same key exist in secondary', () => { Cypress[fnName](USED_KEYS.unserializable, unserializableFunc) - cy.origin('http://foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { + cy.origin('http://www.foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { const unserializableFuncSecondary = () => undefined Cypress[fnName](USED_KEYS.unserializable, unserializableFuncSecondary) @@ -215,7 +215,7 @@ Cypress[fnName](USED_KEYS.unserializable, partiallyUnserializableObject) - cy.origin('http://foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { + cy.origin('http://www.foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { const doesNotContainPartialAProperty = Cypress[fnName](USED_KEYS.unserializable) expect(doesNotContainPartialAProperty?.a).to.be.undefined @@ -238,7 +238,7 @@ }, function () { Cypress[fnName](USED_KEYS.error, new Error('error')) - cy.origin('http://foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { + cy.origin('http://www.foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { const isUndefined = Cypress[fnName](USED_KEYS.error) expect(isUndefined).to.be.undefined @@ -251,7 +251,7 @@ }, () => { Cypress[fnName](USED_KEYS.error, new Error('error')) - cy.origin('http://foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { + cy.origin('http://www.foobar.com:3500', { args: { fnName, USED_KEYS } }, ({ fnName, USED_KEYS }) => { const isErrorObj = Cypress[fnName](USED_KEYS.error) // We preserve the error structure, but on preprocessing to the spec bridge, the error is converted to a flat object diff --git a/packages/driver/cypress/e2e/e2e/origin/cookie_behavior.cy.ts b/packages/driver/cypress/e2e/e2e/origin/cookie_behavior.cy.ts index 4726fb353f17..84f66337f653 100644 --- a/packages/driver/cypress/e2e/e2e/origin/cookie_behavior.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/cookie_behavior.cy.ts @@ -533,7 +533,7 @@ describe('Cookie Behavior with experimentalSessionAndOrigin=true', () => { }) it('does set cookie if withCredentials is true, and sends cookie if withCredentials is true', () => { - cy.intercept(`${scheme}://www.barbaz.com:${sameOriginPort}/test-credentials`, (req) => { + cy.intercept(`${scheme}://www.barbaz.com:${sameOriginPort}/test-request-credentials`, (req) => { expect(req['headers']['cookie']).to.equal('bar1=baz1') req.reply({ @@ -563,7 +563,7 @@ describe('Cookie Behavior with experimentalSessionAndOrigin=true', () => { // cy.getCookie('bar1').its('value').should('equal', 'baz1') cy.window().then((win) => { - return cy.wrap(makeRequest(win, `${scheme}://www.barbaz.com:${sameOriginPort}/test-credentials`, 'xmlHttpRequest', true)) + return cy.wrap(makeRequest(win, `${scheme}://www.barbaz.com:${sameOriginPort}/test-request-credentials`, 'xmlHttpRequest', true)) }) cy.wait('@cookieCheck') @@ -665,7 +665,7 @@ describe('Cookie Behavior with experimentalSessionAndOrigin=true', () => { // can only set third-party SameSite=None with Secure attribute, which is only possibly over https if (scheme === 'https') { it('does set cookie if credentials is "include", and sends cookie if credentials is "include"', () => { - cy.intercept(`${scheme}://www.barbaz.com:${sameOriginPort}/test-credentials`, (req) => { + cy.intercept(`${scheme}://www.barbaz.com:${sameOriginPort}/test-request-credentials`, (req) => { expect(req['headers']['cookie']).to.equal('bar1=baz1') req.reply({ @@ -697,7 +697,7 @@ describe('Cookie Behavior with experimentalSessionAndOrigin=true', () => { // cy.getCookie('bar1').its('value').should('equal', 'baz1') cy.window().then((win) => { - return cy.wrap(makeRequest(win, `${scheme}://www.barbaz.com:${sameOriginPort}/test-credentials`, 'fetch', 'include')) + return cy.wrap(makeRequest(win, `${scheme}://www.barbaz.com:${sameOriginPort}/test-request-credentials`, 'fetch', 'include')) }) cy.wait('@cookieCheck') @@ -1180,7 +1180,7 @@ describe('Cookie Behavior with experimentalSessionAndOrigin=true', () => { }) it('does set cookie if withCredentials is true, and sends cookie if withCredentials is true', () => { - cy.intercept(`${scheme}://www.barbaz.com:${sameOriginPort}/test-credentials`, (req) => { + cy.intercept(`${scheme}://www.barbaz.com:${sameOriginPort}/test-request-credentials`, (req) => { expect(req['headers']['cookie']).to.equal('bar1=baz1') req.reply({ @@ -1201,7 +1201,7 @@ describe('Cookie Behavior with experimentalSessionAndOrigin=true', () => { // cy.getCookie('bar1').its('value').should('equal', 'baz1') cy.window().then((win) => { - return cy.wrap(makeRequest(win, `${scheme}://www.barbaz.com:${sameOriginPort}/test-credentials`, 'xmlHttpRequest', true)) + return cy.wrap(makeRequest(win, `${scheme}://www.barbaz.com:${sameOriginPort}/test-request-credentials`, 'xmlHttpRequest', true)) }) cy.wait('@cookieCheck') @@ -1280,7 +1280,7 @@ describe('Cookie Behavior with experimentalSessionAndOrigin=true', () => { // can only set third-party SameSite=None with Secure attribute, which is only possibly over https if (scheme === 'https') { it('does set cookie if credentials is "include", and sends cookie if credentials is "include"', () => { - cy.intercept(`${scheme}://www.barbaz.com:${sameOriginPort}/test-credentials`, (req) => { + cy.intercept(`${scheme}://www.barbaz.com:${sameOriginPort}/test-request-credentials`, (req) => { expect(req['headers']['cookie']).to.equal('bar1=baz1') req.reply({ @@ -1303,7 +1303,7 @@ describe('Cookie Behavior with experimentalSessionAndOrigin=true', () => { // cy.getCookie('bar1').its('value').should('equal', 'baz1') cy.window().then((win) => { - return cy.wrap(makeRequest(win, `${scheme}://www.barbaz.com:${sameOriginPort}/test-credentials`, 'fetch', 'include')) + return cy.wrap(makeRequest(win, `${scheme}://www.barbaz.com:${sameOriginPort}/test-request-credentials`, 'fetch', 'include')) }) cy.wait('@cookieCheck') diff --git a/packages/driver/cypress/e2e/e2e/origin/cookie_login.cy.ts b/packages/driver/cypress/e2e/e2e/origin/cookie_login.cy.ts index 6903cdfc0aa0..7c46c59cc516 100644 --- a/packages/driver/cypress/e2e/e2e/origin/cookie_login.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/cookie_login.cy.ts @@ -12,14 +12,15 @@ describe('cy.origin - cookie login', () => { } const verifyIdpNotLoggedIn = (config = {}) => { - const { isHttps, cookieKey, expectNullCookie } = _.defaults(config, { + const { isHttps, cookieKey, expectNullCookie, subdomain } = _.defaults(config, { isHttps: false, cookieKey: 'user', expectNullCookie: true, + subdomain: 'www', }) const [protocol, port] = isHttps ? ['https', '3502'] : ['http', '3501'] - cy.origin(`${protocol}://idp.com:${port}`, { args: { cookieKey, expectNullCookie } }, ({ cookieKey, expectNullCookie }) => { + cy.origin(`${protocol}://${subdomain}.idp.com:${port}`, { args: { cookieKey, expectNullCookie } }, ({ cookieKey, expectNullCookie }) => { cy.get('h1') .invoke('text') .should('equal', 'Not logged in') @@ -81,7 +82,7 @@ describe('cy.origin - cookie login', () => { cy.session(username, () => { cy.visit('/fixtures/primary-origin.html') cy.get('[data-cy="cookie-login"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="login"]').click() }) @@ -104,7 +105,7 @@ describe('cy.origin - cookie login', () => { cy.visit('/fixtures/primary-origin.html') cy.get('[data-cy="cookie-login-alias"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="login"]').click() }) @@ -115,7 +116,7 @@ describe('cy.origin - cookie login', () => { it('handles browser-sent cookies being overridden by server-kept cookies', () => { cy.visit('https://localhost:3502/fixtures/primary-origin.html') cy.get('[data-cy="cookie-login-override"]').click() - cy.origin('https://foobar.com:3502', { args: { username } }, ({ username }) => { + cy.origin('https://www.foobar.com:3502', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="login"]').click() }) @@ -126,7 +127,7 @@ describe('cy.origin - cookie login', () => { it('cy.clearCookie() -> not logged in', () => { cy.visit('/fixtures/primary-origin.html') cy.get('[data-cy="cookie-login"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="login"]').click() }) @@ -139,7 +140,7 @@ describe('cy.origin - cookie login', () => { it('cy.clearCookies() -> not logged in', () => { cy.visit('/fixtures/primary-origin.html') cy.get('[data-cy="cookie-login"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="login"]').click() }) @@ -161,7 +162,7 @@ describe('cy.origin - cookie login', () => { }) it('no SameSite (defaults to Lax) -> logged in', () => { - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="login"]').click() }) @@ -170,7 +171,7 @@ describe('cy.origin - cookie login', () => { }) it('SameSite=Lax -> logged in', () => { - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieProps"]').type('SameSite=Lax') cy.get('[data-cy="login"]').click() @@ -180,7 +181,7 @@ describe('cy.origin - cookie login', () => { }) it('SameSite=Strict -> not logged in', () => { - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieProps"]').type('SameSite=Strict') cy.get('[data-cy="login"]').click() @@ -193,7 +194,7 @@ describe('cy.origin - cookie login', () => { // FIXME: Currently in Firefox, the default cookie setting in the extension is no_restriction, which can be set with Secure=false. it('SameSite=None -> not logged in', { browser: '!firefox' }, () => { - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieProps"]').type('SameSite=None') cy.get('[data-cy="login"]').click() @@ -204,7 +205,7 @@ describe('cy.origin - cookie login', () => { }) it('invalid SameSite (defaults to Lax) -> logged in', () => { - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieProps"]').type('SameSite=Invalid') cy.get('[data-cy="login"]').click() @@ -225,7 +226,7 @@ describe('cy.origin - cookie login', () => { cy.visit('https://localhost:3502/fixtures/primary-origin.html') cy.get('[data-cy="cookie-login-https"]').click() - cy.origin('https://foobar.com:3502', { args: { username } }, ({ username }) => { + cy.origin('https://www.foobar.com:3502', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieProps"]').type('Secure') cy.get('[data-cy="login"]').click() @@ -238,7 +239,7 @@ describe('cy.origin - cookie login', () => { cy.visit('/fixtures/primary-origin.html') cy.get('[data-cy="cookie-login"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieProps"]').type('Secure') cy.get('[data-cy="login"]').click() @@ -253,7 +254,7 @@ describe('cy.origin - cookie login', () => { cy.visit('https://localhost:3502/fixtures/primary-origin.html') cy.get('[data-cy="cookie-login-https"]').click() - cy.origin('https://foobar.com:3502', { args: { username } }, ({ username }) => { + cy.origin('https://www.foobar.com:3502', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="login"]').click() }) @@ -265,7 +266,7 @@ describe('cy.origin - cookie login', () => { cy.visit('/fixtures/primary-origin.html') cy.get('[data-cy="cookie-login"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="login"]').click() }) @@ -286,7 +287,7 @@ describe('cy.origin - cookie login', () => { it('no Domain + superdomain -> logged in', () => { cy.get('[data-cy="cookie-login"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="login"]').click() }) @@ -297,7 +298,7 @@ describe('cy.origin - cookie login', () => { it('no Domain + subdomain -> logged in', () => { cy.get('[data-cy="cookie-login-subdomain"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="login"]').click() }) @@ -308,7 +309,7 @@ describe('cy.origin - cookie login', () => { it('Domain + superdomain -> logged in', () => { cy.get('[data-cy="cookie-login"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieProps"]').type('Domain=idp.com') cy.get('[data-cy="localhostCookieProps"]').type('Domain=localhost') @@ -321,7 +322,7 @@ describe('cy.origin - cookie login', () => { it('Domain + subdomain -> logged in', () => { cy.get('[data-cy="cookie-login-subdomain"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieProps"]').type('Domain=idp.com') cy.get('[data-cy="localhostCookieProps"]').type('Domain=localhost') @@ -334,7 +335,7 @@ describe('cy.origin - cookie login', () => { it('subdomain Domain + superdomain -> not logged in', () => { cy.get('[data-cy="cookie-login"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieProps"]').type('Domain=baz.idp.com') cy.get('[data-cy="localhostCookieProps"]').type('Domain=localhost') @@ -348,7 +349,7 @@ describe('cy.origin - cookie login', () => { it('subdomain Domain + subdomain -> logged in', () => { cy.get('[data-cy="cookie-login-subdomain"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieProps"]').type('Domain=baz.idp.com') cy.get('[data-cy="localhostCookieProps"]').type('Domain=localhost') @@ -361,14 +362,16 @@ describe('cy.origin - cookie login', () => { it('subdomain Domain + different subdomain -> not logged in', () => { cy.get('[data-cy="cookie-login-subdomain"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieProps"]').type('Domain=qux.foobar.com') cy.get('[data-cy="login"]').click() }) // Domain=subdomain requires request to be on that subdomain - verifyIdpNotLoggedIn() + verifyIdpNotLoggedIn({ + 'subdomain': 'baz', + }) }) }) @@ -384,7 +387,7 @@ describe('cy.origin - cookie login', () => { it('path matches -> logged in', () => { cy.get('[data-cy="cookie-login"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieProps"]').type('Path=/verify-cookie-login') cy.get('[data-cy="localhostCookieProps"]').type('Path=/welcome') @@ -397,7 +400,7 @@ describe('cy.origin - cookie login', () => { it('path does not match -> not logged in', () => { cy.get('[data-cy="cookie-login"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieProps"]').type('Path=/nope') cy.get('[data-cy="login"]').click() @@ -420,7 +423,7 @@ describe('cy.origin - cookie login', () => { it('expired -> not logged in', () => { cy.get('[data-cy="cookie-login"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { const expires = (new Date()).toUTCString() cy.get('[data-cy="username"]').type(username) @@ -433,7 +436,7 @@ describe('cy.origin - cookie login', () => { it('expired -> not accessible via cy.getCookie()', () => { cy.get('[data-cy="cookie-login"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { const expires = (new Date()).toUTCString() cy.get('[data-cy="username"]').type(username) @@ -446,7 +449,7 @@ describe('cy.origin - cookie login', () => { it('expired -> not accessible via document.cookie', () => { cy.get('[data-cy="cookie-login-land-on-idp"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { const expires = (new Date()).toUTCString() cy.get('[data-cy="username"]').type(username) @@ -472,7 +475,7 @@ describe('cy.origin - cookie login', () => { it('past max-age -> not logged in', () => { cy.get('[data-cy="cookie-login"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="localhostCookieProps"]').type('Max-Age=1') cy.get('[data-cy="login"]').click() @@ -488,7 +491,7 @@ describe('cy.origin - cookie login', () => { // as it happens even using cy.setCookie() it('past max-age -> not accessible via cy.getCookie()', { browser: '!firefox' }, () => { cy.get('[data-cy="cookie-login"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="localhostCookieProps"]').type('Max-Age=1') cy.get('[data-cy="login"]').click() @@ -501,7 +504,7 @@ describe('cy.origin - cookie login', () => { it('past max-age -> not accessible via document.cookie', () => { cy.get('[data-cy="cookie-login-land-on-idp"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="localhostCookieProps"]').type('Max-Age=1') cy.get('[data-cy="login"]').click() @@ -522,7 +525,7 @@ describe('cy.origin - cookie login', () => { it('past Max-Age, before Expires -> not logged in', () => { const expires = dayjs().add(1, 'day').toDate().toUTCString() - cy.origin('http://foobar.com:3500', { args: { username, expires } }, ({ username, expires }) => { + cy.origin('http://www.foobar.com:3500', { args: { username, expires } }, ({ username, expires }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="localhostCookieProps"]').type(`Max-Age=1; Expires=${expires}`) cy.get('[data-cy="login"]').click() @@ -534,7 +537,7 @@ describe('cy.origin - cookie login', () => { }) it('before Max-Age, past Expires -> logged in', () => { - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { const expires = (new Date()).toUTCString() cy.get('[data-cy="username"]').type(username) @@ -560,7 +563,7 @@ describe('cy.origin - cookie login', () => { }) it('__Host- + Secure + Path=/ -> logged in', () => { - cy.origin('https://foobar.com:3502', { args: { username } }, ({ username }) => { + cy.origin('https://www.foobar.com:3502', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieKey"]').clear().type('__Host-user') cy.get('[data-cy="cookieProps"]').type('Secure; Path=/') @@ -571,7 +574,7 @@ describe('cy.origin - cookie login', () => { }) it('__Host-, no Secure -> not logged in', () => { - cy.origin('https://foobar.com:3502', { args: { username } }, ({ username }) => { + cy.origin('https://www.foobar.com:3502', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieKey"]').clear().type('__Host-user') cy.get('[data-cy="cookieProps"]').type('Path=/') @@ -583,7 +586,7 @@ describe('cy.origin - cookie login', () => { }) it('__Host-, no Path -> logged in', () => { - cy.origin('https://foobar.com:3502', { args: { username } }, ({ username }) => { + cy.origin('https://www.foobar.com:3502', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieKey"]').clear().type('__Host-user') cy.get('[data-cy="cookieProps"]').type('Secure') @@ -594,7 +597,7 @@ describe('cy.origin - cookie login', () => { }) it('__Host-, disallowed Path -> not logged in', () => { - cy.origin('https://foobar.com:3502', { args: { username } }, ({ username }) => { + cy.origin('https://www.foobar.com:3502', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieKey"]').clear().type('__Host-user') cy.get('[data-cy="cookieProps"]').type('Secure; Path=/nope') @@ -606,7 +609,7 @@ describe('cy.origin - cookie login', () => { }) it('__Host- + Domain -> not logged in', () => { - cy.origin('https://foobar.com:3502', { args: { username } }, ({ username }) => { + cy.origin('https://www.foobar.com:3502', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieKey"]').clear().type('__Host-user') cy.get('[data-cy="cookieProps"]').type('Secure; Path=/; Domain=foobar.com') @@ -629,7 +632,7 @@ describe('cy.origin - cookie login', () => { }) it('__Secure- + Secure flag -> logged in', () => { - cy.origin('https://foobar.com:3502', { args: { username } }, ({ username }) => { + cy.origin('https://www.foobar.com:3502', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieKey"]').clear().type('__Secure-user') cy.get('[data-cy="cookieProps"]').type('Secure') @@ -640,7 +643,7 @@ describe('cy.origin - cookie login', () => { }) it('__Secure, no Secure flag -> not logged in', () => { - cy.origin('https://foobar.com:3502', { args: { username } }, ({ username }) => { + cy.origin('https://www.foobar.com:3502', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="cookieKey"]').clear().type('__Secure-user') cy.get('[data-cy="login"]').click() @@ -662,7 +665,7 @@ describe('cy.origin - cookie login', () => { it('gets cookie set by http request', () => { cy.get('[data-cy="cookie-login-land-on-idp"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="login"]').click() }) @@ -674,7 +677,7 @@ describe('cy.origin - cookie login', () => { it('works when setting cookie', () => { cy.get('[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.document().then((doc) => { doc.cookie = 'key=value' }) @@ -685,7 +688,7 @@ describe('cy.origin - cookie login', () => { it('works when setting cookie with extra, benign parts', () => { cy.get('[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.document().then((doc) => { doc.cookie = 'key=value; wont=beset' }) @@ -696,7 +699,7 @@ describe('cy.origin - cookie login', () => { it('cookie properties are preserved when set via automation', () => { cy.get('[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.document().then((doc) => { doc.cookie = 'key=value; SameSite=Strict; Path=/foo' }) @@ -719,7 +722,7 @@ describe('cy.origin - cookie login', () => { it('does not set cookie when invalid', () => { cy.get('[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.document().then((doc) => { doc.cookie = '=value' }) @@ -730,7 +733,7 @@ describe('cy.origin - cookie login', () => { it('works when setting subsequent cookies', () => { cy.get('[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.document().then((doc) => { doc.cookie = 'key1=value1' }) @@ -746,7 +749,7 @@ describe('cy.origin - cookie login', () => { it('makes cookie available to cy.getCookie()', () => { cy.get('[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.document().then((doc) => { doc.cookie = 'key=value' }) @@ -757,7 +760,7 @@ describe('cy.origin - cookie login', () => { it('no longer returns cookie after cy.clearCookie()', () => { cy.get('[data-cy="cookie-login-land-on-idp"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="login"]').click() }) @@ -770,7 +773,7 @@ describe('cy.origin - cookie login', () => { it('no longer returns cookie after cy.clearCookies()', () => { cy.get('[data-cy="cookie-login-land-on-idp"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="login"]').click() }) @@ -783,7 +786,7 @@ describe('cy.origin - cookie login', () => { it('works when setting cookie in addition to cookie that already exists from http request', () => { cy.get('[data-cy="cookie-login-land-on-idp"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.get('[data-cy="username"]').type(username) cy.get('[data-cy="login"]').click() }) @@ -801,13 +804,13 @@ describe('cy.origin - cookie login', () => { }) it('sets and reads document.cookie prior to attaching', () => { - cy.origin('http://foobar.com:3500', () => {}).then(() => { + cy.origin('http://www.foobar.com:3500', () => {}).then(() => { // Force remove the spec bridge - window?.top?.document.getElementById('Spec Bridge: http://foobar.com:3500')?.remove() + window?.top?.document.getElementById('Spec Bridge: http://www.foobar.com:3500')?.remove() }) cy.get('[data-cy="document-cookie"]').click() - cy.origin('http://foobar.com:3500', { args: { username } }, ({ username }) => { + cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => { cy.document().its('cookie').should('include', 'name=value') cy.get('[data-cy="doc-cookie"]').invoke('text').should('equal', 'name=value') cy.getCookie('name').then((cookie) => { diff --git a/packages/driver/cypress/e2e/e2e/origin/cypress_api.cy.ts b/packages/driver/cypress/e2e/e2e/origin/cypress_api.cy.ts index 361828c7cb50..2885165f439f 100644 --- a/packages/driver/cypress/e2e/e2e/origin/cypress_api.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/cypress_api.cy.ts @@ -8,7 +8,7 @@ describe('cy.origin Cypress API', () => { context('Commands', () => { it('adds a custom command', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { // @ts-ignore Cypress.Commands.add('foo', () => 'bar') @@ -17,14 +17,14 @@ describe('cy.origin Cypress API', () => { }) // persists added command through spec bridge - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { // @ts-ignore cy.foo().should('equal', 'bar') }) }) it('overwrites an existing command in the spec bridge', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { // @ts-ignore Cypress.Commands.overwrite('foo', () => 'baz') @@ -33,7 +33,7 @@ describe('cy.origin Cypress API', () => { }) // persists overwritten command through spec bridge - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { // @ts-ignore cy.foo().should('equal', 'baz') }) @@ -46,7 +46,7 @@ describe('cy.origin Cypress API', () => { keystrokeDelay: 30, }) - cy.origin('http://foobar.com:3500', { args: defaults }, (primaryKeyboardDefaults) => { + cy.origin('http://www.foobar.com:3500', { args: defaults }, (primaryKeyboardDefaults) => { const crossOriginKeyboardDefaults = Cypress.Keyboard.defaults({}) expect(crossOriginKeyboardDefaults).to.not.deep.equal(primaryKeyboardDefaults) @@ -54,7 +54,7 @@ describe('cy.origin Cypress API', () => { }) it('allows a user to configure defaults', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const crossOriginKeyboardDefaults = Cypress.Keyboard.defaults({ keystrokeDelay: 60, }) @@ -65,7 +65,7 @@ describe('cy.origin Cypress API', () => { }) // persists default configuration changes through spec bridge - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const crossOriginKeyboardDefaults = Cypress.Keyboard.defaults({}) expect(crossOriginKeyboardDefaults).to.deep.include({ @@ -84,7 +84,7 @@ describe('cy.origin Cypress API', () => { onAfterScreenshot: () => undefined, }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const crossOriginScreenshotDefaults = Cypress.Screenshot.defaults({}) expect(crossOriginScreenshotDefaults).to.not.deep.include({ @@ -97,7 +97,7 @@ describe('cy.origin Cypress API', () => { }) it('allows a user to configure defaults', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const crossOriginScreenshotDefaults = Cypress.Screenshot.defaults({ blackout: ['foo'], overwrite: true, @@ -110,7 +110,7 @@ describe('cy.origin Cypress API', () => { }) // persists default configuration changes through spec bridge - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const crossOriginScreenshotDefaults = Cypress.Screenshot.defaults({}) expect(crossOriginScreenshotDefaults).to.deep.include({ @@ -123,7 +123,7 @@ describe('cy.origin Cypress API', () => { context('dom', () => { it('provides a sanity check that the dom API exists on Cypress.*', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('[data-cy="dom-check"]').then(($el) => { expect(Cypress.dom.isAttached($el)).to.be.true }) @@ -133,37 +133,37 @@ describe('cy.origin Cypress API', () => { context('properties', () => { it('has arch property synced from primary', () => { - cy.origin('http://foobar.com:3500', { args: Cypress.arch }, (theArch) => { + cy.origin('http://www.foobar.com:3500', { args: Cypress.arch }, (theArch) => { expect(Cypress.arch).to.equal(theArch) }) }) it('has browser property synced from primary', () => { - cy.origin('http://foobar.com:3500', { args: Cypress.browser }, (theBrowser) => { + cy.origin('http://www.foobar.com:3500', { args: Cypress.browser }, (theBrowser) => { expect(Cypress.browser).to.deep.equal(theBrowser) }) }) it('has currentTest property synced from primary', () => { - cy.origin('http://foobar.com:3500', { args: Cypress.currentTest }, (theCurrentTest) => { + cy.origin('http://www.foobar.com:3500', { args: Cypress.currentTest }, (theCurrentTest) => { expect(Cypress.currentTest).to.deep.equal(theCurrentTest) }) }) it('has platform property synced from primary', () => { - cy.origin('http://foobar.com:3500', { args: Cypress.platform }, (thePlatform) => { + cy.origin('http://www.foobar.com:3500', { args: Cypress.platform }, (thePlatform) => { expect(Cypress.platform).to.equal(thePlatform) }) }) it('has testingType property synced from primary', () => { - cy.origin('http://foobar.com:3500', { args: Cypress.testingType }, (theTestingType) => { + cy.origin('http://www.foobar.com:3500', { args: Cypress.testingType }, (theTestingType) => { expect(Cypress.testingType).to.deep.equal(theTestingType) }) }) it('has spec property synced from primary', () => { - cy.origin('http://foobar.com:3500', { args: Cypress.spec }, (theSpec) => { + cy.origin('http://www.foobar.com:3500', { args: Cypress.spec }, (theSpec) => { expect(Cypress.spec).to.deep.equal(theSpec) }) }) @@ -171,13 +171,13 @@ describe('cy.origin Cypress API', () => { context('methods', () => { it('isCy()', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { expect(Cypress.isCy(cy)).to.be.true }) }) it('isBrowser()', () => { - cy.origin('http://foobar.com:3500', { args: Cypress.browser }, (theBrowser) => { + cy.origin('http://www.foobar.com:3500', { args: Cypress.browser }, (theBrowser) => { expect(Cypress.isBrowser(theBrowser.name)).to.equal(true) }) }) @@ -189,7 +189,7 @@ describe('cy.origin Cypress API', () => { logs.push(log) }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { Cypress.log({ name: 'log', message: 'test log', @@ -211,7 +211,7 @@ describe('cy.origin Cypress API', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { Cypress.Server.defaults({}) }) }) @@ -223,7 +223,7 @@ describe('cy.origin Cypress API', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { Cypress.Cookies.preserveOnce('') }) }) @@ -235,7 +235,7 @@ describe('cy.origin Cypress API', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { Cypress.session.clearAllSavedSessions() }) }) diff --git a/packages/driver/cypress/e2e/e2e/origin/events.cy.ts b/packages/driver/cypress/e2e/e2e/origin/events.cy.ts index d8e44d89275e..4889eb7ea7ea 100644 --- a/packages/driver/cypress/e2e/e2e/origin/events.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/events.cy.ts @@ -8,14 +8,14 @@ describe('cy.origin', () => { cy.window().its('testPrimaryOriginBeforeLoad').should('be.true') // Needs to be declared before the visit - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.on('window:before:load', (win: {testSecondaryWindowBeforeLoad: boolean}) => { win.testSecondaryWindowBeforeLoad = true }) }) cy.get('a[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.window().its('testSecondaryWindowBeforeLoad').should('be.true') cy.window().its('testPrimaryOriginBeforeLoad').should('be.undefined') cy @@ -37,7 +37,7 @@ describe('cy.origin', () => { }) it('form:submitted', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const afterFormSubmitted = new Promise((resolve) => { Cypress.once('form:submitted', (e) => { const $form = cy.$$('form') @@ -56,7 +56,7 @@ describe('cy.origin', () => { cy.origin('http://www.foobar.com:3500', () => { const afterWindowBeforeUnload = new Promise((resolve) => { Cypress.once('window:before:unload', () => { - expect(location.host).to.equal('foobar.com:3500') + expect(location.host).to.equal('www.foobar.com:3500') resolve() }) }) @@ -71,7 +71,7 @@ describe('cy.origin', () => { cy.origin('http://www.foobar.com:3500', () => { const afterWindowUnload = new Promise((resolve) => { Cypress.once('window:unload', () => { - expect(location.host).to.equal('foobar.com:3500') + expect(location.host).to.equal('www.foobar.com:3500') resolve() }) }) @@ -83,10 +83,10 @@ describe('cy.origin', () => { }) it('window:alert', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const afterWindowAlert = new Promise((resolve) => { Cypress.once('window:alert', (text) => { - expect(location.host).to.equal('foobar.com:3500') + expect(location.host).to.equal('www.foobar.com:3500') expect(`window:alert ${text}`).to.equal('window:alert the alert text') resolve() }) @@ -98,10 +98,10 @@ describe('cy.origin', () => { }) it('window:confirm', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const afterWindowConfirm = new Promise((resolve) => { Cypress.once('window:confirm', (text) => { - expect(location.host).to.equal('foobar.com:3500') + expect(location.host).to.equal('www.foobar.com:3500') expect(`window:confirm ${text}`).to.equal('window:confirm the confirm text') resolve() }) @@ -113,10 +113,10 @@ describe('cy.origin', () => { }) it('window:confirmed - true when no window:confirm listeners return false', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const afterWindowConfirmed = new Promise((resolve) => { Cypress.once('window:confirmed', (text, returnedFalse) => { - expect(location.host).to.equal('foobar.com:3500') + expect(location.host).to.equal('www.foobar.com:3500') expect(`window:confirmed ${text} - ${returnedFalse}`).to.equal('window:confirmed the confirm text - true') resolve() }) @@ -133,10 +133,10 @@ describe('cy.origin', () => { }) it('window:confirmed - false when any window:confirm listeners return false', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const afterWindowConfirmed = new Promise((resolve) => { Cypress.once('window:confirmed', (text, returnedFalse) => { - expect(location.host).to.equal('foobar.com:3500') + expect(location.host).to.equal('www.foobar.com:3500') expect(`window:confirmed ${text} - ${returnedFalse}`).to.equal('window:confirmed the confirm text - false') resolve() }) diff --git a/packages/driver/cypress/e2e/e2e/origin/integrity.cy.ts b/packages/driver/cypress/e2e/e2e/origin/integrity.cy.ts index 69fe86d8e31b..bb1f048eefe5 100644 --- a/packages/driver/cypress/e2e/e2e/origin/integrity.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/integrity.cy.ts @@ -62,7 +62,7 @@ describe('Integrity Preservation', () => { cy.visit('fixtures/primary-origin.html') cy.get('[data-cy="integrity-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { // The added script, if integrity matches, should execute and // add a

element with 'integrity script loaded' as the text cy.get('#integrity', { @@ -85,7 +85,7 @@ describe('Integrity Preservation', () => { cy.visit('fixtures/primary-origin.html') cy.get('[data-cy="integrity-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { // The added script, if integrity matches, should execute and // add a

element with 'integrity script loaded' as the text cy.get('#integrity', { @@ -112,7 +112,7 @@ describe('Integrity Preservation', () => { cy.visit('fixtures/primary-origin.html') cy.get('[data-cy="integrity-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('[data-cy="integrity-header"]', { timeout: 1000, }).then((integrityHeader) => { @@ -137,7 +137,7 @@ describe('Integrity Preservation', () => { cy.visit('fixtures/primary-origin.html') cy.get('[data-cy="integrity-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('[data-cy="integrity-header"]', { timeout: 1000, }).then((integrityHeader) => { diff --git a/packages/driver/cypress/e2e/e2e/origin/logging.cy.ts b/packages/driver/cypress/e2e/e2e/origin/logging.cy.ts index 0f7ece507a0f..7e0214dd563f 100644 --- a/packages/driver/cypress/e2e/e2e/origin/logging.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/logging.cy.ts @@ -11,7 +11,7 @@ describe('cy.origin logging', () => { cy.visit('/fixtures/primary-origin.html') cy.get('a[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('[data-cy="dom-check"]').invoke('text') }) @@ -70,7 +70,7 @@ describe('cy.origin logging', () => { const options = { args: { div: Cypress.$('div') } } - cy.origin('http://foobar.com:3500', options, () => {}) + cy.origin('http://www.foobar.com:3500', options, () => {}) }) it('groups callback commands when failing with inner command failure', (done) => { @@ -99,7 +99,7 @@ describe('cy.origin logging', () => { cy.visit('/fixtures/primary-origin.html') cy.get('a[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('[data-cy="dom-check"]').invoke('text') cy.get('#does-not-exist', { timeout: 1 }) }) @@ -131,7 +131,7 @@ describe('cy.origin logging', () => { cy.visit('/fixtures/primary-origin.html') cy.get('a[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('[data-cy="dom-check"]').invoke('text').then(() => { setTimeout(() => { throw new Error('async error') diff --git a/packages/driver/cypress/e2e/e2e/origin/origin.cy.ts b/packages/driver/cypress/e2e/e2e/origin/origin.cy.ts index d9e79698ae3a..aa696056f255 100644 --- a/packages/driver/cypress/e2e/e2e/origin/origin.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/origin.cy.ts @@ -11,7 +11,7 @@ describe('cy.origin', () => { cy.visit('/fixtures/primary-origin.html') cy.get('a[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', { args: expectedViewport }, (expectedViewport) => { + cy.origin('http://www.foobar.com:3500', { args: expectedViewport }, (expectedViewport) => { const secondaryViewport = [cy.state('viewportWidth'), cy.state('viewportHeight')] expect(secondaryViewport).to.deep.equal(expectedViewport) @@ -22,7 +22,7 @@ describe('cy.origin', () => { it('executes quickly', () => { cy.visit('/fixtures/primary-origin.html') cy.get('a[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { expect(true).to.equal(true) }) }) @@ -50,7 +50,7 @@ describe('cy.origin', () => { expect(err.message).to.include(`\`cy.visit()\` was called to visit a cross origin site with an \`onLoad\` callback. \`onLoad\` callbacks can only be used with same origin sites. If you wish to specify an \`onLoad\` callback please use the \`cy.origin\` command to setup a \`window:load\` event prior to visiting the cross origin site.`) - expect(err.message).to.include(`\`cy.origin('http://idp.com:3500', () => {\``) + expect(err.message).to.include(`\`cy.origin('http://www.idp.com:3500', () => {\``) expect(err.message).to.include(`\` cy.on('window:load', () => {\``) expect(err.message).to.include(` \` \``) expect(err.message).to.include(` \`cy.visit('http://www.idp.com:3500/fixtures/auth/index.html')\``) @@ -71,7 +71,7 @@ describe('cy.origin', () => { expect(err.message).to.include(`\`cy.visit()\` was called to visit a cross origin site with an \`onBeforeLoad\` callback. \`onBeforeLoad\` callbacks can only be used with same origin sites. If you wish to specify an \`onBeforeLoad\` callback please use the \`cy.origin\` command to setup a \`window:before:load\` event prior to visiting the cross origin site.`) - expect(err.message).to.include(`\`cy.origin('http://idp.com:3500', () => {\``) + expect(err.message).to.include(`\`cy.origin('http://www.idp.com:3500', () => {\``) expect(err.message).to.include(`\` cy.on('window:before:load', () => {\``) expect(err.message).to.include(` \` \``) expect(err.message).to.include(` \`cy.visit('http://www.idp.com:3500/fixtures/auth/index.html')\``) @@ -95,7 +95,7 @@ describe('cy.origin', () => { }) it('runs commands in secondary origin', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy .get('[data-cy="dom-check"]') .invoke('text') @@ -141,7 +141,7 @@ describe('cy.origin', () => { ctx: {}, } - cy.origin('http://foobar.com:3500', { args: expectedRunnable }, (expectedRunnable) => { + cy.origin('http://www.foobar.com:3500', { args: expectedRunnable }, (expectedRunnable) => { const actualRunnable = cy.state('runnable') expect(actualRunnable.titlePath()).to.deep.equal(expectedRunnable.titlePath) @@ -160,7 +160,7 @@ describe('cy.origin', () => { }) it('handles querying nested elements', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy .get('form button') .invoke('text') @@ -171,7 +171,7 @@ describe('cy.origin', () => { }) it('sets up window.Cypress in secondary origin', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy .get('[data-cy="cypress-check"]') .invoke('text') @@ -181,39 +181,39 @@ describe('cy.origin', () => { describe('data argument', () => { it('passes object to callback function', () => { - cy.origin('http://foobar.com:3500', { args: { foo: 'foo', bar: 'bar' } }, ({ foo, bar }) => { + cy.origin('http://www.foobar.com:3500', { args: { foo: 'foo', bar: 'bar' } }, ({ foo, bar }) => { expect(foo).to.equal('foo') expect(bar).to.equal('bar') }) }) it('passes array to callback function', () => { - cy.origin('http://foobar.com:3500', { args: ['foo', 'bar'] }, ([foo, bar]) => { + cy.origin('http://www.foobar.com:3500', { args: ['foo', 'bar'] }, ([foo, bar]) => { expect(foo).to.equal('foo') expect(bar).to.equal('bar') }) }) it('passes string to callback function', () => { - cy.origin('http://foobar.com:3500', { args: 'foo' }, (foo) => { + cy.origin('http://www.foobar.com:3500', { args: 'foo' }, (foo) => { expect(foo).to.equal('foo') }) }) it('passes number to callback function', () => { - cy.origin('http://foobar.com:3500', { args: 1 }, (num) => { + cy.origin('http://www.foobar.com:3500', { args: 1 }, (num) => { expect(num).to.equal(1) }) }) it('passes boolean to callback function', () => { - cy.origin('http://foobar.com:3500', { args: true }, (bool) => { + cy.origin('http://www.foobar.com:3500', { args: true }, (bool) => { expect(bool).to.be.true }) }) it('passes mixed types to callback function', () => { - cy.origin('http://foobar.com:3500', { args: { foo: 'foo', num: 1, bool: true } }, ({ foo, num, bool }) => { + cy.origin('http://www.foobar.com:3500', { args: { foo: 'foo', num: 1, bool: true } }, ({ foo, num, bool }) => { expect(foo).to.equal('foo') expect(num).to.equal(1) expect(bool).to.be.true @@ -237,7 +237,7 @@ describe('cy.origin', () => { const variable = 'string' - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.log(variable) }) }) @@ -248,7 +248,7 @@ describe('cy.origin', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { throw 'oops' }) }) @@ -260,7 +260,7 @@ describe('cy.origin', () => { resolve(undefined) }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { throw 'oops' }) }) @@ -277,7 +277,7 @@ describe('cy.origin', () => { done() }) - cy.origin('http://foobar.com:3500', { args: timeout }, (timeout) => { + cy.origin('http://www.foobar.com:3500', { args: timeout }, (timeout) => { cy.get('#doesnt-exist', { timeout, }) @@ -293,7 +293,7 @@ describe('cy.origin', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('#doesnt-exist') }) }) @@ -313,7 +313,7 @@ describe('cy.origin', () => { const variable = () => {} - cy.origin('http://foobar.com:3500', { args: variable }, (variable) => { + cy.origin('http://www.foobar.com:3500', { args: variable }, (variable) => { variable() }) }) diff --git a/packages/driver/cypress/e2e/e2e/origin/rerun.cy.ts b/packages/driver/cypress/e2e/e2e/origin/rerun.cy.ts index de020668585a..75a0e5e2bdd8 100644 --- a/packages/driver/cypress/e2e/e2e/origin/rerun.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/rerun.cy.ts @@ -7,7 +7,7 @@ describe('cy.origin - rerun', { }, () => { it('successfully reruns tests', () => { // @ts-ignore - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('[data-cy="dom-check"]') }) .then(() => { diff --git a/packages/driver/cypress/e2e/e2e/origin/snapshots.cy.ts b/packages/driver/cypress/e2e/e2e/origin/snapshots.cy.ts index a9dd06757337..957fc57b0d3d 100644 --- a/packages/driver/cypress/e2e/e2e/origin/snapshots.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/snapshots.cy.ts @@ -28,11 +28,11 @@ describe('cy.origin - snapshots', () => { // TODO: the xhr event is showing up twice in the log, which is wrong and causing flake. skipping until: https://github.com/cypress-io/cypress/issues/23840 is addressed. it.skip('verifies XHR requests made while a secondary origin is active eventually update with snapshots of the secondary origin', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { // need to set isInteractive in the spec bridge in order to take xhr snapshots in run mode, similar to how isInteractive is set within support/defaults.js // @ts-ignore Cypress.config('isInteractive', true) - cy.visit('http://www.foobar.com:3500/fixtures/xhr-fetch-onload.html') + cy.visit('http://www.foobar.com:3500/fixtures/xhr-fetch-requests.html') cy.get(`[data-cy="assertion-header"]`).should('exist') cy.wait('@fooBarBaz') }) @@ -54,11 +54,11 @@ describe('cy.origin - snapshots', () => { // TODO: fix flaky test https://github.com/cypress-io/cypress/issues/23437 it.skip('verifies fetch requests made while a secondary origin is active eventually update with snapshots of the secondary origin', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { // need to set isInteractive in the spec bridge in order to take xhr snapshots in run mode, similar to how isInteractive is set within support/defaults.js // @ts-ignore Cypress.config('isInteractive', true) - cy.visit('http://www.foobar.com:3500/fixtures/xhr-fetch-onload.html') + cy.visit('http://www.foobar.com:3500/fixtures/xhr-fetch-requests.html') cy.get(`[data-cy="assertion-header"]`).should('exist') cy.wait('@fooBarBaz') }) @@ -94,9 +94,9 @@ describe('cy.origin - snapshots', () => { done() }) - cy.visit('http://www.foobar.com:3500/fixtures/xhr-fetch-onload.html') + cy.visit('http://www.foobar.com:3500/fixtures/xhr-fetch-requests.html') - cy.origin('http://barbaz.com:3500', () => { + cy.origin('http://www.barbaz.com:3500', () => { // need to set isInteractive in the spec bridge in order to take xhr snapshots in run mode, similar to how isInteractive is set within support/defaults.js // @ts-ignore Cypress.config('isInteractive', true) diff --git a/packages/driver/cypress/e2e/e2e/origin/spec_bridge.cy.ts b/packages/driver/cypress/e2e/e2e/origin/spec_bridge.cy.ts index 5f7f8ee12f4c..5c885b25bb04 100644 --- a/packages/driver/cypress/e2e/e2e/origin/spec_bridge.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/spec_bridge.cy.ts @@ -2,7 +2,7 @@ it('visits foobar.com and types foobar inside an input', () => { cy.visit('/fixtures/primary-origin.html') cy.get('[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('[data-cy="text-input"]').type('foobar') }) .then(() => { diff --git a/packages/driver/cypress/e2e/e2e/origin/uncaught_errors.cy.ts b/packages/driver/cypress/e2e/e2e/origin/uncaught_errors.cy.ts index 7b21cc087c00..6efefc99b559 100644 --- a/packages/driver/cypress/e2e/e2e/origin/uncaught_errors.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/uncaught_errors.cy.ts @@ -12,7 +12,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.then(() => { expect(true).to.be.false }) @@ -42,7 +42,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('.trigger-sync-error').click() }) }) @@ -55,7 +55,7 @@ describe('cy.origin - uncaught errors', () => { cy.on('fail', failureSpy) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.on('uncaught:exception', () => false) cy.get('.trigger-sync-error').click() }).then(() => { @@ -75,7 +75,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.once('uncaught:exception', () => true) cy.get('.trigger-sync-error').click() }) @@ -84,7 +84,7 @@ describe('cy.origin - uncaught errors', () => { // if we mutate the error, the app's listeners for 'error' or // 'unhandledrejection' will have our wrapped error instead of the original it('original error is not mutated for "error" in the origin', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.once('uncaught:exception', () => false) cy.get('.trigger-sync-error').click() @@ -105,7 +105,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { setTimeout(() => { throw new Error('setTimeout error') }, 50) @@ -137,7 +137,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('.trigger-async-error').click() // add the cy.wait here to keep commands streaming in, @@ -154,7 +154,7 @@ describe('cy.origin - uncaught errors', () => { cy.on('fail', failureSpy) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { // the async error here should be thrown AFTER the current command and test has finished, resulting in a passed test with no fail being triggered in the primary cy.get('.trigger-async-error').click() }).then(() => { @@ -173,7 +173,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { setTimeout(() => { throw new Error('setTimeout error') }, 50) @@ -185,7 +185,7 @@ describe('cy.origin - uncaught errors', () => { describe('unhandled rejections', () => { it('unhandled rejection triggers uncaught:exception and has promise as third argument', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { const r = cy.state('runnable') const afterUncaughtException = new Promise((resolve) => { @@ -209,7 +209,7 @@ describe('cy.origin - uncaught errors', () => { }) it('original error is not mutated for "unhandledrejection"', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.once('uncaught:exception', () => false) cy.get('.trigger-unhandled-rejection').click() @@ -228,7 +228,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { Promise.reject(new Error('rejected promise')) // add the cy.wait here to keep commands streaming in, forcing the @@ -248,7 +248,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { Promise.reject(new Error('rejected promise')) }) @@ -264,7 +264,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { throw document.createElement('h1') }) }) @@ -276,7 +276,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { throw () => undefined }) }) @@ -288,7 +288,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { throw Symbol('foo') }) }) @@ -300,7 +300,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { throw new Promise(() => {}) }) }) @@ -308,9 +308,9 @@ describe('cy.origin - uncaught errors', () => { describe('serializable errors', () => { it('errors thrown prior to attaching are forwarded to top', (done) => { - cy.origin('http://foobar.com:3500', () => {}).then(() => { + cy.origin('http://www.foobar.com:3500', () => {}).then(() => { // Force remove the spec bridge - window?.top?.document.getElementById('Spec Bridge: http://foobar.com:3500')?.remove() + window?.top?.document.getElementById('Spec Bridge: http://www.foobar.com:3500')?.remove() }) cy.on('fail', (err) => { @@ -318,7 +318,7 @@ describe('cy.origin - uncaught errors', () => { expect(err.message).to.include('this is the message') expect(err.message).to.include('The following error originated from your application code, not from Cypress.') expect(err.message).to.include('this is the message') - expect(err.message).to.include('\`cy.origin(\'http://foobar.com:3500\', () => {\`') + expect(err.message).to.include('\`cy.origin(\'http://www.foobar.com:3500\', () => {\`') expect(err.message).to.include('\`cy.visit(\'http://www.foobar.com:3500/fixtures/auth/error-on-load.html\')\`') expect(err.docsUrl).to.deep.eq(['https://on.cypress.io/uncaught-exception-from-application', 'https://on.cypress.io/origin']) @@ -338,7 +338,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.visit('http://www.foobar.com:3500/fixtures/auth/error-on-load.html') }) }) @@ -357,7 +357,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { class CustomError extends Error { private _name = 'CustomError' get name () { @@ -393,7 +393,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { class FooBar { private _metasyntaticList = ['foo'] get metasyntaticList (): string[] { @@ -421,7 +421,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { throw 'oops' }) }) @@ -433,7 +433,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { throw ['why would anyone do this?', 'this is odd'] }) }) @@ -445,7 +445,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { throw 2 }) }) @@ -457,7 +457,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { throw true }) }) @@ -469,7 +469,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { throw null }) }) @@ -481,7 +481,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { throw undefined }) }) @@ -493,7 +493,7 @@ describe('cy.origin - uncaught errors', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { throw new Date() }) }) diff --git a/packages/driver/cypress/e2e/e2e/origin/user_agent_override.cy.ts b/packages/driver/cypress/e2e/e2e/origin/user_agent_override.cy.ts index 539ccb61fabf..5148ca08d765 100644 --- a/packages/driver/cypress/e2e/e2e/origin/user_agent_override.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/user_agent_override.cy.ts @@ -29,7 +29,7 @@ describe('user agent override', { cy.visit('/fixtures/primary-origin.html') cy.get('a[data-cy="cross-origin-secondary-link"]').click() - cy.origin('http://foobar.com:3500', { + cy.origin('http://www.foobar.com:3500', { args: { userAgentBefore: window.navigator.userAgent, }, diff --git a/packages/driver/cypress/e2e/e2e/origin/validation.cy.ts b/packages/driver/cypress/e2e/e2e/origin/validation.cy.ts index 2de82525ca1d..765818374c69 100644 --- a/packages/driver/cypress/e2e/e2e/origin/validation.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/validation.cy.ts @@ -1,5 +1,11 @@ describe('cy.origin', () => { describe('successes', () => { + beforeEach(() => { + // TODO: There seems to be a limit of 15 active spec bridges during a given test. How common is this? + // @ts-ignore + [...window.top?.document.getElementsByClassName('spec-bridge-iframe')].forEach((el) => el.remove()) + }) + it('succeeds on a localhost domain name', () => { cy.origin('localhost', () => undefined) cy.then(() => { @@ -53,10 +59,10 @@ describe('cy.origin', () => { }) it('succeeds on a complete origin using https', () => { - cy.origin('https://foobar2.com:3500', () => undefined) + cy.origin('https://www.foobar2.com:3500', () => undefined) cy.then(() => { - const expectedSrc = `https://foobar2.com:3500/__cypress/spec-bridge-iframes` - const iframe = window.top?.document.getElementById('Spec\ Bridge:\ https://foobar2.com:3500') as HTMLIFrameElement + const expectedSrc = `https://www.foobar2.com:3500/__cypress/spec-bridge-iframes` + const iframe = window.top?.document.getElementById('Spec\ Bridge:\ https://www.foobar2.com:3500') as HTMLIFrameElement expect(iframe.src).to.equal(expectedSrc) }) @@ -85,8 +91,8 @@ describe('cy.origin', () => { it('succeeds on a subdomain', () => { cy.origin('app.foobar5.com', () => undefined) cy.then(() => { - const expectedSrc = `https://foobar5.com/__cypress/spec-bridge-iframes` - const iframe = window.top?.document.getElementById('Spec\ Bridge:\ https://foobar5.com') as HTMLIFrameElement + const expectedSrc = `https://app.foobar5.com/__cypress/spec-bridge-iframes` + const iframe = window.top?.document.getElementById('Spec\ Bridge:\ https://app.foobar5.com') as HTMLIFrameElement expect(iframe.src).to.equal(expectedSrc) }) @@ -105,8 +111,8 @@ describe('cy.origin', () => { it('succeeds on a url with path', () => { cy.origin('http://www.foobar7.com/login', () => undefined) cy.then(() => { - const expectedSrc = `http://foobar7.com/__cypress/spec-bridge-iframes` - const iframe = window.top?.document.getElementById('Spec\ Bridge:\ http://foobar7.com') as HTMLIFrameElement + const expectedSrc = `http://www.foobar7.com/__cypress/spec-bridge-iframes` + const iframe = window.top?.document.getElementById('Spec\ Bridge:\ http://www.foobar7.com') as HTMLIFrameElement expect(iframe.src).to.equal(expectedSrc) }) @@ -115,8 +121,8 @@ describe('cy.origin', () => { it('succeeds on a url with a hash', () => { cy.origin('http://www.foobar8.com/#hash', () => undefined) cy.then(() => { - const expectedSrc = `http://foobar8.com/__cypress/spec-bridge-iframes` - const iframe = window.top?.document.getElementById('Spec\ Bridge:\ http://foobar8.com') as HTMLIFrameElement + const expectedSrc = `http://www.foobar8.com/__cypress/spec-bridge-iframes` + const iframe = window.top?.document.getElementById('Spec\ Bridge:\ http://www.foobar8.com') as HTMLIFrameElement expect(iframe.src).to.equal(expectedSrc) }) @@ -125,8 +131,8 @@ describe('cy.origin', () => { it('succeeds on a url with a path and hash', () => { cy.origin('http://www.foobar9.com/login/#hash', () => undefined) cy.then(() => { - const expectedSrc = `http://foobar9.com/__cypress/spec-bridge-iframes` - const iframe = window.top?.document.getElementById('Spec\ Bridge:\ http://foobar9.com') as HTMLIFrameElement + const expectedSrc = `http://www.foobar9.com/__cypress/spec-bridge-iframes` + const iframe = window.top?.document.getElementById('Spec\ Bridge:\ http://www.foobar9.com') as HTMLIFrameElement expect(iframe.src).to.equal(expectedSrc) }) @@ -165,8 +171,8 @@ describe('cy.origin', () => { it('succeeds on a public suffix with a subdomain', () => { cy.origin('app.foobar.herokuapp.com', () => undefined) cy.then(() => { - const expectedSrc = `https://foobar.herokuapp.com/__cypress/spec-bridge-iframes` - const iframe = window.top?.document.getElementById('Spec\ Bridge:\ https://foobar.herokuapp.com') as HTMLIFrameElement + const expectedSrc = `https://app.foobar.herokuapp.com/__cypress/spec-bridge-iframes` + const iframe = window.top?.document.getElementById('Spec\ Bridge:\ https://app.foobar.herokuapp.com') as HTMLIFrameElement expect(iframe.src).to.equal(expectedSrc) }) @@ -188,7 +194,7 @@ describe('cy.origin', () => { win.location.href = 'http://baz.foobar.com:3500/fixtures/auth/idp.html' }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://baz.foobar.com:3500', () => { cy.get('[data-cy="username"]').type('TJohnson') cy.get('[data-cy="login"]').click() }) @@ -211,7 +217,7 @@ describe('cy.origin', () => { it.skip('uses cy.origin twice', () => { cy.visit('/fixtures/auth/index.html') cy.get('[data-cy="login-idp"]').click() - cy.origin('http://idp.com:3500', () => { + cy.origin('http://www.idp.com:3500', () => { cy.get('[data-cy="username"]').type('BJohnson') cy.get('[data-cy="login"]').click() }) @@ -226,7 +232,7 @@ describe('cy.origin', () => { win.location.href = 'http://baz.foobar.com:3500/fixtures/auth/idp.html' }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('[data-cy="username"]').type('TJohnson') cy.get('[data-cy="login"]').click() }) @@ -238,7 +244,7 @@ describe('cy.origin', () => { it('creates a spec bridge for https://idp.com:3502', () => { cy.visit('/fixtures/auth/index.html') - cy.origin('idp.com:3502', () => { + cy.origin('www.idp.com:3502', () => { cy.visit('https://www.idp.com:3502/fixtures/auth/index.html') cy.get('[data-cy="login-idp"]').invoke('text').should('equal', 'Login IDP') }) @@ -246,7 +252,7 @@ describe('cy.origin', () => { it('creates a spec bridge for http://idp.com:3500', () => { cy.visit('/fixtures/auth/index.html') - cy.origin('http://idp.com:3500', () => { + cy.origin('http://www.idp.com:3500', () => { cy.visit('http://www.idp.com:3500/fixtures/auth/index.html') cy.get('[data-cy="login-idp"]').invoke('text').should('equal', 'Login IDP') }) diff --git a/packages/driver/cypress/e2e/e2e/origin/yield.cy.ts b/packages/driver/cypress/e2e/e2e/origin/yield.cy.ts index 745e8d7c3c8b..953bade551bf 100644 --- a/packages/driver/cypress/e2e/e2e/origin/yield.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/yield.cy.ts @@ -15,7 +15,7 @@ describe('cy.origin yields', () => { }) it('yields a value', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy .get('[data-cy="dom-check"]') .invoke('text') @@ -23,7 +23,7 @@ describe('cy.origin yields', () => { }) it('yields the cy value even if a return is present', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy .get('[data-cy="dom-check"]') .invoke('text') @@ -45,7 +45,7 @@ describe('cy.origin yields', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy .get('[data-cy="dom-check"]') .invoke('text') @@ -55,13 +55,13 @@ describe('cy.origin yields', () => { }) it('yields synchronously', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { return 'From a secondary origin' }).should('equal', 'From a secondary origin') }) it('yields asynchronously', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { return new Promise((resolve: (val: string) => any, reject) => { setTimeout(() => { resolve('From a secondary origin') @@ -71,7 +71,7 @@ describe('cy.origin yields', () => { }) it('succeeds if subject cannot be serialized and is not accessed synchronously', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { return { symbol: Symbol(''), } @@ -89,7 +89,7 @@ describe('cy.origin yields', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { return { symbol: Symbol(''), } @@ -100,7 +100,7 @@ describe('cy.origin yields', () => { }) it('succeeds if subject cannot be serialized and is not accessed', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('[data-cy="dom-check"]') }) .then(() => { @@ -118,7 +118,7 @@ describe('cy.origin yields', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.get('[data-cy="dom-check"]') }) .then((subject) => subject.text()) @@ -134,7 +134,7 @@ describe('cy.origin yields', () => { done() }) - cy.origin<{ key: Function }>('http://foobar.com:3500', () => { + cy.origin<{ key: Function }>('http://www.foobar.com:3500', () => { cy.wrap({ key: () => { return 'whoops' @@ -154,7 +154,7 @@ describe('cy.origin yields', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.wrap({ key: Symbol('whoops'), }) @@ -171,7 +171,7 @@ describe('cy.origin yields', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.wrap(() => { return 'text' }) @@ -191,7 +191,7 @@ describe('cy.origin yields', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.wrap(Symbol('symbol')) }) .should('equal', 'symbol') @@ -211,7 +211,7 @@ describe('cy.origin yields', () => { done() }) - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.wrap({ key: new Error('Boom goes the dynamite'), }) @@ -223,7 +223,7 @@ describe('cy.origin yields', () => { }) it('yields an object containing valid types', () => { - cy.origin('http://foobar.com:3500', () => { + cy.origin('http://www.foobar.com:3500', () => { cy.wrap({ array: [ 1, diff --git a/packages/driver/cypress/fixtures/auth/index.html b/packages/driver/cypress/fixtures/auth/index.html index bc7f2327ab10..c2406435849a 100644 --- a/packages/driver/cypress/fixtures/auth/index.html +++ b/packages/driver/cypress/fixtures/auth/index.html @@ -64,7 +64,7 @@ loginWithApprovalBtn.innerHTML = "Login With Approval" loginWithApprovalBtn.dataset.cy = "login-with-approval" loginWithApprovalBtn.onclick = function () { - window.location.href = `http://wwww.foobar.com:3500/fixtures/auth/approval.html?redirect=${encodeURIComponent(window.location.href)}` + window.location.href = `http://www.foobar.com:3500/fixtures/auth/approval.html?redirect=${encodeURIComponent(window.location.href)}` }; document.body.appendChild(loginWithApprovalBtn); diff --git a/packages/driver/cypress/plugins/server.js b/packages/driver/cypress/plugins/server.js index 989a08cae61f..4211b309f0c7 100644 --- a/packages/driver/cypress/plugins/server.js +++ b/packages/driver/cypress/plugins/server.js @@ -8,6 +8,7 @@ const path = require('path') const Promise = require('bluebird') const multer = require('multer') const upload = multer({ dest: 'cypress/_test-output/' }) +const { cors } = require('@packages/network') const PATH_TO_SERVER_PKG = path.dirname(require.resolve('@packages/server')) @@ -296,17 +297,20 @@ const createApp = (port) => { }) app.get('/test-request-credentials', (req, res) => { + const origin = cors.getOriginPolicy(req['headers']['referer']) + res - .setHeader('Access-Control-Allow-Origin', req['headers']['origin']) + .setHeader('Access-Control-Allow-Origin', origin) .setHeader('Access-Control-Allow-Credentials', 'true') .sendStatus(200) }) app.get('/set-cookie-credentials', (req, res) => { const { cookie } = req.query + const origin = cors.getOriginPolicy(req['headers']['referer']) res - .setHeader('Access-Control-Allow-Origin', req['headers']['origin']) + .setHeader('Access-Control-Allow-Origin', origin) .setHeader('Access-Control-Allow-Credentials', 'true') .append('Set-Cookie', cookie) .sendStatus(200) diff --git a/packages/network/lib/cors.ts b/packages/network/lib/cors.ts index b55e7a3b1452..a788363fd01f 100644 --- a/packages/network/lib/cors.ts +++ b/packages/network/lib/cors.ts @@ -74,6 +74,10 @@ export function getDomainNameFromParsedHost (parsedHost: ParsedHost) { return _.compact([parsedHost.domain, parsedHost.tld]).join('.') } +export function urlMatchesSuperDomainOriginPolicyProps (urlStr, props) { + return urlMatchesSameSitePolicyProps(urlStr, props, true) +} + export function urlMatchesOriginPolicyProps (urlStr, props) { if (!props) { return false @@ -120,6 +124,10 @@ export function urlOriginsMatch (url1: string, url2: string) { return urlMatchesOriginPolicyProps(url1, parseUrlIntoHostProtocolDomainTldPort(url2)) } +export function urlsSuperDomainOriginPolicyMatch (url1: string, url2: string) { + return urlSameSiteMatch(url1, url2, true) +} + /** * Whether or not a url's scheme, domain, and top-level domain match to determine whether or not * a cookie is considered first-party. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#third-party_cookies diff --git a/packages/proxy/lib/http/request-middleware.ts b/packages/proxy/lib/http/request-middleware.ts index 8a49dc430926..5635f493e436 100644 --- a/packages/proxy/lib/http/request-middleware.ts +++ b/packages/proxy/lib/http/request-middleware.ts @@ -129,7 +129,7 @@ const MaybeEndRequestWithBufferedResponse: RequestMiddleware = function () { if (buffer) { this.debug('ending request with buffered response') - this.res.wantsInjection = buffer.isCrossOrigin ? 'fullCrossOrigin' : 'full' + this.res.wantsInjection = this.config.experimentalSessionAndOrigin && buffer.isCrossOrigin ? 'fullCrossOrigin' : 'full' return this.onResponse(buffer.response, buffer.stream) } diff --git a/packages/proxy/lib/http/response-middleware.ts b/packages/proxy/lib/http/response-middleware.ts index bfa2ffc684a8..b86dc888025f 100644 --- a/packages/proxy/lib/http/response-middleware.ts +++ b/packages/proxy/lib/http/response-middleware.ts @@ -65,6 +65,18 @@ function reqMatchesOriginPolicy (req: CypressIncomingRequest, remoteState) { return false } +function reqMatchesSuperDomainOriginPolicy (req: CypressIncomingRequest, remoteState) { + if (remoteState.strategy === 'http') { + return cors.urlMatchesSuperDomainOriginPolicyProps(req.proxiedUrl, remoteState.props) + } + + if (remoteState.strategy === 'file') { + return req.proxiedUrl.startsWith(remoteState.origin) + } + + return false +} + function reqWillRenderHtml (req: CypressIncomingRequest) { // will this request be rendered in the browser, necessitating injection? // https://github.com/cypress-io/cypress/issues/288 @@ -248,7 +260,7 @@ const SetInjectionLevel: ResponseMiddleware = function () { this.debug('determine injection') - const isReqMatchOriginPolicy = reqMatchesOriginPolicy(this.req, this.remoteStates.current()) + const isReqMatchSuperDomainOriginPolicy = reqMatchesSuperDomainOriginPolicy(this.req, this.remoteStates.current()) const getInjectionLevel = () => { if (this.incomingRes.headers['x-cypress-file-server-error'] && !this.res.isInitial) { this.debug('- partial injection (x-cypress-file-server-error)') @@ -265,7 +277,7 @@ const SetInjectionLevel: ResponseMiddleware = function () { return 'fullCrossOrigin' } - if (!isHTML || (!isReqMatchOriginPolicy && !isAUTFrame)) { + if (!isHTML || (!isReqMatchSuperDomainOriginPolicy && !isAUTFrame)) { this.debug('- no injection (not html)') return false @@ -314,7 +326,7 @@ const SetInjectionLevel: ResponseMiddleware = function () { this.res.wantsInjection === 'full' || this.res.wantsInjection === 'fullCrossOrigin' || // only modify JavasScript if matching the current origin policy or if experimentalModifyObstructiveThirdPartyCode is enabled (above) - (resContentTypeIsJavaScript(this.incomingRes) && isReqMatchOriginPolicy)) + (resContentTypeIsJavaScript(this.incomingRes) && isReqMatchSuperDomainOriginPolicy)) this.debug('injection levels: %o', _.pick(this.res, 'isInitial', 'wantsInjection', 'wantsSecurityRemoved')) diff --git a/packages/server/lib/remote_states.ts b/packages/server/lib/remote_states.ts index 4bc9c9e15c90..11c588e35935 100644 --- a/packages/server/lib/remote_states.ts +++ b/packages/server/lib/remote_states.ts @@ -37,7 +37,8 @@ const debug = Debug('cypress:server:remote-states') * port: 443 * tld: "com" * domain: "google" - * protocol: "https" + * protocol: "https", + * subdomain: "foo" * } * } */ diff --git a/packages/server/test/unit/remote_states.spec.ts b/packages/server/test/unit/remote_states.spec.ts index 84195ad93809..f00dcd2e32f9 100644 --- a/packages/server/test/unit/remote_states.spec.ts +++ b/packages/server/test/unit/remote_states.spec.ts @@ -30,6 +30,7 @@ describe('remote states', () => { domain: '', tld: 'localhost', protocol: 'http:', + subdomain: null, }, }) }) @@ -54,6 +55,7 @@ describe('remote states', () => { domain: '', tld: 'localhost', protocol: 'http:', + subdomain: null, }, }) @@ -72,6 +74,7 @@ describe('remote states', () => { domain: '', tld: 'localhost', protocol: 'http:', + subdomain: null, }, }) }) @@ -92,6 +95,7 @@ describe('remote states', () => { domain: '', tld: 'localhost', protocol: 'http:', + subdomain: null, }, }) }) @@ -112,6 +116,7 @@ describe('remote states', () => { domain: '', tld: 'localhost', protocol: 'http:', + subdomain: null, }, }) }) @@ -162,6 +167,7 @@ describe('remote states', () => { domain: 'google', tld: 'com', protocol: 'https:', + subdomain: 'staging', }, }) }) @@ -184,6 +190,7 @@ describe('remote states', () => { domain: 'google', tld: 'com', protocol: 'https:', + subdomain: 'staging', }, }) @@ -208,6 +215,7 @@ describe('remote states', () => { domain: 'google', tld: 'com', protocol: 'https:', + subdomain: 'staging', }, }) @@ -220,7 +228,7 @@ describe('remote states', () => { it('overrides the existing state', function () { this.remoteStates.set('https://staging.google.com/foo/bar') - let state = this.remoteStates.get('https://google.com') + let state = this.remoteStates.get('https://staging.google.com') expect(state).to.deep.equal({ auth: undefined, @@ -233,12 +241,13 @@ describe('remote states', () => { domain: 'google', tld: 'com', protocol: 'https:', + subdomain: 'staging', }, }) this.remoteStates.set('https://prod.google.com/foo/bar') - state = this.remoteStates.get('https://google.com') + state = this.remoteStates.get('https://prod.google.com') expect(state).to.deep.equal({ auth: undefined, @@ -251,6 +260,7 @@ describe('remote states', () => { domain: 'google', tld: 'com', protocol: 'https:', + subdomain: 'prod', }, }) }) @@ -269,6 +279,7 @@ describe('remote states', () => { domain: 'google', tld: 'com', protocol: 'https:', + subdomain: 'staging', }, }) }) @@ -287,6 +298,7 @@ describe('remote states', () => { domain: 'google', tld: 'com', protocol: 'http:', + subdomain: 'staging', }, }) }) @@ -305,6 +317,7 @@ describe('remote states', () => { domain: '', tld: 'localhost', protocol: 'http:', + subdomain: null, }, }) }) @@ -347,6 +360,7 @@ describe('remote states', () => { domain: 'foobar', tld: 'com', protocol: 'http:', + subdomain: 'www', }, } diff --git a/system-tests/projects/e2e/cypress/e2e/cy_origin_error.cy.ts b/system-tests/projects/e2e/cypress/e2e/cy_origin_error.cy.ts index 361325608234..e3dda2e01045 100644 --- a/system-tests/projects/e2e/cypress/e2e/cy_origin_error.cy.ts +++ b/system-tests/projects/e2e/cypress/e2e/cy_origin_error.cy.ts @@ -5,7 +5,7 @@ describe('cy.origin', () => { }) it('tries to find an element that doesn\'t exist and fails', () => { - cy.origin('http://foobar.com:4466', () => { + cy.origin('http://www.foobar.com:4466', () => { cy.get('#doesnotexist', { timeout: 1000, })