Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add path query for chromium #62

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

mattyclarkson
Copy link
Contributor

Assumes that the use has head installed and that it supports the -n1 argument. This will strip the first found browser from the which command.

Fixes #46

@mattyclarkson
Copy link
Contributor Author

Just figuring out the build failures 😢

@mattyclarkson
Copy link
Contributor Author

Changing which google-chrome to which chromium makes the Firefox test fail. Trying to figure out what the hell is going on.

@mattyclarkson
Copy link
Contributor Author

Oh, the process key defines the name of the executable (which is expected to be chrome but is actually chromium).

On GNU/Linux anyway. Assume SunOS is the same
Provides more flexibility to find the PID
The chromium binary is actually a script that starts the /usr/lib/chromium binary
with the correct arguments. We just need to search for the chromium instance that
doesn't have a '--type' parameter
@mattyclarkson
Copy link
Contributor Author

I've had more time to look into this and the exec function call isn't correctly returning the results of the which invocations.

var exec = require('child_process').exec;
exec('which chromium-browser chromium google-chrome google-chrome-stable || true');

If I run the following script in my node terminal I get:

> null '/usr/bin/chromium\n' 'which: no chromium-browser in (/home/matt/.npm-global-packages/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/opt/opencascade/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:~/.posix_scripts)\nwhich: no google-chrome in (/home/matt/.npm-global-packages/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/opt/opencascade/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:~/.posix_scripts)\nwhich: no google-chrome-stable in (/home/matt/.npm-global-packages/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/opt/opencascade/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:~/.posix_scripts)\n'

If I run the same code inside the npm test I get:

null '' 'not found: chromium-browser\n'

Will carry on investigating.

When chrome fires up it requests for /favicon.ico automatically. As
chrome can start up in a tab, it won't be killed and the request can
occur during the start up of the next browser. This makes sure to only
test the user agent when the request is for the root page.
This can provide more information in the mocha message
@mattyclarkson
Copy link
Contributor Author

The difference between npm test and grunt test results in different exec results:

npm test

[launchpad|chromium ↑·3|✚ 1] npm test

> launchpad@0.5.1 test /home/matt/git/github/ekryski/launchpad
> grunt test --stack

Running "jshint:lib" (jshint) task
>> 15 files lint free.

Running "jshint:test" (jshint) task
>> 2 files lint free.

Running "simplemocha:all" (simplemocha) task


  Local browser launcher tests
    Default env settings
[ '', 'not found: chromium-browser\n' ]
[ '/usr/bin/firefox\n', '' ]
      ✓ does local browser and version discovery (167ms)
      ✓ Launches chrome browser on linux
      ✓ Launches firefox browser on linux (586ms)
      ✓ Launches opera browser on linux
      ✓ Launches phantom browser on linux (140ms)
    Custom env settings
      ✓ detects PhantomJS only due to env settings (120ms)

  Remote Preview launcher
    ✓ Writes URL to file


  7 passing (1s)


Done, without errors.

grunt

[launchpad|chromium ↑·3|✚ 1] ./node_modules/grunt-cli/bin/grunt 
Running "jshint:lib" (jshint) task
>> 15 files lint free.

Running "jshint:test" (jshint) task
>> 2 files lint free.

Running "simplemocha:all" (simplemocha) task


  Local browser launcher tests
    Default env settings
[ '/usr/bin/firefox\n', '' ]
[ '/usr/bin/chromium\n',
  'which: no chromium-browser in (/home/matt/.npm-global-packages/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/opt/opencascade/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:~/.posix_scripts)\nwhich: no google-chrome in (/home/matt/.npm-global-packages/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/opt/opencascade/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:~/.posix_scripts)\nwhich: no google-chrome-stable in (/home/matt/.npm-global-packages/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/opt/opencascade/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:~/.posix_scripts)\n' ]
      ✓ does local browser and version discovery (144ms)
      ✓ Launches chrome browser on linux (196ms)
      ✓ Launches firefox browser on linux (661ms)
      ✓ Launches opera browser on linux
      ✓ Launches phantom browser on linux (137ms)
    Custom env settings
      ✓ detects PhantomJS only due to env settings (115ms)

  Remote Preview launcher
    ✓ Writes URL to file


  7 passing (1s)


Done, without errors.

Just keeping this up-to-date with my findings in case I have to come back to this branch.

@mattyclarkson
Copy link
Contributor Author

Just hangs on Travis now. Will have to come back to this later. Works locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant