Closed luchillo17 closed 7 years ago
This is expected behavior. When we shut off useIframe
, Karma moves to using window.open
instead so there are 2 windows:
window.parent
)To demonstrate this point further, we could disable useIframe
in other browsers and see the same result (e.g. Chrome, Firefox)
The thing is that without useIframe: false
we lose nodeIntegration
, but with it, it shows 2 windows, with the second being incredibly annoying poping up all the time.
I guess the idea is to run with --show
flag off and only show when we need to debug the tests, right?
Yep, typically showing the window isn't too helpful as content is often added/remove quicker than we can see. To make it less painful to add/remove the --show
flag in karma.conf.js
, I use the following setup:
Add ElectronVisible
browser but don't set it as default browser:
browsers: ['Electron'],
customLaunchers: {
ElectronVisible: {
base: 'Electron',
flags: ['--show']
}
}
Override default browsers via CLI:
karma start --browsers ElectronVisible
# or for `npm-scripts`
npm run test-karma -- --browsers ElectronVisible
Nice 😄
Background
I have an Electron app with Webpack, Typescript and Karma support (karma part WIP).
Problem
Originally when run it only shows the karma electron browser in launch bar, and the test output in the terminal, so far so good.
But when i use the
client
'suseIframe: false
property and the--show
flag in thecustomLaunchers.CustomElectron
it shows 2 windows, 1 for the karma testing GUI (which is almost the same as terminal) and another white screen window.Interesting note: The second window is always white, but when i press the
Debug
button in the main karma window, a third one shows with my app in there as well as the specs logs, it would be cool if that window was the actual one shown by the flags in question.Guesses
__filenameOverride
property mentioned in (script-configuration)[https://github.com/twolfson/karma-electron#script-configuration] is meant to go side to side with the--show
flag.karma-webpack
lib doesn't compile withwebpack-dev-server
.Steps to reproduce
feature/Testing
branch.npm i && npm run watch:test
in terminal in the cloned repo folder.Debug
button in Karma's window to see the actual app.