Skip to content

Passing custom Chrome profile directory (user data dir) not working on Mac and Linux #18308

Open
@AJM-v

Description

Current behavior

We would like to use a custom Chrome profile directory for our Cypress tests. The application we are testing uses a Web SQL database which needs to be loaded into the Chrome browser. We tried this command which should be a valid chromium argument.

launchOptions.args.push('--user-data-dir=/Users/testuser/dev/chrome')

But when we run Cypress we see that the Chrome Profile Path is being overwritten by Cypress:

image

Desired behavior

The Chrome Profile Path from the launchOptions '--user-data-dir=/Users/testuser/dev/chrome' is used.

Test code to reproduce

Our setup:

  • MacOs
  • Chrome v93
  • Cypress v8.4.0

The code we tried in our index.js (plugins folder):

module.exports = (on, config) => {
  
  on('before:browser:launch', (browser = {}, launchOptions) => {

    launchOptions.args.push('--user-data-dir=/Users/testuser/dev/chrome')

    launchOptions.args.push('--auto-open-devtools-for-tabs')
  
    return launchOptions
  })

};

Steps to reproduce:

  1. Add launchOptions argument with --user-data-dir like mentioned above
  2. Open Cypress dashboard (npx cypress open)
  3. Run 1 test in Chrome
  4. Chrome browser opens, type chrome://version in URL bar
  5. --user-data-dir=/Users/testuser/dev/chrome is listed in the Command Line panel, but I also see --user-data-dir=/Users/xxxxx/Library/Application Support/Cypress/cy/production/browsers/chrome-stable/interactive listed, and that is the Profile Path which is being used by Cypress

Cypress Version

8.4.0

Other

Also tested on a Windows 10 environment and there this code is working fine when testing headed in Chrome.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions