Shippable / support

Shippable SaaS customers can report issues and feature requests in this repository
101 stars 28 forks source link

Google Chrome support #2257

Closed 9dev closed 8 years ago

9dev commented 8 years ago

I'd like to use Google Chrome with my Selenium tests. I used code from #285:

before_install:
  - "curl -o /tmp/chromedriver.zip -L http://chromedriver.storage.googleapis.com/2.10/chromedriver_linux64.zip"
  - "unzip /tmp/chromedriver.zip -d /home/shippable/bin"
  - "chmod +x /home/shippable/bin/chromedriver"
  - "echo '#!/bin/bash' | sudo tee /usr/bin/google-chrome"
  - "echo 'exec /usr/bin/chrome --no-sandbox --disable-gpu \"$@\"' | sudo tee -a /usr/bin/google-chrome"
  - "sudo chmod +x /usr/bin/google-chrome"

but I keep getting the following error:

selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service /usr/bin/google-chrome

Is there any working solution for testing with Chrome?

manishas commented 8 years ago

@9dev we have migrated your subscription to the new build platform. Can you try rerunning your build and if you run into issues, we can take a look.

Thanks!

9dev commented 8 years ago

@manishas Thanks for response. I've rerun my build and I'm still getting the same error:

selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service /usr/bin/google-chrome
pranaypareek commented 8 years ago

@9dev we have a sample project for selenium here https://github.com/shippableSamples/sample_node_selenium

It is currently setup to work with Firefox. I am looking into it to add support for Chrome.

We will reach out to you soon, thanks!

pranaypareek commented 8 years ago

Continuing to work on this today. Hope to get the sample running for chrome soon.

pranaypareek commented 8 years ago

@9dev the sample here https://github.com/pranaypareek/sample_node_selenium/tree/chrome_support should be helpful.

This is a selenium project that uses the drydock/u14nodpls image for the build which has selenium and the chrome binaries installed on it.

In order to test selenium with a browser, the following commands are required:

    - export DISPLAY=:99.0
    - xvfb-run --server-args="-ac" npm test

The xvfb-run command is needed as we do not bring up xvfb as a service.

These commands are specified in the ci section of the shippable.yml. You can find the shippable.yml for the sample selenium project here https://github.com/pranaypareek/sample_node_selenium/blob/chrome_support/shippable.yml

The project uses nightwatch.json (http://nightwatchjs.org/) configuration to specify chrome as the browser to be used by selenium for executing the tests against.

The following links might be helpful:

manishas commented 8 years ago

Closing since chrome should work now. @9dev let us know if you run into issues and we'll reopen and investigate.

9dev commented 8 years ago

@manishas @pranaypareek thank you for your work. Unfortunately, I still cannot make it run without errors. Could you tell me where exactly is chromedriver located?

I tried /usr/bin/chromedriver as your example suggests, but it raises an error "No such file".

browser = webdriver.Chrome('/usr/bin/chromedriver')

My full shippable.yml file:

language: python

python:
  - 3.4
services:
  - selenium

branches:
  only:
    - master

build:
    pre_ci_boot:
        image_name: drydock/u14pytall
        image_tag: prod
        pull: true
    ci:
      - mkdir -p shippable/testresults
      - DISPLAY=:99.0
      - pip install -r requirements.txt
      - xvfb-run --server-args="-ac" python manage.py test

Thanks in advance for any tips.

pranaypareek commented 8 years ago

@9dev we missed out on your comment above.

Sorry about that. Re-opening the issue to investigate again.

Please feel free to re-open an issue (or open a new one) in the future if you are facing a problem.

0x-x0 commented 8 years ago

@9dev We have a sample project here. The master branch runs tests on firefox on the branch testingOnChrome will test on chrome. Nightwatch.json should be helpful.

9dev commented 8 years ago

@chetantarale Thank you! The key was the correct path to chromedriver.

manishas commented 8 years ago

closing since this works now.