Launch Chrome Chrome browser with specific extensions (s)

I am trying to run Testem my tests in a Chrome browser with certain extensions (s), but by default it is an empty Chrome profile that is running and which does not save extensions from one run to another.

My goal is, for example, Testem to launch a Chrome browser pre-loaded using the Ember Inspector so that I can debug tests using this tool.

I wanted to know if this was possible, and if so, how.

+6
source share
1 answer

Unfortunately, there seems to be no built-in way that I can find.

If you want a quick and dirty solution, I recommend the following:

Available browsers in testem defined in testem/lib/browser_launcher.js If you want to modify a file that uses ember-cli , this will be the full path:

 <your-app-dir>/node_modules/ember-cli/node_modules/testem/lib/browser_launcher.js 

This file has a browsersForPlatform() function. Find your platform and entry for Chrome. For Darwin, the corresponding entry is as follows:

  { name: "Chrome", exe: "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome", args: ["--user-data-dir=" + tempDir + "/testem.chrome", "--no-default-browser-check", "--no-first-run", "--ignore-certificate-errors"], setup: function(config, done){ rimraf(tempDir + '/testem.chrome', done) }, supported: browserExeExists }, 

You want to change args so that it is called as you like. My guess is that --user-data-dir points to the tmp directory. Perhaps just fixing it will solve the problem.

Ideally, testem will suggest a way to override browser settings in the testem.json file. This is likely to be a fairly simple contribution to the testem project, if you are interested, and there is interest among those involved.

If you follow the path of changing browser_launcher.js , just remember that it will crash every time the node package is updated. I assume that you can install the branched version and then keep your copy up to date as you see fit.

+3
source

Source: https://habr.com/ru/post/975352/


All Articles