karma-runner / karma-chrome-launcher

A Karma plugin. Launcher for Chrome and Chrome Canary.
MIT License
467 stars 120 forks source link

Launch in background #27

Open mightyiam opened 9 years ago

mightyiam commented 9 years ago

I know this is out of scope but out of interest...

I didn't find a way to specify opening the browser in the background. Stealing focus from the terminal window is just unwanted, for most cases, I guess.

I think it should be default.

There's a flags thing. I read the manual. There's nothing. Perhaps a trick with --display?

It points to this and this, which also don't seem to have what is required. Perhaps something with --class?

This is relevant for all the other "real" browser launchers, as well.

adamreisnz commented 9 years ago

I too would like the ability to launch the browsers minimized or in the background. Very annoying to have to keep minimizing the screens manually. Did you find a solution?

I've seen this been suggested:

browsers: [
    'ChromeBackground'
],
customLaunchers: {
    ChromeBackground: {
        base: 'Chrome',
        flags: ['--no-startup-window']
    }
},

While that works and launches Chrome in the background, Karma doesn't seem to detect the browser. So I've resorted to just making the window less obnoxious:

browsers: [
    'ChromeSmall'
],
customLaunchers: {
    ChromeSmall: {
        base: 'Chrome',
        flags: ['--window-size=300,300']
    }
},
ijse commented 9 years ago

@AdamBuczynski Thanks for your answer. I use --window-position=-9999,0.

jimmiebtlr commented 9 years ago

A possible solution on linux would also be

DISPLAY=:1 meteor

which just opens on another display.

dignifiedquire commented 9 years ago

I totally agree that this would be nice, but I still have to see a way of making this actually possible, cross platform & cross browser :/

aldendaniels commented 9 years ago

+1

chrisspurgeon commented 9 years ago

Perhaps a related thing... when karma launches chrome that new chrome window seems to be the place where all new browser tabs appear. So for instance if the karma browser window is up and running and I follow a web link in an email the web page always loads as a new tab in the karma browser instance, as opposed to the normal chrome instance I already have running. Switching focus to the normal browser instance doesn't seem to have any effect. Any way to keep that from happening?

bentrevor commented 9 years ago

@chrisspurgeon my workaround was to start using Chromium as my default browser, and just use Chrome for karma.

chrisspurgeon commented 9 years ago

Ooh, great idea!

markelog commented 9 years ago

Just crossed my fingers - https://code.google.com/p/chromium/issues/detail?can=1&q=launch%20in%20background&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified&id=534047&thanks=534047&ts=1442756400

jstejada commented 8 years ago

+1

chadcallahan commented 8 years ago

+1

belveryin commented 8 years ago

+1

mspoerer commented 7 years ago

+1

sherzinger commented 7 years ago

+1

jmrowka-cyber commented 7 years ago

+1

shooksm commented 7 years ago

Looks like running Chrome headless is just around the corner: https://www.chromestatus.com/features/5678767817097216

antonybudianto commented 7 years ago

https://developers.google.com/web/updates/2017/04/headless-chrome

rogeriopvl commented 7 years ago

Just a heads up, on OSX, headless chrome doesn't behave completely like a background app. If you have a chrome already running, its window will be focused when you start headless mode.

Can anyone confirm this behaviour in other operating systems?

captainjackrana commented 7 years ago

@rogeriopvl headless chrome steals focus on OSX.. the desirable thing to have is what PhantomJS does, run completely silent in the background.. Are there any flags that can be passed as chrome options to change this behaviour?

rogeriopvl commented 7 years ago

@captainjackrana exactly. That is a known problem. I'm not aware of any flag that changes that behaviour. But it seems to me that it is OSX causing it.