Stylized Alex Ward logo

Tagged “windows”

Stencil e2e testing on WSL

I ran across something while working on updating Stencil tests to use puppeteer, and figured I'd put it down to paper while I'm thinking about it.

In order to run puppeteer tests, a browser needs to be present. Now, you could probably install headless chrome in the linux subsystem (and also install a window manager because evidently puppeteer needs that in order to do some of the tests) - but that seemed a little dirty. When I was running with karma I simply set the $CHROME_BIN environment variable to point at '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe' - so that Karma will use the browser already installed on the Windows side of things. That interop works fine, so I figured I should go ahead and get that working in Stencil / puppeteer.

The config is relatively straightforward, but I did have to go digging in the source to figure out exactly what params to set.

Turns out it's just 2 things that need to be added to stencil.config.js:

exports.config = {
testing: {
browserHeadless: false,
browserExecutablePath: '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'

That'll spawn a new window (the headless false part, running it in headless mode just timed out) - but retain the sandbox. Otherwise the tests run just fine.