-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(webkit): fix multidomain driver tests in WebKit #23442
Changes from all commits
5b5ea12
91678a8
49c74a6
e686ab4
e70fed9
382ad34
206cbd8
b03269c
7754402
d6c5f45
32ceeba
cd1a90c
bb45506
1dc9554
8ab2e61
0d4d603
774da85
2106204
9e20c9d
297e41b
173de9f
e493600
beb3f2d
4957a83
c255548
b01e8c0
ce15192
8bd49f3
8e8f62a
501895a
5e74399
d25b9e0
9b8cfbe
c1b1790
a7f6d4b
e3b1979
c3f6915
e8e2b7e
b6d4471
ce0a27f
e41dd70
645a8d7
059748b
84554e4
2b9f33f
115a07c
4ad2279
a449c8f
2468f9f
d38ae27
47adf21
ed4c1e3
308b53d
31391b6
a432bdd
1b5737a
0d19622
e985d24
822aa81
b0a31aa
18af289
f8ca723
0453a4b
bd16d86
bbe5a5f
55e9aa3
b221942
6f12700
61435ba
49b7f87
45479f6
4a0bd08
9319e2b
bf01ddd
3ceef39
f33b059
1184ced
60ea312
3a4c626
6f24105
c061c36
accee35
c65bb98
0e12b7c
d529605
9708b6a
2cf865a
5ec433e
55f07ec
efa7746
4225f21
a6689ea
f1b4451
faa58dc
450a77e
1d94e23
492e162
95f127b
54a1d03
cfc918c
46bea43
2eea718
5c3b8be
d926025
d3085db
481f87c
c9fd23f
9547bf0
bcf97be
175647e
c9c8196
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,25 @@ const { assertLogLength } = require('../../support/utils') | |
const { stripIndent } = require('common-tags') | ||
const { Promise } = Cypress | ||
|
||
describe('src/cy/commands/cookies - no stub', () => { | ||
it('clears all cookies', () => { | ||
cy.setCookie('foo', 'bar') | ||
cy.getCookies().should('have.length', 1) | ||
cy.clearCookies() | ||
cy.getCookies().should('have.length', 0) | ||
}) | ||
|
||
it('clears a single cookie', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the behavior when you clear a specific cookie and it does not exist? |
||
cy.setCookie('foo', 'bar') | ||
cy.setCookie('key', 'val') | ||
cy.getCookies().should('have.length', 2) | ||
cy.clearCookie('foo') | ||
cy.getCookies().should('have.length', 1).then((cookies) => { | ||
expect(cookies[0].name).to.eq('key') | ||
}) | ||
}) | ||
}) | ||
|
||
describe('src/cy/commands/cookies', () => { | ||
beforeEach(() => { | ||
// call through normally on everything | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,27 @@ const clearAllSavedSessions = () => { | |
}) | ||
} | ||
|
||
// In webkit, the clear page and clear cookies, etc log messages may be reversed. This isn't an issue, but we just want to test we have both messages. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we know why this is the case? The clear page should be awaited before clearing cookies. await navigateAboutBlank()
await sessions.clearCurrentSessionData() There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My assumption is that it is a timing issue with the logs and that we don't await every action in navigateAboutBlank() |
||
const validateClearLogs = (logs, sessionGroupId) => { | ||
let clearPageLogIndex = 0 | ||
let clearCookiesIndex = 1 | ||
|
||
if (logs[1].get('name') === 'Clear page') { | ||
clearPageLogIndex = 1 | ||
clearCookiesIndex = 0 | ||
} | ||
|
||
expect(logs[clearPageLogIndex].get()).to.contain({ | ||
name: 'Clear page', | ||
group: sessionGroupId, | ||
}) | ||
|
||
expect(logs[clearCookiesIndex].get()).to.contain({ | ||
displayName: 'Clear cookies, localStorage and sessionStorage', | ||
group: sessionGroupId, | ||
}) | ||
} | ||
|
||
describe('cy.session', { retries: 0 }, () => { | ||
describe('args', () => { | ||
it('accepts string as id', () => { | ||
|
@@ -200,15 +221,7 @@ describe('cy.session', { retries: 0 }, () => { | |
}, | ||
}) | ||
|
||
expect(logs[1].get()).to.contain({ | ||
name: 'Clear page', | ||
group: sessionGroupId, | ||
}) | ||
|
||
expect(logs[2].get()).to.contain({ | ||
displayName: 'Clear cookies, localStorage and sessionStorage', | ||
group: sessionGroupId, | ||
}) | ||
validateClearLogs([logs[1], logs[2]], sessionGroupId) | ||
|
||
const createNewSessionGroup = logs[3].get() | ||
|
||
|
@@ -282,15 +295,7 @@ describe('cy.session', { retries: 0 }, () => { | |
}, | ||
}) | ||
|
||
expect(logs[1].get()).to.contain({ | ||
name: 'Clear page', | ||
group: sessionGroupId, | ||
}) | ||
|
||
expect(logs[2].get()).to.contain({ | ||
displayName: 'Clear cookies, localStorage and sessionStorage', | ||
group: sessionGroupId, | ||
}) | ||
validateClearLogs([logs[1], logs[2]], sessionGroupId) | ||
|
||
const createNewSessionGroup = logs[3].get() | ||
|
||
|
@@ -344,15 +349,7 @@ describe('cy.session', { retries: 0 }, () => { | |
}, | ||
}) | ||
|
||
expect(logs[1].get()).to.contain({ | ||
name: 'Clear page', | ||
group: sessionGroupId, | ||
}) | ||
|
||
expect(logs[2].get()).to.contain({ | ||
displayName: 'Clear cookies, localStorage and sessionStorage', | ||
group: sessionGroupId, | ||
}) | ||
validateClearLogs([logs[1], logs[2]], sessionGroupId) | ||
|
||
const createNewSessionGroup = logs[3].get() | ||
|
||
|
@@ -437,15 +434,7 @@ describe('cy.session', { retries: 0 }, () => { | |
}, | ||
}) | ||
|
||
expect(logs[1].get()).to.contain({ | ||
name: 'Clear page', | ||
group: sessionGroupId, | ||
}) | ||
|
||
expect(logs[2].get()).to.contain({ | ||
displayName: 'Clear cookies, localStorage and sessionStorage', | ||
group: sessionGroupId, | ||
}) | ||
validateClearLogs([logs[1], logs[2]], sessionGroupId) | ||
|
||
const restoreSavedSessionGroup = logs[3].get() | ||
|
||
|
@@ -500,15 +489,7 @@ describe('cy.session', { retries: 0 }, () => { | |
}, | ||
}) | ||
|
||
expect(logs[1].get()).to.contain({ | ||
name: 'Clear page', | ||
group: sessionGroupId, | ||
}) | ||
|
||
expect(logs[2].get()).to.contain({ | ||
displayName: 'Clear cookies, localStorage and sessionStorage', | ||
group: sessionGroupId, | ||
}) | ||
validateClearLogs([logs[1], logs[2]], sessionGroupId) | ||
|
||
const restoreSavedSessionGroup = logs[3].get() | ||
|
||
|
@@ -582,15 +563,7 @@ describe('cy.session', { retries: 0 }, () => { | |
}, | ||
}) | ||
|
||
expect(logs[1].get()).to.contain({ | ||
name: 'Clear page', | ||
group: sessionGroupId, | ||
}) | ||
|
||
expect(logs[2].get()).to.contain({ | ||
displayName: 'Clear cookies, localStorage and sessionStorage', | ||
group: sessionGroupId, | ||
}) | ||
validateClearLogs([logs[1], logs[2]], sessionGroupId) | ||
|
||
const restoreSavedSessionGroup = logs[3].get() | ||
|
||
|
@@ -618,15 +591,7 @@ describe('cy.session', { retries: 0 }, () => { | |
|
||
expect(logs[6].get('error').message).to.eq('Your `cy.session` **validate** callback returned false.') | ||
|
||
expect(logs[7].get()).to.contain({ | ||
name: 'Clear page', | ||
group: sessionGroupId, | ||
}) | ||
|
||
expect(logs[8].get()).to.contain({ | ||
displayName: 'Clear cookies, localStorage and sessionStorage', | ||
group: sessionGroupId, | ||
}) | ||
validateClearLogs([logs[7], logs[8]], sessionGroupId) | ||
|
||
const createNewSessionGroup = logs[9].get() | ||
|
||
|
@@ -692,15 +657,7 @@ describe('cy.session', { retries: 0 }, () => { | |
}, | ||
}) | ||
|
||
expect(logs[1].get()).to.contain({ | ||
name: 'Clear page', | ||
group: sessionGroupId, | ||
}) | ||
|
||
expect(logs[2].get()).to.contain({ | ||
displayName: 'Clear cookies, localStorage and sessionStorage', | ||
group: sessionGroupId, | ||
}) | ||
validateClearLogs([logs[1], logs[2]], sessionGroupId) | ||
|
||
const restoreSavedSessionGroup = logs[3].get() | ||
|
||
|
@@ -728,15 +685,7 @@ describe('cy.session', { retries: 0 }, () => { | |
|
||
expect(logs[6].get('error').message).to.eq('Your `cy.session` **validate** callback returned false.') | ||
|
||
expect(logs[7].get()).to.contain({ | ||
name: 'Clear page', | ||
group: sessionGroupId, | ||
}) | ||
|
||
expect(logs[8].get()).to.contain({ | ||
displayName: 'Clear cookies, localStorage and sessionStorage', | ||
group: sessionGroupId, | ||
}) | ||
validateClearLogs([logs[7], logs[8]], sessionGroupId) | ||
|
||
const createNewSessionGroup = logs[9].get() | ||
|
||
|
@@ -1046,7 +995,10 @@ describe('cy.session', { retries: 0 }, () => { | |
cy.once('fail', (err) => { | ||
expect(err.message).contain('Expected to find element: `#does_not_exist`') | ||
expect(err.message).contain(errorHookMessage) | ||
expect(err.codeFrame).exist | ||
// TODO: Webkit does not have correct stack traces on errors currently | ||
if (Cypress.isBrowser('!webkit')) { | ||
expect(err.codeFrame).exist | ||
} | ||
|
||
done() | ||
}) | ||
|
@@ -1064,7 +1016,11 @@ describe('cy.session', { retries: 0 }, () => { | |
cy.once('fail', (err) => { | ||
expect(err.message).contain('validate error') | ||
expect(err.message).contain(errorHookMessage) | ||
expect(err.codeFrame).exist | ||
// TODO: Webkit does not have correct stack traces on errors currently | ||
if (Cypress.isBrowser('!webkit')) { | ||
expect(err.codeFrame).exist | ||
} | ||
|
||
done() | ||
}) | ||
|
||
|
@@ -1081,7 +1037,10 @@ describe('cy.session', { retries: 0 }, () => { | |
cy.once('fail', (err) => { | ||
expect(err.message).contain('validate error') | ||
expect(err.message).contain(errorHookMessage) | ||
expect(err.codeFrame).exist | ||
// TODO: Webkit does not have correct stack traces on errors currently | ||
if (Cypress.isBrowser('!webkit')) { | ||
expect(err.codeFrame).exist | ||
} | ||
|
||
done() | ||
}) | ||
|
@@ -1099,7 +1058,10 @@ describe('cy.session', { retries: 0 }, () => { | |
cy.once('fail', (err) => { | ||
expect(err.message).to.contain('Your `cy.session` **validate** callback returned false.') | ||
expect(err.message).contain(errorHookMessage) | ||
expect(err.codeFrame).exist | ||
// TODO: Webkit does not have correct stack traces on errors currently | ||
if (Cypress.isBrowser('!webkit')) { | ||
expect(err.codeFrame).exist | ||
} | ||
|
||
done() | ||
}) | ||
|
@@ -1117,7 +1079,11 @@ describe('cy.session', { retries: 0 }, () => { | |
cy.once('fail', (err) => { | ||
expect(err.message).to.contain('Your `cy.session` **validate** callback resolved false.') | ||
expect(err.message).contain(errorHookMessage) | ||
expect(err.codeFrame).exist | ||
// TODO: Webkit does not have correct stack traces on errors currently | ||
if (Cypress.isBrowser('!webkit')) { | ||
expect(err.codeFrame).exist | ||
} | ||
|
||
done() | ||
}) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
describe('basic login', () => { | ||
describe('basic login', { browser: '!webkit' }, () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Skipping cy.origin tests for webkit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a github issue to track on enabling all of these tests in webkit? I just want to make sure nothing gets lost in the shuffle There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, here is the issue for enabling cy.origin for webkit #23799 |
||
// 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', () => { | ||
|
@@ -148,7 +148,7 @@ describe('basic login', () => { | |
}) | ||
}) | ||
|
||
describe('Multi-step Auth', () => { | ||
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') | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉