Reputation: 317
I need to run auto tests with chrome browser profile. On selenium, I did it this way:
let chromeOptions = new chrome.Options();
chromeOptions.addArguments("--user-data-dir=/home/user/.config/google-chrome/Default");
let driver = await new webdriver.Builder().forBrowser("chrome").setChromeOptions(chromeOptions).build();
How can I do this using cypress?
Upvotes: 4
Views: 3180
Reputation: 317
You should add module.export before your code with browser profile path.
module.exports = (on, config) => {
on('before:browser:launch', (browser = {}, launchOptions) => {
launchOptions.args.push('--user-data-dir=/home/user/.config/google-chrome/Default')
})
}
describe('My First Test', () => {
it('Project', () => {
cy.visit('https://project.com:8000/login')
cy.log('successful sign in ')
})
})
Upvotes: 0