Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

364
Visualizações
Passing custom Chrome profile directory when starting Cypress

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 already tried this command which should be a valid chromium argument.

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

Our setup:

  • MacOs
  • Chrome v93
  • Cypress v8.3.0
  • Cypress Cucumber Preprocessor v4.1.0

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

const browserify = require('@cypress/browserify-preprocessor');
const cucumber = require('cypress-cucumber-preprocessor').default;
const resolve = require('resolve');

module.exports = (on, config) => {
  
  const options = {
    ...browserify.defaultOptions,
    typescript: resolve.sync('typescript', { baseDir: config.projectRoot }),
  };

  on('file:preprocessor', cucumber(options));

  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

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

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

};

This seems not to be working while the --auto-open-devtools-for-tabs command is working fine, but the custom profile is not loaded. Is this a known issue? Or can we debug to see what is happening?

update 24/9/2021

I see that the argument is passed to Chrome by Cypress, but Cypress overrides the Chrome profile path. 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

According to this thread I understand that this is how Cypress works https://github.com/cypress-io/cypress/issues/3671

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda