mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-22 15:12:27 -05:00
chore: (multi-domain) renaming flag to experimentalSessionAndOrigin (#21053)
This commit is contained in:
@@ -253,10 +253,10 @@
|
||||
"default": false,
|
||||
"description": "Allows listening to the `before:run`, `after:run`, `before:spec`, and `after:spec` events in the plugins file during interactive mode."
|
||||
},
|
||||
"experimentalLoginFlows": {
|
||||
"experimentalSessionAndOrigin": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Enables cross-origin login flows, including the `cy.origin` and `cy.session` commands."
|
||||
"description": "Enables cross-origin and improved session support, including the `cy.origin` and `cy.session` commands."
|
||||
},
|
||||
"experimentalSourceRewriting": {
|
||||
"type": "boolean",
|
||||
|
||||
Vendored
+3
-3
@@ -1055,7 +1055,7 @@ declare namespace Cypress {
|
||||
/**
|
||||
* Save/Restore browser Cookies, LocalStorage, and SessionStorage data resulting from the supplied `setup` function.
|
||||
*
|
||||
* Only available if the `experimentalLoginFlows` config option is enabled.
|
||||
* Only available if the `experimentalSessionAndOrigin` config option is enabled.
|
||||
*
|
||||
* @see https://on.cypress.io/session
|
||||
*/
|
||||
@@ -2841,10 +2841,10 @@ declare namespace Cypress {
|
||||
*/
|
||||
experimentalInteractiveRunEvents: boolean
|
||||
/**
|
||||
* Enables cross-origin login flows, including the `cy.origin` and `cy.session` commands.
|
||||
* Enables cross-origin and improved session support, including the `cy.origin` and `cy.session` commands.
|
||||
* @default false
|
||||
*/
|
||||
experimentalLoginFlows: boolean
|
||||
experimentalSessionAndOrigin: boolean
|
||||
/**
|
||||
* Generate and save commands directly to your test suite by interacting with your app as an end user would.
|
||||
* @default false
|
||||
|
||||
@@ -26,7 +26,7 @@ exports['config/lib/index .getDefaultValues returns list of public config keys 1
|
||||
"execTimeout": 60000,
|
||||
"experimentalFetchPolyfill": false,
|
||||
"experimentalInteractiveRunEvents": false,
|
||||
"experimentalLoginFlows": false,
|
||||
"experimentalSessionAndOrigin": false,
|
||||
"experimentalSourceRewriting": false,
|
||||
"experimentalStudio": false,
|
||||
"fileServerFolder": "",
|
||||
@@ -102,7 +102,7 @@ exports['config/lib/index .getPublicConfigKeys returns list of public config key
|
||||
"execTimeout",
|
||||
"experimentalFetchPolyfill",
|
||||
"experimentalInteractiveRunEvents",
|
||||
"experimentalLoginFlows",
|
||||
"experimentalSessionAndOrigin",
|
||||
"experimentalSourceRewriting",
|
||||
"experimentalStudio",
|
||||
"fileServerFolder",
|
||||
|
||||
@@ -153,7 +153,7 @@ const resolvedOptions: Array<ResolvedConfigOption> = [
|
||||
isExperimental: true,
|
||||
canUpdateDuringTestTime: false,
|
||||
}, {
|
||||
name: 'experimentalLoginFlows',
|
||||
name: 'experimentalSessionAndOrigin',
|
||||
defaultValue: false,
|
||||
validation: validate.isBoolean,
|
||||
isExperimental: true,
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
"runMode": 2,
|
||||
"openMode": 0
|
||||
},
|
||||
"experimentalLoginFlows": true
|
||||
"experimentalSessionAndOrigin": true
|
||||
}
|
||||
|
||||
@@ -2284,7 +2284,7 @@ describe('src/cy/commands/navigation', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('waits for stability at the end of the command queue when not stable', { experimentalLoginFlows: false }, (done) => {
|
||||
it('waits for stability at the end of the command queue when not stable', { experimentalSessionAndOrigin: false }, (done) => {
|
||||
cy
|
||||
.visit('/fixtures/generic.html')
|
||||
.then((win) => {
|
||||
@@ -2307,7 +2307,7 @@ describe('src/cy/commands/navigation', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('does not wait for stability at the end of the command queue when not stable with experimentalLoginFlows', (done) => {
|
||||
it('does not wait for stability at the end of the command queue when not stable with experimentalSessionAndOrigin', (done) => {
|
||||
const onLoad = cy.spy()
|
||||
|
||||
cy
|
||||
|
||||
+2
-2
@@ -205,11 +205,11 @@ context('cy.origin navigation', () => {
|
||||
})
|
||||
|
||||
// @ts-ignore
|
||||
it('informs user to use cy.origin with experimental flag off', { experimentalLoginFlows: false }, (done) => {
|
||||
it('informs user to use cy.origin with experimental flag off', { experimentalSessionAndOrigin: false }, (done) => {
|
||||
cy.on('fail', (e) => {
|
||||
expect(e.message).to.equal(stripIndent`\
|
||||
\`cy.visit()\` failed because you are attempting to visit a URL that is of a different origin.\n
|
||||
In order to visit a different origin, you can enable the \`experimentalLoginFlows\` flag and use \`cy.origin()\`:\n
|
||||
In order to visit a different origin, you can enable the \`experimentalSessionAndOrigin\` flag and use \`cy.origin()\`:\n
|
||||
\`cy.visit('http://localhost:3500/fixtures/multi-domain.html')\`
|
||||
\`<other commands targeting http://localhost:3500 go here>\`\n
|
||||
\`cy.origin('http://foobar.com:3500', () => {\`
|
||||
|
||||
+2
-2
@@ -245,9 +245,9 @@ describe('cy.origin', () => {
|
||||
|
||||
describe('errors', () => {
|
||||
// @ts-ignore
|
||||
it('errors if experimental flag is not enabled', { experimentalLoginFlows: false }, (done) => {
|
||||
it('errors if experimental flag is not enabled', { experimentalSessionAndOrigin: false }, (done) => {
|
||||
cy.on('fail', (err) => {
|
||||
expect(err.message).to.equal('`cy.origin()` requires enabling the experimentalLoginFlows flag')
|
||||
expect(err.message).to.equal('`cy.origin()` requires enabling the experimentalSessionAndOrigin flag')
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
@@ -158,7 +158,7 @@ export default function (Commands, Cypress, cy, state, config) {
|
||||
// stuff, or handling this in the runner itself?
|
||||
// Cypress sessions will clear cookies on its own before each test
|
||||
Cypress.on('test:before:run:async', () => {
|
||||
if (!Cypress.config('experimentalLoginFlows')) {
|
||||
if (!Cypress.config('experimentalSessionAndOrigin')) {
|
||||
return getAndClear()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -112,7 +112,7 @@ const cannotVisitDifferentOrigin = ({ remote, existing, previousUrlVisited, log,
|
||||
previousUrl: previousUrlVisited,
|
||||
attemptedUrl: remote,
|
||||
isCrossOriginSpecBridge,
|
||||
experimentalLoginFlows: Cypress.config('experimentalLoginFlows'),
|
||||
experimentalSessionAndOrigin: Cypress.config('experimentalSessionAndOrigin'),
|
||||
},
|
||||
errProps: {
|
||||
isCrossOrigin: true,
|
||||
|
||||
@@ -289,7 +289,7 @@ export default function (Commands, Cypress, cy) {
|
||||
}
|
||||
|
||||
function throwIfNoSessionSupport () {
|
||||
if (!Cypress.config('experimentalLoginFlows')) {
|
||||
if (!Cypress.config('experimentalSessionAndOrigin')) {
|
||||
$errUtils.throwErrByPath('sessions.experimentNotEnabled', {
|
||||
args: {
|
||||
experimentalSessionSupport: Cypress.config('experimentalSessionSupport'),
|
||||
@@ -496,7 +496,7 @@ export default function (Commands, Cypress, cy) {
|
||||
|
||||
registerSessionHooks () {
|
||||
Cypress.on('test:before:run:async', () => {
|
||||
if (Cypress.config('experimentalLoginFlows')) {
|
||||
if (Cypress.config('experimentalSessionAndOrigin')) {
|
||||
currentTestRegisteredSessions.clear()
|
||||
|
||||
return navigateAboutBlank(false)
|
||||
|
||||
@@ -59,7 +59,7 @@ export function addCommands (Commands, Cypress: Cypress.Cypress, cy: Cypress.cy,
|
||||
// origin run, so it can't have its own timeout
|
||||
cy.clearTimeout()
|
||||
|
||||
if (!config('experimentalLoginFlows')) {
|
||||
if (!config('experimentalSessionAndOrigin')) {
|
||||
$errUtils.throwErrByPath('origin.experiment_not_enabled')
|
||||
}
|
||||
|
||||
|
||||
@@ -295,8 +295,8 @@ export class CommandQueue extends Queue<Command> {
|
||||
// trigger queue is almost finished
|
||||
Cypress.action('cy:command:queue:before:end')
|
||||
|
||||
// If we're enabled experimentalLoginFlows we no longer have to wait for stability at the end of the command queue.
|
||||
if (Cypress.config('experimentalLoginFlows')) {
|
||||
// If we're enabled experimentalSessionAndOrigin we no longer have to wait for stability at the end of the command queue.
|
||||
if (Cypress.config('experimentalSessionAndOrigin')) {
|
||||
Cypress.action('cy:command:queue:end')
|
||||
|
||||
return null
|
||||
|
||||
@@ -569,7 +569,7 @@ export class $Cy extends EventEmitter2 implements ITimeouts, IStability, IAssert
|
||||
// With cross-origin support, this is an expected error that may or may
|
||||
// not be bad, we will rely on the page load timeout to throw if we
|
||||
// don't end up where we expect to be.
|
||||
if (this.config('experimentalLoginFlows') && err.name === 'SecurityError') {
|
||||
if (this.config('experimentalSessionAndOrigin') && err.name === 'SecurityError') {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1137,7 +1137,7 @@ export default {
|
||||
origin: {
|
||||
docsUrl: 'https://on.cypress.io/origin',
|
||||
experiment_not_enabled: {
|
||||
message: `${cmd('origin')} requires enabling the experimentalLoginFlows flag`,
|
||||
message: `${cmd('origin')} requires enabling the experimentalSessionAndOrigin flag`,
|
||||
},
|
||||
invalid_url_argument: {
|
||||
message: `${cmd('origin')} requires the first argument to be either a url (\`https://www.example.com/path\`) or a domain name (\`example.com\`). Query parameters are not allowed. You passed: \`{{arg}}\``,
|
||||
@@ -1641,13 +1641,13 @@ export default {
|
||||
if (experimentalSessionSupport) {
|
||||
return {
|
||||
message: stripIndent`
|
||||
${cmd('session')} requires enabling the \`experimentalLoginFlows\` flag. The \`experimentalSessionSupport\` flag was enabled but was removed in Cypress version 9.6.0. Please see the migration guide for updating.`,
|
||||
${cmd('session')} requires enabling the \`experimentalSessionAndOrigin\` flag. The \`experimentalSessionSupport\` flag was enabled but was removed in Cypress version 9.6.0. Please see the migration guide for updating.`,
|
||||
docsUrl: 'https://on.cypress.io/migration-guide',
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
message: `${cmd('session')} requires enabling the \`experimentalLoginFlows\` flag`,
|
||||
message: `${cmd('session')} requires enabling the \`experimentalSessionAndOrigin\` flag`,
|
||||
docsUrl: 'https://on.cypress.io/session',
|
||||
}
|
||||
},
|
||||
@@ -2100,7 +2100,7 @@ export default {
|
||||
message: stripIndent`\
|
||||
${cmd('visit')} failed because you are attempting to visit a URL that is of a different origin.
|
||||
|
||||
${args.experimentalLoginFlows ? `You likely forgot to use ${cmd('origin')}:` : `In order to visit a different origin, you can enable the \`experimentalLoginFlows\` flag and use ${cmd('origin')}:` }
|
||||
${args.experimentalSessionAndOrigin ? `You likely forgot to use ${cmd('origin')}:` : `In order to visit a different origin, you can enable the \`experimentalSessionAndOrigin\` flag and use ${cmd('origin')}:` }
|
||||
|
||||
${args.isCrossOriginSpecBridge ?
|
||||
`\`cy.origin('${args.previousUrl.originPolicy}', () => {\`
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body><pre><span style="color:#e05561">The <span style="color:#e5e510">experimentalSessionSupport<span style="color:#e05561"> configuration option was removed in Cypress version 9.6.0 and replaced with <span style="color:#e5e510">experimentalLoginFlows<span style="color:#e05561">. Please update your config to use <span style="color:#e5e510">experimentalLoginFlows<span style="color:#e05561"> instead.<span style="color:#e6e6e6">
|
||||
<body><pre><span style="color:#e05561">The <span style="color:#e5e510">experimentalSessionSupport<span style="color:#e05561"> configuration option was removed in Cypress version 9.6.0 and replaced with <span style="color:#e5e510">experimentalSessionAndOrigin<span style="color:#e05561">. Please update your config to use <span style="color:#e5e510">experimentalSessionAndOrigin<span style="color:#e05561"> instead.<span style="color:#e6e6e6">
|
||||
<span style="color:#e05561"><span style="color:#e6e6e6">
|
||||
<span style="color:#e05561">https://on.cypress.io/migration-guide<span style="color:#e6e6e6"></span></span></span></span></span></span></span></span></span></span></span></span>
|
||||
</pre></body></html>
|
||||
@@ -1052,7 +1052,7 @@ export const AllCypressErrors = {
|
||||
},
|
||||
EXPERIMENTAL_SESSION_SUPPORT_REMOVED: () => {
|
||||
return errTemplate`\
|
||||
The ${fmt.highlight(`experimentalSessionSupport`)} configuration option was removed in ${fmt.cypressVersion(`9.6.0`)} and replaced with ${fmt.highlight(`experimentalLoginFlows`)}. Please update your config to use ${fmt.highlight(`experimentalLoginFlows`)} instead.
|
||||
The ${fmt.highlight(`experimentalSessionSupport`)} configuration option was removed in ${fmt.cypressVersion(`9.6.0`)} and replaced with ${fmt.highlight(`experimentalSessionAndOrigin`)}. Please update your config to use ${fmt.highlight(`experimentalSessionAndOrigin`)} instead.
|
||||
|
||||
https://on.cypress.io/migration-guide`
|
||||
},
|
||||
|
||||
@@ -237,7 +237,7 @@ const MaybeDelayForCrossOrigin: ResponseMiddleware = function () {
|
||||
const isAUTFrame = this.req.isAUTFrame
|
||||
|
||||
// delay the response if this is a cross-origin (and not returning to a previous origin) html request from the AUT iframe
|
||||
if (this.config.experimentalLoginFlows && isCrossOrigin && !isPreviousOrigin && isAUTFrame && (isHTML || isRenderedHTML)) {
|
||||
if (this.config.experimentalSessionAndOrigin && isCrossOrigin && !isPreviousOrigin && isAUTFrame && (isHTML || isRenderedHTML)) {
|
||||
this.debug('is cross-origin, delay until ready:for:origin event')
|
||||
|
||||
this.serverBus.once('ready:for:origin', ({ failed }) => {
|
||||
@@ -281,7 +281,7 @@ const SetInjectionLevel: ResponseMiddleware = function () {
|
||||
const isHTML = resContentTypeIs(this.incomingRes, 'text/html')
|
||||
const isAUTFrame = this.req.isAUTFrame
|
||||
|
||||
if (this.config.experimentalLoginFlows && isSecondaryOrigin && isAUTFrame && (isHTML || isRenderedHTML)) {
|
||||
if (this.config.experimentalSessionAndOrigin && isSecondaryOrigin && isAUTFrame && (isHTML || isRenderedHTML)) {
|
||||
this.debug('- cross origin injection')
|
||||
|
||||
return 'fullCrossOrigin'
|
||||
@@ -457,7 +457,7 @@ const CopyCookiesFromIncomingRes: ResponseMiddleware = function () {
|
||||
|
||||
if (cookies) {
|
||||
const needsCrossOriginHandling = (
|
||||
this.config.experimentalLoginFlows
|
||||
this.config.experimentalSessionAndOrigin
|
||||
&& determineIfNeedsCrossOriginHandling(this)
|
||||
)
|
||||
const browser = this.getCurrentBrowser() || { family: null }
|
||||
|
||||
@@ -158,7 +158,7 @@ describe('http/response-middleware', function () {
|
||||
})
|
||||
})
|
||||
|
||||
it('doesn\'t do anything when "experimentalLoginFlows" config flag is not set to true"', function () {
|
||||
it('doesn\'t do anything when "experimentalSessionAndOrigin" config flag is not set to true"', function () {
|
||||
prepareContext({
|
||||
incomingRes: {
|
||||
headers: {
|
||||
@@ -186,7 +186,7 @@ describe('http/response-middleware', function () {
|
||||
},
|
||||
secondaryOrigins: ['http://foobar.com', 'http://example.com'],
|
||||
config: {
|
||||
experimentalLoginFlows: true,
|
||||
experimentalSessionAndOrigin: true,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -209,7 +209,7 @@ describe('http/response-middleware', function () {
|
||||
},
|
||||
secondaryOrigins: ['http://foobar.com', 'http://example.com'],
|
||||
config: {
|
||||
experimentalLoginFlows: true,
|
||||
experimentalSessionAndOrigin: true,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -234,7 +234,7 @@ describe('http/response-middleware', function () {
|
||||
proxiedUrl: 'http://www.foobar.com/test',
|
||||
},
|
||||
config: {
|
||||
experimentalLoginFlows: true,
|
||||
experimentalSessionAndOrigin: true,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -260,7 +260,7 @@ describe('http/response-middleware', function () {
|
||||
proxiedUrl: 'http://www.foobar.com/test',
|
||||
},
|
||||
config: {
|
||||
experimentalLoginFlows: true,
|
||||
experimentalSessionAndOrigin: true,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -286,7 +286,7 @@ describe('http/response-middleware', function () {
|
||||
},
|
||||
secondaryOrigins: ['http://foobar.com', 'http://example.com'],
|
||||
config: {
|
||||
experimentalLoginFlows: true,
|
||||
experimentalSessionAndOrigin: true,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -400,7 +400,7 @@ describe('http/response-middleware', function () {
|
||||
})
|
||||
})
|
||||
|
||||
it('doesn\'t inject anything when html does not match origin policy and "experimentalLoginFlows" config flag is NOT set to true', function () {
|
||||
it('doesn\'t inject anything when html does not match origin policy and "experimentalSessionAndOrigin" config flag is NOT set to true', function () {
|
||||
prepareContext({
|
||||
req: {
|
||||
proxiedUrl: 'http://foobar.com',
|
||||
@@ -421,7 +421,7 @@ describe('http/response-middleware', function () {
|
||||
})
|
||||
})
|
||||
|
||||
it('injects "fullCrossOrigin" when "experimentalLoginFlows" config flag is set to true for cross-origin html"', function () {
|
||||
it('injects "fullCrossOrigin" when "experimentalSessionAndOrigin" config flag is set to true for cross-origin html"', function () {
|
||||
prepareContext({
|
||||
req: {
|
||||
proxiedUrl: 'http://foobar.com',
|
||||
@@ -436,7 +436,7 @@ describe('http/response-middleware', function () {
|
||||
},
|
||||
secondaryOrigins: ['http://foobar.com'],
|
||||
config: {
|
||||
experimentalLoginFlows: true,
|
||||
experimentalSessionAndOrigin: true,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -461,7 +461,7 @@ describe('http/response-middleware', function () {
|
||||
},
|
||||
secondaryOrigins: ['http://example.com', 'http://foobar.com'],
|
||||
config: {
|
||||
experimentalLoginFlows: true,
|
||||
experimentalSessionAndOrigin: true,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -547,7 +547,7 @@ describe('http/response-middleware', function () {
|
||||
},
|
||||
secondaryOrigins: ['http://foobar.com'],
|
||||
config: {
|
||||
experimentalLoginFlows: true,
|
||||
experimentalSessionAndOrigin: true,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -814,7 +814,7 @@ describe('http/response-middleware', function () {
|
||||
append: appendStub,
|
||||
},
|
||||
config: {
|
||||
experimentalLoginFlows: false,
|
||||
experimentalSessionAndOrigin: false,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -938,7 +938,7 @@ describe('http/response-middleware', function () {
|
||||
},
|
||||
},
|
||||
config: {
|
||||
experimentalLoginFlows: true,
|
||||
experimentalSessionAndOrigin: true,
|
||||
},
|
||||
getCurrentBrowser () {
|
||||
return { family: 'chromium' }
|
||||
|
||||
@@ -211,7 +211,7 @@ export const sessionLifecycle = () => {
|
||||
<div class='container'>
|
||||
${svg_cy}
|
||||
<br/>
|
||||
<p class="warn">Because <code><b>experimentalLoginFlows</b></code> is enabled, Cypress navigates to the default blank page <span class="em">before each test</span> to ensure test reliability.</p>
|
||||
<p class="warn">Because <code><b>experimentalSessionAndOrigin</b></code> is enabled, Cypress navigates to the default blank page <span class="em">before each test</span> to ensure test reliability.</p>
|
||||
<p>This is the default blank page.</p>
|
||||
<p>To test your web application:</p>
|
||||
<ul>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const helpers = require('../support/helpers')
|
||||
|
||||
const { runIsolatedCypress } = helpers.createCypress({ config: { experimentalLoginFlows: true } })
|
||||
const { runIsolatedCypress } = helpers.createCypress({ config: { experimentalSessionAndOrigin: true } })
|
||||
|
||||
describe('runner/cypress sessions.ui.spec', { viewportWidth: 1000, viewportHeight: 660 }, () => {
|
||||
it('empty session with no data', () => {
|
||||
|
||||
@@ -180,18 +180,18 @@ export interface CdpOptions {
|
||||
sendDebuggerCommandFn: SendDebuggerCommand
|
||||
onFn: OnFn
|
||||
automation: Automation
|
||||
experimentalLoginFlows: boolean
|
||||
experimentalSessionAndOrigin: boolean
|
||||
}
|
||||
|
||||
export class CdpAutomation {
|
||||
sendDebuggerCommandFn: SendDebuggerCommand
|
||||
automation: Automation
|
||||
experimentalLoginFlows: boolean
|
||||
experimentalSessionAndOrigin: boolean
|
||||
|
||||
constructor (options: CdpOptions) {
|
||||
this.sendDebuggerCommandFn = options.sendDebuggerCommandFn
|
||||
this.automation = options.automation
|
||||
this.experimentalLoginFlows = options.experimentalLoginFlows
|
||||
this.experimentalSessionAndOrigin = options.experimentalSessionAndOrigin
|
||||
|
||||
options.onFn('Network.requestWillBeSent', this.onNetworkRequestWillBeSent)
|
||||
options.onFn('Network.responseReceived', this.onResponseReceived)
|
||||
@@ -263,7 +263,7 @@ export class CdpAutomation {
|
||||
// be sent with a request. This standardizes it by filtering out ones
|
||||
// that are secure but not on a secure context
|
||||
|
||||
if (this.experimentalLoginFlows) {
|
||||
if (this.experimentalSessionAndOrigin) {
|
||||
// localhost is considered a secure context (even when http:)
|
||||
// and it's required for cross origin support when visiting a secondary
|
||||
// origin so that all its cookies are sent. This may be a
|
||||
|
||||
@@ -439,7 +439,7 @@ const _setAutomation = async (client, automation, options) => {
|
||||
sendDebuggerCommandFn: client.send,
|
||||
onFn: client.on,
|
||||
automation,
|
||||
experimentalLoginFlows: options.experimentalLoginFlows,
|
||||
experimentalSessionAndOrigin: options.experimentalSessionAndOrigin,
|
||||
})
|
||||
|
||||
await cdpAutomation.enable()
|
||||
|
||||
@@ -55,7 +55,7 @@ const _getAutomation = async function (win, options, parent) {
|
||||
sendDebuggerCommandFn: sendCommand,
|
||||
onFn: on,
|
||||
automation: parent,
|
||||
experimentalLoginFlows: options.experimentalLoginFlows,
|
||||
experimentalSessionAndOrigin: options.experimentalSessionAndOrigin,
|
||||
})
|
||||
|
||||
await automation.enable()
|
||||
|
||||
@@ -108,7 +108,7 @@ async function setupRemote (remotePort, automation, options) {
|
||||
sendDebuggerCommandFn: criClient.send,
|
||||
onFn: criClient.on,
|
||||
automation,
|
||||
experimentalLoginFlows: options.experimentalLoginFlows,
|
||||
experimentalSessionAndOrigin: options.experimentalSessionAndOrigin,
|
||||
})
|
||||
|
||||
await cdpAutomation.enable()
|
||||
|
||||
@@ -53,7 +53,7 @@ interface StringValues {
|
||||
const _summaries: StringValues = {
|
||||
experimentalFetchPolyfill: 'Polyfills `window.fetch` to enable Network spying and stubbing.',
|
||||
experimentalInteractiveRunEvents: 'Allows listening to the `before:run`, `after:run`, `before:spec`, and `after:spec` events in the plugins file during interactive mode.',
|
||||
experimentalLoginFlows: 'Enables cross-origin login flows, including the `cy.origin` and `cy.session` commands.',
|
||||
experimentalSessionAndOrigin: 'Enables cross-origin and improved session support, including the `cy.origin` and `cy.session` commands.',
|
||||
experimentalSourceRewriting: 'Enables AST-based JS/HTML rewriting. This may fix issues caused by the existing regex-based JS/HTML replacement algorithm.',
|
||||
experimentalStudio: 'Generate and save commands directly to your test suite by interacting with your app as an end user would.',
|
||||
}
|
||||
@@ -71,7 +71,7 @@ const _summaries: StringValues = {
|
||||
const _names: StringValues = {
|
||||
experimentalFetchPolyfill: 'Fetch Polyfill',
|
||||
experimentalInteractiveRunEvents: 'Interactive Mode Run Events',
|
||||
experimentalLoginFlows: 'Login Flows',
|
||||
experimentalSessionAndOrigin: 'Login Flows',
|
||||
experimentalSourceRewriting: 'Improved Source Rewriting',
|
||||
experimentalStudio: 'Studio',
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ export class OpenProject {
|
||||
chromeWebSecurity: cfg.chromeWebSecurity,
|
||||
isTextTerminal: cfg.isTextTerminal,
|
||||
downloadsFolder: cfg.downloadsFolder,
|
||||
experimentalLoginFlows: cfg.experimentalLoginFlows,
|
||||
experimentalSessionAndOrigin: cfg.experimentalSessionAndOrigin,
|
||||
})
|
||||
|
||||
// if we don't have the isHeaded property
|
||||
|
||||
@@ -39,7 +39,7 @@ import type { LaunchArgs } from './open_project'
|
||||
// and are required when creating a project.
|
||||
type ReceivedCypressOptions =
|
||||
Pick<Cypress.RuntimeConfigOptions, 'hosts' | 'projectName' | 'clientRoute' | 'devServerPublicPathRoute' | 'namespace' | 'report' | 'socketIoCookie' | 'configFile' | 'isTextTerminal' | 'isNewProject' | 'proxyUrl' | 'browsers' | 'browserUrl' | 'socketIoRoute' | 'arch' | 'platform' | 'spec' | 'specs' | 'browser' | 'version' | 'remote'>
|
||||
& Pick<Cypress.ResolvedConfigOptions, 'chromeWebSecurity' | 'supportFolder' | 'experimentalSourceRewriting' | 'fixturesFolder' | 'reporter' | 'reporterOptions' | 'screenshotsFolder' | 'pluginsFile' | 'supportFile' | 'integrationFolder' | 'baseUrl' | 'viewportHeight' | 'viewportWidth' | 'port' | 'experimentalInteractiveRunEvents' | 'componentFolder' | 'userAgent' | 'downloadsFolder' | 'env' | 'testFiles' | 'ignoreTestFiles' | 'experimentalLoginFlows'> // TODO: Figure out how to type this better.
|
||||
& Pick<Cypress.ResolvedConfigOptions, 'chromeWebSecurity' | 'supportFolder' | 'experimentalSourceRewriting' | 'fixturesFolder' | 'reporter' | 'reporterOptions' | 'screenshotsFolder' | 'pluginsFile' | 'supportFile' | 'integrationFolder' | 'baseUrl' | 'viewportHeight' | 'viewportWidth' | 'port' | 'experimentalInteractiveRunEvents' | 'componentFolder' | 'userAgent' | 'downloadsFolder' | 'env' | 'testFiles' | 'ignoreTestFiles' | 'experimentalSessionAndOrigin'> // TODO: Figure out how to type this better.
|
||||
|
||||
export interface Cfg extends ReceivedCypressOptions {
|
||||
projectRoot: string
|
||||
|
||||
@@ -76,7 +76,7 @@ context('lib/browsers/cdp_automation', () => {
|
||||
sendDebuggerCommandFn: this.sendDebuggerCommand,
|
||||
onFn: this.onFn,
|
||||
automation: {} as Automation,
|
||||
experimentalLoginFlows: false,
|
||||
experimentalSessionAndOrigin: false,
|
||||
})
|
||||
|
||||
await this.automation.enable()
|
||||
|
||||
@@ -1494,7 +1494,7 @@ describe('lib/config', () => {
|
||||
execTimeout: { value: 60000, from: 'default' },
|
||||
experimentalFetchPolyfill: { value: false, from: 'default' },
|
||||
experimentalInteractiveRunEvents: { value: false, from: 'default' },
|
||||
experimentalLoginFlows: { value: false, from: 'default' },
|
||||
experimentalSessionAndOrigin: { value: false, from: 'default' },
|
||||
experimentalSourceRewriting: { value: false, from: 'default' },
|
||||
experimentalStudio: { value: false, from: 'default' },
|
||||
fileServerFolder: { value: '', from: 'default' },
|
||||
@@ -1583,7 +1583,7 @@ describe('lib/config', () => {
|
||||
execTimeout: { value: 60000, from: 'default' },
|
||||
experimentalFetchPolyfill: { value: false, from: 'default' },
|
||||
experimentalInteractiveRunEvents: { value: false, from: 'default' },
|
||||
experimentalLoginFlows: { value: false, from: 'default' },
|
||||
experimentalSessionAndOrigin: { value: false, from: 'default' },
|
||||
experimentalSourceRewriting: { value: false, from: 'default' },
|
||||
experimentalStudio: { value: false, from: 'default' },
|
||||
env: {
|
||||
|
||||
@@ -9,7 +9,7 @@ exports['e2e cy.origin errors / captures the stack trace correctly for errors in
|
||||
│ Browser: FooBrowser 88 │
|
||||
│ Specs: 1 found (multi_domain_error_spec.ts) │
|
||||
│ Searched: cypress/integration/multi_domain_error_spec.ts │
|
||||
│ Experiments: experimentalLoginFlows=true │
|
||||
│ Experiments: experimentalSessionAndOrigin=true │
|
||||
└────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ exports['e2e cy.origin retries / Appropriately displays test retry errors withou
|
||||
│ Browser: FooBrowser 88 │
|
||||
│ Specs: 1 found (multi_domain_retries_spec.ts) │
|
||||
│ Searched: cypress/integration/multi_domain_retries_spec.ts │
|
||||
│ Experiments: experimentalLoginFlows=true │
|
||||
│ Experiments: experimentalSessionAndOrigin=true │
|
||||
└────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports['e2e cross origin navigation / captures cross origin failures when "experimentalLoginFlows" config value is falsy'] = `
|
||||
exports['e2e cross origin navigation / captures cross origin failures when "experimentalSessionAndOrigin" config value is falsy'] = `
|
||||
|
||||
====================================================================================================
|
||||
|
||||
@@ -9,7 +9,7 @@ exports['e2e cross origin navigation / captures cross origin failures when "expe
|
||||
│ Browser: FooBrowser 88 │
|
||||
│ Specs: 1 found (navigation_cross_origin_errors.ts) │
|
||||
│ Searched: cypress/integration/navigation_cross_origin_errors.ts │
|
||||
│ Experiments: experimentalLoginFlows=false │
|
||||
│ Experiments: experimentalSessionAndOrigin=false │
|
||||
└────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@ exports['e2e cross origin navigation / captures cross origin failures when "expe
|
||||
|
||||
|
||||
navigation cross origin errors
|
||||
1) displays cross origin failures when "experimentalLoginFlows" is turned off
|
||||
1) displays cross origin failures when "experimentalSessionAndOrigin" is turned off
|
||||
|
||||
|
||||
0 passing
|
||||
1 failing
|
||||
|
||||
1) navigation cross origin errors
|
||||
displays cross origin failures when "experimentalLoginFlows" is turned off:
|
||||
displays cross origin failures when "experimentalSessionAndOrigin" is turned off:
|
||||
CypressError: Cypress detected a cross origin error happened on page load:
|
||||
|
||||
> [Cross origin error message]
|
||||
@@ -69,8 +69,8 @@ https://on.cypress.io/cross-origin-violation
|
||||
(Screenshots)
|
||||
|
||||
- /XXX/XXX/XXX/cypress/screenshots/navigation_cross_origin_errors.ts/navigation cr (1280x720)
|
||||
oss origin errors -- displays cross origin failures when experimentalLoginFlows
|
||||
is turned off (failed).png
|
||||
oss origin errors -- displays cross origin failures when experimentalSessionAndO
|
||||
rigin is turned off (failed).png
|
||||
|
||||
|
||||
(Video)
|
||||
|
||||
@@ -35,7 +35,7 @@ exports['e2e runnable execution / cannot navigate in before hook and test'] = `
|
||||
causes domain navigation:
|
||||
CypressError: \`cy.visit()\` failed because you are attempting to visit a URL that is of a different origin.
|
||||
|
||||
In order to visit a different origin, you can enable the \`experimentalLoginFlows\` flag and use \`cy.origin()\`:
|
||||
In order to visit a different origin, you can enable the \`experimentalSessionAndOrigin\` flag and use \`cy.origin()\`:
|
||||
|
||||
\`cy.visit('http://localhost:4545/')\`
|
||||
\`<other commands targeting http://localhost:4545 go here>\`
|
||||
@@ -66,7 +66,7 @@ https://on.cypress.io/cannot-visit-different-origin-domain
|
||||
"before each" hook for "never gets here":
|
||||
CypressError: \`cy.visit()\` failed because you are attempting to visit a URL that is of a different origin.
|
||||
|
||||
In order to visit a different origin, you can enable the \`experimentalLoginFlows\` flag and use \`cy.origin()\`:
|
||||
In order to visit a different origin, you can enable the \`experimentalSessionAndOrigin\` flag and use \`cy.origin()\`:
|
||||
|
||||
\`cy.visit('http://localhost:4545/')\`
|
||||
\`<other commands targeting http://localhost:4545 go here>\`
|
||||
|
||||
@@ -9,7 +9,7 @@ exports['e2e sessions / session tests'] = `
|
||||
│ Browser: FooBrowser 88 │
|
||||
│ Specs: 1 found (session_spec.js) │
|
||||
│ Searched: cypress/integration/session_spec.js │
|
||||
│ Experiments: experimentalLoginFlows=true │
|
||||
│ Experiments: experimentalSessionAndOrigin=true │
|
||||
└────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ exports['e2e sessions / session tests'] = `
|
||||
✓ clears only secure context data - 2/2
|
||||
|
||||
errors
|
||||
✓ throws error when experimentalLoginFlows not enabled
|
||||
✓ throws error when experimentalSessionAndOrigin not enabled
|
||||
✓ throws error when experimentalSessionSupport is enabled through test config
|
||||
✓ throws error when experimentalSessionSupport is enabled through Cypress.config
|
||||
✓ throws if session has not been defined during current test
|
||||
@@ -171,7 +171,7 @@ exports['e2e sessions / sessions persist on reload, and clear between specs'] =
|
||||
│ Specs: 2 found (session_persist_spec_1.js, session_persist_spec_2.js) │
|
||||
│ Searched: cypress/integration/session_persist_spec_1.js, cypress/integration/session_persi │
|
||||
│ st_spec_2.js │
|
||||
│ Experiments: experimentalLoginFlows=true │
|
||||
│ Experiments: experimentalSessionAndOrigin=true │
|
||||
└────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
describe('navigation cross origin errors', () => {
|
||||
it('displays cross origin failures when "experimentalLoginFlows" is turned off', function () {
|
||||
it('displays cross origin failures when "experimentalSessionAndOrigin" is turned off', function () {
|
||||
// @ts-ignore
|
||||
cy.visit('/jquery.html').window().then((win) => {
|
||||
const constructedCrossOriginAnchor = win.$(`<a href='http://www.foobar.com:4466/cross_origin.html'>cross origin</a>`).appendTo(win.document.body)
|
||||
|
||||
@@ -213,7 +213,7 @@ describe('navigates to about:blank between tests and shows warning about session
|
||||
it('t1', () => {
|
||||
// only warns after initial blank page
|
||||
// unfortunately this fails when run alongside other tests
|
||||
// cy.contains('experimentalLoginFlows').should('not.exist')
|
||||
// cy.contains('experimentalSessionAndOrigin').should('not.exist')
|
||||
cy.contains('default blank page')
|
||||
|
||||
cy.visit('https://localhost:4466/cross_origin_iframe/foo')
|
||||
@@ -221,7 +221,7 @@ describe('navigates to about:blank between tests and shows warning about session
|
||||
})
|
||||
|
||||
it('t2', () => {
|
||||
cy.contains('Because experimentalLoginFlows')
|
||||
cy.contains('Because experimentalSessionAndOrigin')
|
||||
cy.contains('default blank page')
|
||||
})
|
||||
})
|
||||
@@ -721,13 +721,13 @@ describe.skip('consoleProps', () => {
|
||||
// bar.foo.com data.
|
||||
describe('ignores setting insecure context data when on secure context', () => {
|
||||
describe('no cross origin secure origins, nothing to clear', () => {
|
||||
it('sets insecure content', { experimentalLoginFlows: false }, () => {
|
||||
it('sets insecure content', { experimentalSessionAndOrigin: false }, () => {
|
||||
cy.visit('http://bar.foo.com:4465/form')
|
||||
})
|
||||
|
||||
let logSpy
|
||||
|
||||
it('nothing to clear - 1/2', { experimentalLoginFlows: false }, () => {
|
||||
it('nothing to clear - 1/2', { experimentalSessionAndOrigin: false }, () => {
|
||||
cy.visit('https://localhost:4466/form')
|
||||
.then(() => {
|
||||
logSpy = Cypress.sinon.spy(Cypress, 'log')
|
||||
@@ -741,13 +741,13 @@ describe('ignores setting insecure context data when on secure context', () => {
|
||||
})
|
||||
|
||||
describe('only secure origins cleared', () => {
|
||||
it('sets insecure content', { experimentalLoginFlows: false }, () => {
|
||||
it('sets insecure content', { experimentalSessionAndOrigin: false }, () => {
|
||||
cy.visit('http://bar.foo.com:4465/form')
|
||||
})
|
||||
|
||||
let logSpy
|
||||
|
||||
it('switches to secure context - clears only secure context data - 1/2', { experimentalLoginFlows: false }, () => {
|
||||
it('switches to secure context - clears only secure context data - 1/2', { experimentalSessionAndOrigin: false }, () => {
|
||||
cy.visit('https://localhost:4466/cross_origin_iframe/foo')
|
||||
.then(() => {
|
||||
logSpy = Cypress.sinon.spy(Cypress, 'log')
|
||||
@@ -762,29 +762,29 @@ describe('ignores setting insecure context data when on secure context', () => {
|
||||
})
|
||||
|
||||
describe('errors', () => {
|
||||
it('throws error when experimentalLoginFlows not enabled', { experimentalLoginFlows: false }, (done) => {
|
||||
it('throws error when experimentalSessionAndOrigin not enabled', { experimentalSessionAndOrigin: false }, (done) => {
|
||||
cy.on('fail', ({ message }) => {
|
||||
expect(message).contain('\`cy.session()\` requires enabling the \`experimentalLoginFlows\` flag')
|
||||
expect(message).contain('\`cy.session()\` requires enabling the \`experimentalSessionAndOrigin\` flag')
|
||||
done()
|
||||
})
|
||||
|
||||
cy.session('sessions-not-enabled')
|
||||
})
|
||||
|
||||
it('throws error when experimentalSessionSupport is enabled through test config', { experimentalLoginFlows: false, experimentalSessionSupport: true }, (done) => {
|
||||
it('throws error when experimentalSessionSupport is enabled through test config', { experimentalSessionAndOrigin: false, experimentalSessionSupport: true }, (done) => {
|
||||
cy.on('fail', ({ message }) => {
|
||||
expect(message).contain('\`cy.session()\` requires enabling the \`experimentalLoginFlows\` flag. The \`experimentalSessionSupport\` flag was enabled but was removed in Cypress version 9.6.0. Please see the migration guide for updating.')
|
||||
expect(message).contain('\`cy.session()\` requires enabling the \`experimentalSessionAndOrigin\` flag. The \`experimentalSessionSupport\` flag was enabled but was removed in Cypress version 9.6.0. Please see the migration guide for updating.')
|
||||
done()
|
||||
})
|
||||
|
||||
cy.session('sessions-not-enabled')
|
||||
})
|
||||
|
||||
it('throws error when experimentalSessionSupport is enabled through Cypress.config', { experimentalLoginFlows: false }, (done) => {
|
||||
it('throws error when experimentalSessionSupport is enabled through Cypress.config', { experimentalSessionAndOrigin: false }, (done) => {
|
||||
Cypress.config('experimentalSessionSupport', true)
|
||||
|
||||
cy.on('fail', ({ message }) => {
|
||||
expect(message).contain('\`cy.session()\` requires enabling the \`experimentalLoginFlows\` flag. The \`experimentalSessionSupport\` flag was enabled but was removed in Cypress version 9.6.0. Please see the migration guide for updating.')
|
||||
expect(message).contain('\`cy.session()\` requires enabling the \`experimentalSessionAndOrigin\` flag. The \`experimentalSessionSupport\` flag was enabled but was removed in Cypress version 9.6.0. Please see the migration guide for updating.')
|
||||
done()
|
||||
})
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ describe('e2e cy.origin errors', () => {
|
||||
snapshot: true,
|
||||
expectedExitCode: 1,
|
||||
config: {
|
||||
experimentalLoginFlows: true,
|
||||
experimentalSessionAndOrigin: true,
|
||||
},
|
||||
async onRun (exec) {
|
||||
const res = await exec()
|
||||
|
||||
@@ -31,7 +31,7 @@ describe('e2e cy.origin retries', () => {
|
||||
snapshot: true,
|
||||
expectedExitCode: 1,
|
||||
config: {
|
||||
experimentalLoginFlows: true,
|
||||
experimentalSessionAndOrigin: true,
|
||||
retries: 2,
|
||||
},
|
||||
async onRun (exec) {
|
||||
|
||||
@@ -22,7 +22,7 @@ describe('e2e cross origin navigation', () => {
|
||||
|
||||
// TODO: convert to cypress-in-cypress test if possible
|
||||
// https://github.com/cypress-io/cypress/issues/20973
|
||||
systemTests.it('captures cross origin failures when "experimentalLoginFlows" config value is falsy', {
|
||||
systemTests.it('captures cross origin failures when "experimentalSessionAndOrigin" config value is falsy', {
|
||||
// keep the port the same to prevent issues with the snapshot
|
||||
port: PORT,
|
||||
spec: 'navigation_cross_origin_errors.ts',
|
||||
@@ -30,7 +30,7 @@ describe('e2e cross origin navigation', () => {
|
||||
snapshot: true,
|
||||
expectedExitCode: 1,
|
||||
config: {
|
||||
experimentalLoginFlows: false,
|
||||
experimentalSessionAndOrigin: false,
|
||||
},
|
||||
async onRun (exec) {
|
||||
const res = await exec()
|
||||
|
||||
@@ -133,7 +133,7 @@ describe('e2e sessions', () => {
|
||||
spec: 'session_spec.js',
|
||||
snapshot: true,
|
||||
config: {
|
||||
experimentalLoginFlows: true,
|
||||
experimentalSessionAndOrigin: true,
|
||||
video: false,
|
||||
},
|
||||
})
|
||||
@@ -142,7 +142,7 @@ describe('e2e sessions', () => {
|
||||
spec: 'session_persist_spec_1.js,session_persist_spec_2.js',
|
||||
snapshot: true,
|
||||
config: {
|
||||
experimentalLoginFlows: true,
|
||||
experimentalSessionAndOrigin: true,
|
||||
video: false,
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user