diff --git a/.circleci/cache-version.txt b/.circleci/cache-version.txt index ebdaf186f482..10dbd6ac3c34 100644 --- a/.circleci/cache-version.txt +++ b/.circleci/cache-version.txt @@ -1,3 +1,3 @@ # Bump this version to force CI to re-create the cache from scratch. -11-20-23 +11-27-23 diff --git a/browser-versions.json b/browser-versions.json index 916a03abb5dd..2e9bdf5d5077 100644 --- a/browser-versions.json +++ b/browser-versions.json @@ -1,5 +1,5 @@ { - "chrome:beta": "118.0.5993.21", - "chrome:stable": "117.0.5938.132", + "chrome:beta": "121.0.6167.47", + "chrome:stable": "120.0.6099.216", "chrome:minimum": "64.0.3282.0" } diff --git a/packages/driver/cypress/e2e/commands/cookies.cy.js b/packages/driver/cypress/e2e/commands/cookies.cy.js index a4b857f82ad4..84ed457d7ca3 100644 --- a/packages/driver/cypress/e2e/commands/cookies.cy.js +++ b/packages/driver/cypress/e2e/commands/cookies.cy.js @@ -19,7 +19,7 @@ describe('src/cy/commands/cookies - no stub', () => { context('#getCookies', () => { it('returns cookies from only the bare domain matching the AUT by default when AUT is an apex domain', () => { - cy.visit('http://barbaz.com:3500/fixtures/generic.html') + cy.visit('https://barbaz.com:3502/fixtures/generic.html') setCookies() cy.getCookies().then((cookies) => { @@ -36,8 +36,8 @@ describe('src/cy/commands/cookies - no stub', () => { // webkit does not support cy.origin() if (isWebkit) return - cy.origin('http://foobar.com:3500', () => { - cy.visit('http://foobar.com:3500/fixtures/generic.html') + cy.origin('https://foobar.com:3502', () => { + cy.visit('https://foobar.com:3502/fixtures/generic.html') cy.getCookies().then((cookies) => { expect(cookies).to.have.length(1) @@ -48,7 +48,7 @@ describe('src/cy/commands/cookies - no stub', () => { }) it('returns cookies from the subdomain and bare domain matching the AUT by default when AUT is a subdomain', () => { - cy.visit('http://www.barbaz.com:3500/fixtures/generic.html') + cy.visit('https://www.barbaz.com:3502/fixtures/generic.html') setCookies() cy.getCookies().then((cookies) => { expect(cookies).to.have.length(4) @@ -68,8 +68,8 @@ describe('src/cy/commands/cookies - no stub', () => { // webkit does not support cy.origin() if (isWebkit) return - cy.origin('http://www.foobar.com:3500', () => { - cy.visit('http://www.foobar.com:3500/fixtures/generic.html') + cy.origin('https://www.foobar.com:3502', () => { + cy.visit('https://www.foobar.com:3502/fixtures/generic.html') cy.getCookies().then((cookies) => { const sortedCookies = Cypress._.sortBy(cookies, 'name') @@ -84,7 +84,7 @@ describe('src/cy/commands/cookies - no stub', () => { }) it('returns cookies for the specified domain', () => { - cy.visit('http://barbaz.com:3500/fixtures/generic.html') + cy.visit('https://barbaz.com:3502/fixtures/generic.html') setCookies() cy.getCookies({ domain: 'www.foobar.com' }).then((cookies) => { @@ -109,8 +109,8 @@ describe('src/cy/commands/cookies - no stub', () => { // webkit does not support cy.origin() if (isWebkit) return - cy.origin('http://www.foobar.com:3500', () => { - cy.visit('http://www.foobar.com:3500/fixtures/generic.html') + cy.origin('https://www.foobar.com:3502', () => { + cy.visit('https://www.foobar.com:3502/fixtures/generic.html') cy.getCookies({ domain: 'www.barbaz.com' }).then((cookies) => { expect(cookies).to.have.length(4) @@ -132,7 +132,7 @@ describe('src/cy/commands/cookies - no stub', () => { context('#getAllCookies', () => { it('returns cookies from all domains', () => { - cy.visit('http://barbaz.com:3500/fixtures/generic.html') + cy.visit('https://barbaz.com:3502/fixtures/generic.html') setCookies() cy.getAllCookies().then((cookies) => { @@ -155,8 +155,8 @@ describe('src/cy/commands/cookies - no stub', () => { // webkit does not support cy.origin() if (isWebkit) return - cy.origin('http://foobar.com:3500', () => { - cy.visit('http://foobar.com:3500/fixtures/generic.html') + cy.origin('https://foobar.com:3502', () => { + cy.visit('https://foobar.com:3502/fixtures/generic.html') cy.getAllCookies().then((cookies) => { expect(cookies).to.have.length(8) @@ -188,7 +188,7 @@ describe('src/cy/commands/cookies - no stub', () => { } it('returns the cookie from the domain matching the AUT by default when AUT is an apex domain', () => { - cy.visit('http://barbaz.com:3500/fixtures/generic.html') + cy.visit('https://barbaz.com:3502/fixtures/generic.html') setCookies() cy.getCookie('key').then((cookie) => { @@ -199,8 +199,8 @@ describe('src/cy/commands/cookies - no stub', () => { // webkit does not support cy.origin() if (isWebkit) return - cy.origin('http://foobar.com:3500', () => { - cy.visit('http://foobar.com:3500/fixtures/generic.html') + cy.origin('https://foobar.com:3502', () => { + cy.visit('https://foobar.com:3502/fixtures/generic.html') cy.getCookie('key').then((cookie) => { expect(cookie.value).to.equal('foobar.com value') @@ -210,7 +210,7 @@ describe('src/cy/commands/cookies - no stub', () => { }) it('can return the cookie from the subdomain matching the AUT by default when AUT is a subdomain', () => { - cy.visit('http://www.barbaz.com:3500/fixtures/generic.html') + cy.visit('https://www.barbaz.com:3502/fixtures/generic.html') cy.setCookie('key', 'www.barbaz.com value', { domain: 'www.barbaz.com', log: false }) cy.getCookie('key').then((cookie) => { @@ -221,8 +221,8 @@ describe('src/cy/commands/cookies - no stub', () => { // webkit does not support cy.origin() if (isWebkit) return - cy.origin('http://www.foobar.com:3500', () => { - cy.visit('http://www.foobar.com:3500/fixtures/generic.html') + cy.origin('https://www.foobar.com:3502', () => { + cy.visit('https://www.foobar.com:3502/fixtures/generic.html') cy.setCookie('key', 'www.foobar.com value', { domain: 'www.foobar.com', log: false }) cy.getCookie('key').then((cookie) => { @@ -233,7 +233,7 @@ describe('src/cy/commands/cookies - no stub', () => { }) it('can return the cookie from the bare domain matching the AUT by default when AUT is a subdomain', () => { - cy.visit('http://www.barbaz.com:3500/fixtures/generic.html') + cy.visit('https://www.barbaz.com:3502/fixtures/generic.html') cy.setCookie('key', 'barbaz.com value', { domain: 'barbaz.com', log: false }) cy.getCookie('key').then((cookie) => { @@ -244,8 +244,8 @@ describe('src/cy/commands/cookies - no stub', () => { // webkit does not support cy.origin() if (isWebkit) return - cy.origin('http://www.foobar.com:3500', () => { - cy.visit('http://www.foobar.com:3500/fixtures/generic.html') + cy.origin('https://www.foobar.com:3502', () => { + cy.visit('https://www.foobar.com:3502/fixtures/generic.html') cy.setCookie('key', 'foobar.com value', { domain: 'foobar.com', log: false }) cy.getCookie('key').then((cookie) => { @@ -256,7 +256,7 @@ describe('src/cy/commands/cookies - no stub', () => { }) it('returns the cookie from the specified domain', () => { - cy.visit('http://www.barbaz.com:3500/fixtures/generic.html') + cy.visit('https://www.barbaz.com:3502/fixtures/generic.html') setCookies() cy.getCookie('key', { domain: 'www.foobar.com' }).then((cookie) => { @@ -267,8 +267,8 @@ describe('src/cy/commands/cookies - no stub', () => { // webkit does not support cy.origin() if (isWebkit) return - cy.origin('http://www.foobar.com:3500', () => { - cy.visit('http://www.foobar.com:3500/fixtures/generic.html') + cy.origin('https://www.foobar.com:3502', () => { + cy.visit('https://www.foobar.com:3502/fixtures/generic.html') cy.getCookie('key', { domain: 'www.barbaz.com' }).then((cookie) => { expect(cookie.value).to.equal('www.barbaz.com value') @@ -280,7 +280,7 @@ describe('src/cy/commands/cookies - no stub', () => { context('#setCookie', () => { it('sets the cookie on the domain matching the AUT by default', () => { - cy.visit('http://www.barbaz.com:3500/fixtures/generic.html') + cy.visit('https://www.barbaz.com:3502/fixtures/generic.html') cy.setCookie('key', 'value') cy.getCookie('key').its('domain').should('match', /\.?www\.barbaz\.com/) @@ -290,8 +290,8 @@ describe('src/cy/commands/cookies - no stub', () => { // webkit does not support cy.origin() if (isWebkit) return - cy.origin('http://www.foobar.com:3500', () => { - cy.visit('http://www.foobar.com:3500/fixtures/generic.html') + cy.origin('https://www.foobar.com:3502', () => { + cy.visit('https://www.foobar.com:3502/fixtures/generic.html') cy.setCookie('key', 'value') cy.getCookie('key').its('domain').should('match', /\.?www\.foobar\.com/) @@ -301,7 +301,7 @@ describe('src/cy/commands/cookies - no stub', () => { }) it('sets the cookie on the specified domain', () => { - cy.visit('http://www.barbaz.com:3500/fixtures/generic.html') + cy.visit('https://www.barbaz.com:3502/fixtures/generic.html') cy.setCookie('foo', 'bar', { domain: 'www.foobar.com' }) cy.getCookie('foo', { domain: 'www.foobar.com' }) @@ -313,8 +313,8 @@ describe('src/cy/commands/cookies - no stub', () => { // webkit does not support cy.origin() if (isWebkit) return - cy.origin('http://www.foobar.com:3500', () => { - cy.visit('http://www.foobar.com:3500/fixtures/generic.html') + cy.origin('https://www.foobar.com:3502', () => { + cy.visit('https://www.foobar.com:3502/fixtures/generic.html') cy.setCookie('foo', 'bar', { domain: 'barbaz.com' }) cy.getCookie('foo', { domain: 'barbaz.com' }) @@ -328,7 +328,7 @@ describe('src/cy/commands/cookies - no stub', () => { context('#clearCookies', () => { it('clears cookies from only the bare domain matching the AUT by default when AUT is an apex domain', () => { - cy.visit('http://barbaz.com:3500/fixtures/generic.html') + cy.visit('https://barbaz.com:3502/fixtures/generic.html') setCookies() cy.clearCookies() @@ -342,8 +342,8 @@ describe('src/cy/commands/cookies - no stub', () => { // webkit does not support cy.origin() if (isWebkit) return - cy.origin('http://foobar.com:3500', () => { - cy.visit('http://foobar.com:3500/fixtures/generic.html') + cy.origin('https://foobar.com:3502', () => { + cy.visit('https://foobar.com:3502/fixtures/generic.html') // put back cookies removed above cy.setCookie('key5', 'value5', { domain: 'barbaz.com' }) cy.setCookie('key6', 'value6', { domain: 'barbaz.com' }) @@ -360,7 +360,7 @@ describe('src/cy/commands/cookies - no stub', () => { }) it('clears cookies from the subdomain and bare domain matching the AUT by default when AUT is a subdomain', () => { - cy.visit('http://www.barbaz.com:3500/fixtures/generic.html') + cy.visit('https://www.barbaz.com:3502/fixtures/generic.html') setCookies() cy.clearCookies() @@ -374,8 +374,8 @@ describe('src/cy/commands/cookies - no stub', () => { // webkit does not support cy.origin() if (isWebkit) return - cy.origin('http://www.foobar.com:3500', () => { - cy.visit('http://www.foobar.com:3500/fixtures/generic.html') + cy.origin('https://www.foobar.com:3502', () => { + cy.visit('https://www.foobar.com:3502/fixtures/generic.html') // put back cookies removed above cy.setCookie('key3', 'value3', { domain: 'www.barbaz.com' }) cy.setCookie('key4', 'value4', { domain: 'www.barbaz.com' }) @@ -394,7 +394,7 @@ describe('src/cy/commands/cookies - no stub', () => { }) it('clears the cookies on the specified domain', () => { - cy.visit('http://www.barbaz.com:3500/fixtures/generic.html') + cy.visit('https://www.barbaz.com:3502/fixtures/generic.html') setCookies() cy.clearCookies({ domain: 'www.foobar.com' }) @@ -408,8 +408,8 @@ describe('src/cy/commands/cookies - no stub', () => { // webkit does not support cy.origin() if (isWebkit) return - cy.origin('http://www.foobar.com:3500', () => { - cy.visit('http://www.foobar.com:3500/fixtures/generic.html') + cy.origin('https://www.foobar.com:3502', () => { + cy.visit('https://www.foobar.com:3502/fixtures/generic.html') // put back cookies removed above cy.setCookie('key1', 'value1') cy.setCookie('key2', 'value2', { domain: 'foobar.com' }) @@ -428,7 +428,7 @@ describe('src/cy/commands/cookies - no stub', () => { context('#clearAllCookies', () => { it('clears cookies from all domains', () => { - cy.visit('http://barbaz.com:3500/fixtures/generic.html') + cy.visit('https://barbaz.com:3502/fixtures/generic.html') setCookies() cy.clearAllCookies() @@ -437,8 +437,8 @@ describe('src/cy/commands/cookies - no stub', () => { // webkit does not support cy.origin() if (isWebkit) return - cy.origin('http://foobar.com:3500', () => { - cy.visit('http://foobar.com:3500/fixtures/generic.html') + cy.origin('https://foobar.com:3502', () => { + cy.visit('https://foobar.com:3502/fixtures/generic.html') // put back cookies removed above cy.setCookie('key1', 'value1', { domain: 'www.foobar.com', log: false }) cy.setCookie('key2', 'value2', { domain: 'foobar.com', log: false }) @@ -466,7 +466,7 @@ describe('src/cy/commands/cookies - no stub', () => { } it('clears the cookie from the domain matching the AUT by default when AUT is an apex domain', () => { - cy.visit('http://barbaz.com:3500/fixtures/generic.html') + cy.visit('https://barbaz.com:3502/fixtures/generic.html') setCookies() cy.clearCookie('key') @@ -479,8 +479,8 @@ describe('src/cy/commands/cookies - no stub', () => { // webkit does not support cy.origin() if (isWebkit) return - cy.origin('http://foobar.com:3500', () => { - cy.visit('http://foobar.com:3500/fixtures/generic.html') + cy.origin('https://foobar.com:3502', () => { + cy.visit('https://foobar.com:3502/fixtures/generic.html') // put back cookie removed above cy.setCookie('key', 'value1', { domain: 'barbaz.com' }) @@ -494,7 +494,7 @@ describe('src/cy/commands/cookies - no stub', () => { }) it('can clear the cookie from the subdomain matching the AUT by default when AUT is a subdomain', () => { - cy.visit('http://www.barbaz.com:3500/fixtures/generic.html') + cy.visit('https://www.barbaz.com:3502/fixtures/generic.html') cy.setCookie('key', 'www.barbaz.com value', { domain: 'www.barbaz.com', log: false }) cy.clearCookie('key') @@ -504,8 +504,8 @@ describe('src/cy/commands/cookies - no stub', () => { // webkit does not support cy.origin() if (isWebkit) return - cy.origin('http://www.foobar.com:3500', () => { - cy.visit('http://www.foobar.com:3500/fixtures/generic.html') + cy.origin('https://www.foobar.com:3502', () => { + cy.visit('https://www.foobar.com:3502/fixtures/generic.html') cy.setCookie('key', 'www.foobar.com value', { domain: 'www.foobar.com', log: false }) cy.clearCookie('key') @@ -515,7 +515,7 @@ describe('src/cy/commands/cookies - no stub', () => { }) it('can clear the cookie from the bare domain matching the AUT by default when AUT is a subdomain', () => { - cy.visit('http://www.barbaz.com:3500/fixtures/generic.html') + cy.visit('https://www.barbaz.com:3502/fixtures/generic.html') cy.setCookie('key', 'barbaz.com value', { domain: 'barbaz.com', log: false }) cy.clearCookie('key') @@ -525,8 +525,8 @@ describe('src/cy/commands/cookies - no stub', () => { // webkit does not support cy.origin() if (isWebkit) return - cy.origin('http://www.foobar.com:3500', () => { - cy.visit('http://www.foobar.com:3500/fixtures/generic.html') + cy.origin('https://www.foobar.com:3502', () => { + cy.visit('https://www.foobar.com:3502/fixtures/generic.html') cy.setCookie('key', 'foobar.com value', { domain: 'foobar.com', log: false }) cy.clearCookie('key') @@ -536,7 +536,7 @@ describe('src/cy/commands/cookies - no stub', () => { }) it('clears the cookie on the specified domain', () => { - cy.visit('http://barbaz.com:3500/fixtures/generic.html') + cy.visit('https://barbaz.com:3502/fixtures/generic.html') setCookies() cy.clearCookie('key', { domain: 'foobar.com' }) @@ -549,8 +549,8 @@ describe('src/cy/commands/cookies - no stub', () => { // webkit does not support cy.origin() if (isWebkit) return - cy.origin('http://foobar.com:3500', () => { - cy.visit('http://foobar.com:3500/fixtures/generic.html') + cy.origin('https://foobar.com:3502', () => { + cy.visit('https://foobar.com:3502/fixtures/generic.html') cy.setCookie('key', 'value1') cy.clearCookie('key', { domain: 'barbaz.com' }) @@ -566,7 +566,7 @@ describe('src/cy/commands/cookies - no stub', () => { it('sets the cookie on the specified domain as hostOnly and validates hostOnly property persists through related commands that fetch cookies', () => { const isWebkit = Cypress.browser.name.includes('webkit') - cy.visit('http://www.barbaz.com:3500/fixtures/generic.html') + cy.visit('https://www.barbaz.com:3502/fixtures/generic.html') cy.setCookie('foo', 'bar', { hostOnly: true }) cy.getCookie('foo').its('domain').should('eq', 'www.barbaz.com') 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 2cd6df74e6c4..68b4d52e87ee 100644 --- a/packages/driver/cypress/e2e/e2e/origin/basic_login.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/basic_login.cy.ts @@ -2,9 +2,9 @@ describe('basic login', { browser: '!webkit' }, () => { // Scenario, Token based auth. Visit site, redirect to IDP hosted on secondary origin, login and redirect back to site. describe('visit primary first', () => { 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://www.idp.com:3500', () => { + cy.visit('https://www.foobar.com:3502/fixtures/auth/index.html') // Establishes primary origin + cy.get('[data-cy="login-https-idp"]').click() // Takes you to idp.com + cy.origin('https://www.idp.com:3502', () => { cy.get('[data-cy="username"]').type('BJohnson') cy.get('[data-cy="login"]').click() }) @@ -17,13 +17,13 @@ describe('basic login', { browser: '!webkit' }, () => { // Scenario, Token based auth. Visit site, manually redirect to IDP hosted on secondary origin, login and redirect back to site. it('does not redirect', () => { - cy.visit('/fixtures/auth/index.html') // Establishes primary origin + cy.visit('https://www.foobar.com:3502/fixtures/auth/index.html') // Establishes primary origin // Missing the call to go to idp.com cy.window().then((win) => { - win.location.href = 'http://www.idp.com:3500/fixtures/auth/idp.html' + win.location.href = 'https://www.idp.com:3502/fixtures/auth/idp.html' }) - cy.origin('http://www.idp.com:3500', () => { + cy.origin('https://www.idp.com:3502', () => { cy.get('[data-cy="username"]').type('FJohnson') cy.get('[data-cy="login"]').click() }) @@ -35,9 +35,9 @@ describe('basic login', { browser: '!webkit' }, () => { }) 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://www.idp.com:3500', () => { + cy.visit('https://www.foobar.com:3502/fixtures/auth/index.html') // Establishes primary origin + cy.get('[data-cy="login-https-idp"]').click() // Takes you to idp.com + cy.origin('https://www.idp.com:3502', () => { cy.get('[data-cy="username"]').type('BJohnson') cy.get('[data-cy="login"]').click() }) @@ -51,6 +51,20 @@ describe('basic login', { browser: '!webkit' }, () => { // Scenario, Token based auth. Visit IDP hosted on secondary origin, login and redirect back to site. describe('visit secondary first', () => { + // What we don't want them to do, but should still work + // Visit IDP first + it('logs in and runs the test in cy.origin', () => { // Setting the base url + cy.visit('https://www.idp.com:3502/fixtures/auth/idp.html') // Visit idp.com + cy.get('[data-cy="username"]').type('FJohnson') + cy.get('[data-cy="login"]').click() + + cy.origin('https://www.foobar.com:3502', () => { + cy.get('[data-cy="welcome"]') + .invoke('text') + .should('equal', 'Welcome FJohnson') + }) + }) + describe('How to determine primary origin', () => { // NOTE: Enable to set the top origin to foobar before running the next test. it.skip('reset top', () => { @@ -60,8 +74,8 @@ describe('basic login', { browser: '!webkit' }, () => { // 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://www.idp.com:3500', () => { // primary origin is localhost - cy.visit('http://www.idp.com:3500/fixtures/auth/idp.html') + cy.origin('https://www.idp.com:3502', () => { // primary origin is localhost + cy.visit('https://www.idp.com:3502/fixtures/auth/idp.html') cy.get('[data-cy="username"]').type('FJohnson') cy.get('[data-cy="login"]').click() }) @@ -72,13 +86,13 @@ describe('basic login', { browser: '!webkit' }, () => { }) it('reset top', () => { - cy.visit('http://www.foobar.com:3500/fixtures/auth/index.html') + cy.visit('https://www.foobar.com:3502/fixtures/auth/index.html') }) it('logs in with primary set via visit', () => { - cy.visit('/fixtures/auth/index.html') - cy.origin('http://www.idp.com:3500', () => { // primary origin is localhost - cy.visit('http://www.idp.com:3500/fixtures/auth/idp.html') + cy.visit('https://www.foobar.com:3502/fixtures/auth/index.html') + cy.origin('https://www.idp.com:3502', () => { // primary origin is localhost + cy.visit('https://www.idp.com:3502/fixtures/auth/idp.html') cy.get('[data-cy="username"]').type('FJohnson') cy.get('[data-cy="login"]').click() }) @@ -90,16 +104,17 @@ describe('basic login', { browser: '!webkit' }, () => { }) describe('session', () => { - // Custom login command that establishes a session + // Custom login command that establishes a session 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://www.idp.com:3500', { args: name }, (name) => { - cy.visit('http://www.idp.com:3500/fixtures/auth/idp.html') + cy.origin('https://www.idp.com:3502', { args: name }, (name) => { + cy.visit('https://www.idp.com:3502/fixtures/auth/idp.html') cy.get('[data-cy="username"]').type(name) cy.get('[data-cy="login"]').click() }) + cy.visit('https://www.foobar.com:3502/fixtures/auth/index.html') cy.url().should('contain', '/index.html') }, { validate: () => { @@ -113,7 +128,7 @@ describe('basic login', { browser: '!webkit' }, () => { // Scenario, Token based auth. Establish session using custom login command (login through IDP hosted on secondary origin), and verify to site. it('establishes a session', () => { login('BJohnson') - cy.visit('/fixtures/auth/index.html') + cy.visit('https://www.foobar.com:3502/fixtures/auth/index.html') // Verify that the user has logged in on localhost cy.get('[data-cy="welcome"]') .invoke('text') @@ -123,33 +138,19 @@ describe('basic login', { browser: '!webkit' }, () => { // Scenario, Token based auth. use previously established session, and verify to site. it('uses established session', () => { login('BJohnson') - cy.visit('/fixtures/auth/index.html') + cy.visit('https://www.foobar.com:3502/fixtures/auth/index.html') cy.get('[data-cy="welcome"]') .invoke('text') .should('equal', 'Welcome BJohnson') }) }) - - // What we don't want them to do, but should still work - // Visit IDP first - it('logs in and runs the test in cy.origin', () => { // Setting the base url - cy.visit('http://www.idp.com:3500/fixtures/auth/idp.html') // Visit idp.com - cy.get('[data-cy="username"]').type('FJohnson') - cy.get('[data-cy="login"]').click() - - cy.origin('http://localhost:3500', () => { - cy.get('[data-cy="welcome"]') - .invoke('text') - .should('equal', 'Welcome FJohnson') - }) - }) }) }) describe('Multi-step Auth', { browser: '!webkit' }, () => { // TODO: cy.origin does not work in cy.origin yet. it.skip('final auth redirects back to localhost - nested', () => { - cy.visit('/fixtures/auth/index.html') + cy.visit('https://www.barbaz.com:3502/fixtures/auth/index.html') cy.get('[data-cy="login-with-approval"]').click() // takes you to foobar.com.../approval cy.url() //fail cy.origin('http://www.foobar.com:3500', () => { // Parent origin is localhost @@ -168,13 +169,13 @@ describe('Multi-step Auth', { browser: '!webkit' }, () => { // TODO: fix flaky test https://github.com/cypress-io/cypress/issues/23481 it('final-auth redirects back to localhost - flat', { retries: 15 }, () => { - cy.visit('/fixtures/auth/index.html') - cy.get('[data-cy="login-with-approval"]').click() // takes you to foobar.com.../approval - cy.origin('http://www.foobar.com:3500', () => { // Parent origin is localhost + cy.visit('https://www.barbaz.com:3502/fixtures/auth/index.html') + cy.get('[data-cy="login-with-approval-https"]').click() // takes you to foobar.com.../approval + cy.origin('https://www.foobar.com:3502', () => { // 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://www.idp.com:3500', () => { // Parent origin is localhost + cy.origin('https://www.idp.com:3502', () => { // 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 @@ -204,7 +205,7 @@ describe('Multi-step Auth', { browser: '!webkit' }, () => { // TODO: Switch to origin does not work in switch to origin yet. it.skip('final auth redirects back to approval page - nested', () => { - cy.visit('/fixtures/auth/index.html') + cy.visit('https://www.barbaz.com:3502/fixtures/auth/index.html') cy.get('[data-cy="login-with-approval"]').click() // takes you to foobar.com.../approval cy.origin('http://www.foobar.com:3500', () => { // parent origin is localhost cy.get('[data-cy="approve-me"]').click() // takes you to idp.com @@ -223,18 +224,18 @@ describe('Multi-step Auth', { browser: '!webkit' }, () => { }) 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://www.foobar.com:3500', () => { // parent origin is localhost + cy.visit('https://www.barbaz.com:3502/fixtures/auth/index.html') + cy.get('[data-cy="login-with-approval-https"]').click() // takes you to foobar.com.../approval + cy.origin('https://www.foobar.com:3502', () => { // 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://www.idp.com:3500', () => { // parent origin is localhost + cy.origin('https://www.idp.com:3502', () => { // 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://www.foobar.com:3500', () => { // parent origin is localhost + cy.origin('https://www.foobar.com:3502', () => { // 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/cookie_behavior.cy.ts b/packages/driver/cypress/e2e/e2e/origin/cookie_behavior.cy.ts index 626e4f8a3a56..9606f7fe3ea3 100644 --- a/packages/driver/cypress/e2e/e2e/origin/cookie_behavior.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/cookie_behavior.cy.ts @@ -815,6 +815,12 @@ describe('Cookie Behavior', { browser: '!webkit' }, () => { }) }) + // visiting http when there is a valid https site triggers Chrome's + // https-first mode, which causes the tests to hang because of a + // redirect loop + // https://github.com/cypress-io/cypress/issues/25891 + if (scheme === 'http') return + // without cy.origin means the AUT has the same origin as top describe('w/o cy.origin', () => { describe('same site / same origin', () => { diff --git a/packages/driver/cypress/e2e/e2e/origin/snapshots.cy.ts b/packages/driver/cypress/e2e/e2e/origin/snapshots.cy.ts index 644487783710..417d0cc29c85 100644 --- a/packages/driver/cypress/e2e/e2e/origin/snapshots.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/snapshots.cy.ts @@ -71,7 +71,7 @@ describe('cy.origin - snapshots', { browser: '!webkit' }, () => { }) cy.visit('/fixtures/primary-origin.html') - cy.get('a[data-cy="xhr-fetch-requests-onload"]').click() + cy.get('a[data-cy="xhr-fetch-requests-onload-https"]').click() }) // TODO: fix failing test: https://github.com/cypress-io/cypress/issues/23840 @@ -142,9 +142,9 @@ describe('cy.origin - snapshots', { browser: '!webkit' }, () => { done() }) - cy.visit('http://www.foobar.com:3500/fixtures/xhr-fetch-requests.html') + cy.visit('https://www.foobar.com:3502/fixtures/xhr-fetch-requests.html') - cy.origin('http://www.barbaz.com:3500', () => { + cy.origin('https://www.barbaz.com:3502', () => { // 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/validation.cy.ts b/packages/driver/cypress/e2e/e2e/origin/validation.cy.ts index 31b2879569b2..6b0c047fb497 100644 --- a/packages/driver/cypress/e2e/e2e/origin/validation.cy.ts +++ b/packages/driver/cypress/e2e/e2e/origin/validation.cy.ts @@ -189,10 +189,10 @@ describe('cy.origin', { browser: '!webkit' }, () => { it('finds the right spec bridge with a subdomain', () => { cy.visit('/fixtures/auth/index.html') cy.window().then((win) => { - win.location.href = 'http://baz.foobar.com:3500/fixtures/auth/idp.html' + win.location.href = `https://baz.foobar.com:3502/fixtures/auth/idp.html?redirect=${encodeURIComponent('http://localhost:3500/fixtures/auth/index.html')}` }) - cy.origin('http://baz.foobar.com:3500', () => { + cy.origin('https://baz.foobar.com:3502', () => { cy.get('[data-cy="username"]').type('TJohnson') cy.get('[data-cy="login"]').click() }) @@ -383,22 +383,22 @@ describe('cy.origin - external hosts', { browser: '!webkit' }, () => { describe('errors', () => { it('errors if the url param is same superDomainOrigin as top', (done) => { cy.on('fail', (err) => { - expect(err.message).to.include('`cy.origin()` requires the first argument to be a different domain than top. You passed `http://app.foobar.com` to the origin command, while top is at `http://www.foobar.com`.') + expect(err.message).to.include('`cy.origin()` requires the first argument to be a different domain than top. You passed `https://app.foobar.com` to the origin command, while top is at `https://www.foobar.com`.') done() }) - cy.intercept('http://www.foobar.com', { + cy.intercept('https://www.foobar.com', { body: '
', }) - cy.intercept('http://app.foobar.com', { + cy.intercept('https://app.foobar.com', { body: '
', }) - cy.visit('http://www.foobar.com') + cy.visit('https://www.foobar.com') - cy.origin('http://app.foobar.com', () => undefined) + cy.origin('https://app.foobar.com', () => undefined) }) it('errors if the url param is same origin as top', (done) => { diff --git a/packages/driver/cypress/fixtures/auth/approval.html b/packages/driver/cypress/fixtures/auth/approval.html index 744924c73521..6fd00aeb207e 100644 --- a/packages/driver/cypress/fixtures/auth/approval.html +++ b/packages/driver/cypress/fixtures/auth/approval.html @@ -48,11 +48,11 @@ const redirectHref = getRedirectHref() - window.location.href = `http://www.idp.com:3500/fixtures/auth/idp.html?redirect=${encodeURIComponent(redirectHref)}` + window.location.href = `https://www.idp.com:3502/fixtures/auth/idp.html?redirect=${encodeURIComponent(redirectHref)}` }) document.querySelector('[data-cy="approve-me"]').addEventListener('click', () => { - window.location.href = `http://www.idp.com:3500/fixtures/auth/idp.html?redirect=${encodeURIComponent(window.location.href)}` + window.location.href = `https://www.idp.com:3502/fixtures/auth/idp.html?redirect=${encodeURIComponent(window.location.href)}` })