-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
launchoptions args (for incognito) are only being passed for the first spec and are not present in the 2nd spec in run mode #29782
Comments
@xyuste Is it the first specfile that executes in |
Hi Jennifer,
const { defineConfig } = require("cypress");
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
on('before:browser:launch', (browser = {}, launchOptions) => {
// `args` is an array of all the arguments that will
// be passed to browsers when it launches
console.log(launchOptions.args) // print all current args
if (browser.name === 'edge') {
// open in incognito
launchOptions.args.push('--inprivate')
}
if (browser.family === 'chromium' && browser.name !== 'electron') {
launchOptions.args.push("--incognito");
}
// whatever you return here becomes the launchOptions
return launchOptions
})
},
experimentalModifyObstructiveThirdPartyCode: true,
chromeWebSecurity: true
},
}); And this the command used to launch the test: |
I'm able to reproduce this in Chrome with the instructions below. This seems really problematic if this is how Cypress is behaving.
const { defineConfig } = require("cypress");
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
on('before:browser:launch', (browser = {}, launchOptions) => {
if (browser.family === 'chromium' && browser.name !== 'electron') {
launchOptions.args.push("--incognito");
}
return launchOptions
})
},
},
});
import { detectIncognito } from "detectincognitojs";
it('test 1', (done) => {
detectIncognito().then((result) => {
expect(result.browserName).to.equal('Chrome');
expect(result.isPrivate).to.be.true;
done()
});
});
import { detectIncognito } from "detectincognitojs";
it('test 2', (done) => {
detectIncognito().then((result) => {
expect(result.browserName).to.equal('Chrome');
expect(result.isPrivate).to.be.true;
done()
});
});
|
I tracked this down to being introduced in Cypress 12.15.0 which is when we began passing the |
Ok, I've narrowed down some specifics some more. This behavior has actually been happening in When we switched the This expansion to I'm unsure at this point if this issue is isolated to |
@jennifer-shehane I'm facing same issue with Edge and Chrome browser. |
I'm facing this issue too :( this is useful for AAD authentication for avoid to take current sessions. |
@jennifer-shehane is there any update about this issue?... Seems it started in the latest chrome and Edge versions (Chromium based browsers) not only with the 12.5 Cypress version. |
Current behavior
Hi,
I have one test project with 2 features (I am using cucumber preprocessor @badeball), then when I try to execute my test with:
npx cypress run --browser edge --headed
Only the first feature is executed in the "inprivate" mode, the second one is executed in normal mode.
Desired behavior
All the features should be executed inprivate mode
I have created one ticket in the @badeball support, and the ticket has been closed with :
I doubt this pertains to the preprocessor, hence closing.
Also it happens executing one project with several tests (including the "2-advanced-examples", downloaded from the cypress web), and starting from command line:
npx cypress run --browser edge --headed
only the first test is executed inprivate mode all the rest in normal mode
Where is the problem?
Many thanks!
Test code to reproduce
My file tsconfig.json:
Cypress Version
13.12.0
Node version
v20.13.0
Operating System
windows 10
Debug Logs
Other
I am using following dependencies:
"dependencies": {
"@badeball/cypress-cucumber-preprocessor": "^20.1.0",
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.1",
"cypress-xpath": "^2.0.1"
The text was updated successfully, but these errors were encountered: