Giter Site home page Giter Site logo

ansible-role-selenium's People

Contributors

alexskrypnyk avatar arknoll avatar geerlingguy avatar ian-rose avatar kporras07 avatar sguter90 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ansible-role-selenium's Issues

Is there a working reference install?

I spent last two days trying to get this role to run. I tried it with geerlingguy/ubuntu1404 and geerlingguy/ubuntu1604. Even tried it as part of geerlingguy/drupal-vm, which seemed to be a good reference system. The setup runs through, but the result is not usable, because selenium is not able to start browser session. See here for example output.

I also tried to use firefox instead of firefox, but still to luck.

This might be related to issue #29. I also tried setting selenium_version=3.0.1 as in PR30. Unfortunately this did not help.

Do you have a minimum working vagrant config to start from?

Selenium doesn't always start/stop/restart on Debian

I had to kill Selenium and start/stop it manually (using java -jar /path/to/selenium) today because the init script seemed to get out of whack on Debian. Running service selenium start reported success, but selenium didn't start (status reported it was stopped). And stop reported it was stopped as well.

I will try to dig into this more in a bit, as I'm currently debugging some Behat tests and can't dig into the selenium problem yet.

Failing on CentOS 6

I got here via geerlingguy/drupal-vm#374


I'm getting these errors with the stock Firefox 38 on CentOS 6 (with the Selenium role enabled), and with Firefox 42.

exception 'WebDriver\Exception\UnknownError' with message 'Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:

process 20424: D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open "/var/lib/dbus/machine-id": No such file or directory
See the manual page for dbus-uuidgen to correct this issue.
D-Bus not built with -rdynamic so unable to print a backtrace
in /var/www/example/vendor/instaclick/php-webdriver/lib/WebDriver/Exception.php:15

Ansible 2.2 service module requires systemd unit file for Ubuntu 16.04

Ansible 2.2 introduced some changes to the way the service module works with older init scripts, so the following happens under Ubuntu 16.04 if using Ansible 2.2+:

TASK [arknoll.selenium : Ensure selenium is running] ***************************
fatal: [drupalvm]: FAILED! => {"changed": false, "failed": true, "msg": "Could not find the requested service \"'selenium'\": "}

For my roles that were encountering similar issues, I had to add a systemd unit file and this solved the issue because the service module can use that instead of the custom init script.

See:

Support for Phantomjs

This is a nice to have, but if you can add in support for Phantomjs would be very nice.

Thanks

systemd unit on CentOS 7 fails to start

Because of 4f88a66 the selenium systemd unit is failing to start.
The problem seems to be with the quoting of the xvfb-run arguments.

Besides the integration tests failed to notice the failure because the systemd start command doesn't return any error.

Looking at the forks of this project, I found that @MassiveHiggsField has fixed these in his project https://github.com/MassiveHiggsField/ansible-role-selenium

@MassiveHiggsField do you plan to do a pull request ?

Debian Jessie - Firefox installation failed

On Debian Jessie the package firefox is no longer available.

firefox-esr is available and should be configured.

Better, Install Browser items should be available as a variable to be override easily.

Method of updating selenium version?

At regular intervals selenium gets out of step with firefox so we see "failure to connect"s like we do now with selenium_version: 2.46.0 and Mozilla Firefox 45.0

Just providing ansible-role-selenium with selenium_version: 2.52.2 doesn't seem to upgrade the installed selenium_version: 2.46.0 according to ps aux

I resorted to rebuilding the complete VM but surely there's a more efficient way of upgrading selenium alone?

Alternative Selenium Installation Directory not functional

Under tasks/main.yml the creation of the {{ selenium_install_dir }} is correct, however the following task, still contains a hard coded version of the installation path.

tasks/main.yml:8 should be instead:

  get_url: "url=http://selenium-release.storage.googleapis.com/{{ selenium_version | regex_replace('\\.[0-9]+$', '') }}/selenium-server-standalone-{{ selenium_version }}.jar dest={{ selenium_install_dir }}/selenium/selenium-server-standalone-{{ selenium_version }}.jar"

Bigger browser window than 640x480

Some of my Selenium tests require a bigger screen resolution than 640x480 which is apparently the default resolution of xvfb.

vagrant@drupalvm:/var/www/drupalvm/selenium$ systemctl status selenium
* selenium.service - selenium test framework
   Loaded: loaded (/etc/systemd/system/selenium.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2017-02-02 14:34:38 UTC; 17s ago
 Main PID: 31953 (xvfb-run)
   CGroup: /system.slice/selenium.service
           |-31953 /bin/sh /usr/bin/xvfb-run /usr/bin/java -client -jar /opt/selenium/selenium-server-standalone-2.53.0.jar
           |-31967 Xvfb :99 -screen 0 640x480x8 -nolisten tcp -auth /tmp/xvfb-run.8RAJhg/Xauthority
           `-31970 /usr/bin/java -client -jar /opt/selenium/selenium-server-standalone-2.53.0.jar
vagrant@drupalvm:/var/www/drupalvm/selenium$

SeleniumHQ/selenium-google-code-issue-archive#5828 (comment) explains how xvfb can be started with a bigger resolution. Which works when manually replaced ExecStart=/usr/bin/xvfb-run /usr/bin/java -client -jar {{ selenium_install_dir }}/selenium/selenium-server-standalone-{{ selenium_version }}.jar in templates/selenium-unit.j2 with ExecStart=/usr/bin/xvfb-run -s "-screen 0, 1920x1080x24" /usr/bin/java -client -jar {{ selenium_install_dir }}/selenium/selenium-server-standalone-{{ selenium_version }}.jar

It would be handy if ansible-role-selenium would support this with a parameter.

missing systemd daemon-reload

I'm trying to run this role against Centos7, but it looks like there's missing systemd daemon-reload step after creating/editing systemd unit file.

See PR #41

Selenium 3/Firefox

Spent a little bit of time trying to figure out getting Selenium 3 working with Firefox to get behat tests with javascript working (using Firefox). Turns out it's pretty simple!

This role installs the latest version of Firefox which needs to use the GeckoDriver to operate with Selenium. You can download it from:

https://github.com/mozilla/geckodriver/releases

Secondly, installing Selenium standalone version 3.0.1 works with no configuration.

So, in my config.yml I have:

selenium_version: 3.0.1
selenium_install_firefox: yes

and I created a post-provision script which looks like:

#!/bin/bash

GECKO_VERSION="0.11.1"
GECKO_DOWNLOAD="https://github.com/mozilla/geckodriver/releases/download/v0.11.1/geckodriver-v$GECKO_VERSION-linux64.tar.gz"
GECKO_DOWNLOAD_DIR="/tmp"
GECKO_NAME="geckodriver"
GECKO_PATH="/usr/local/bin"
GECKO_FULL_PATH="/usr/local/bin/$GECKO_NAME"

if [ ! -e "$GECKO_FULL_PATH" ]; then
wget -qO- $GECKO_DOWNLOAD | tar xvz -C $GECKO_DOWNLOAD_DIR
sudo cp -a $GECKO_DOWNLOAD_DIR/$GECKO_NAME $GECKO_PATH
else
exit 0
fi

This installs the driver in a location that selenium can find it. Simple as that and it appears to be working as expected.

Chromedriver not working with installed Selenium version

See: geerlingguy/drupal-vm#1152

Feature: Home page
  In order to verify that the home page is working
  As a user
  I should be able to load the homepage
  With and without Javascript

  @javascript
  Scenario: Load a page with Javascript                   # features/Home Page.feature:8
Starting ChromeDriver 2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320) on port 27769
Only local connections are allowed.
    Given I am on "/"                                     # Drupal\DrupalExtension\Context\MinkContext::visit()
      Could not open connection: unknown error: Chrome failed to start: exited abnormally
        (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 3.13.0-32-generic x86_64) (WARNING: The server did not provide any stacktrace information)
      Command duration or timeout: 60.28 seconds
      Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
      System info: host: 'local', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-32-generic', java.version: '1.7.0_121'
      Driver info: org.openqa.selenium.chrome.ChromeDriver (Behat\Mink\Exception\DriverException)

It seems there may be two issues here:

  1. The selenium_version needs to be bumped to 3.0.1
  2. The Download Selenium task should have a notify: restart selenium added, so that selenium is restarted if a new version is downloaded...

But I'm still debugging in that other issue to see if this is the actual problem, or just a symptom.

Use more efficient test rig

I've simplified my test structure to use a shared shell script to run given playbooks in different environments; I'll send up a PR in a few minutes.

Failure when adding Chrome repo on Ubuntu 14.04

I'm getting the following error on an instance of Drupal VM with Ubuntu 14.04 when it wasn't an issue before...

TASK [arknoll.selenium : Add Chrome repo (if configured, Debian)] **************
fatal: [chn1]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Shared connection to 127.0.0.1 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_twxaQy/ansible_module_apt_repository.py\", line 538, in <module>\r\n    main()\r\n  File \"/tmp/ansible_twxaQy/ansible_module_apt_repository.py\", line 527, in main\r\n    cache.update()\r\n  File \"/usr/lib/python2.7/dist-packages/apt/cache.py\", line 440, in update\r\n    raise FetchFailedException(e)\r\napt.cache.FetchFailedException: W:Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/Release  Unable to find expected entry 'main/binary-i386/Packages' in Release file (Wrong sources.list entry or malformed file)\r\n, E:Some index files failed to download. They have been ignored, or old ones used instead.\r\n", "msg": "MODULE FAILURE"}

Will dig into it. Also, someone else had the same issue and reported it in BLT's issue queue previously: acquia/blt#1020

Problem enabling selenium on Ubuntu 16.04

Not seen this with Ubuntu 14.04. Do we need to register selenium.service in a new way for Ubuntu 16.04 so that the run step works?

- name: run
  service: name=selenium state=started enabled=yes
  tags: [configuration, selenium, selenium-run]

Error:

fatal: [dbapc]: FAILED! => {"changed": false, "failed": true, "msg": 
"Error when trying to enable selenium: rc=1 selenium.service is not a native service,
 redirecting to systemd-sysv-install\nExecuting /lib/systemd/systemd-sysv-install enable 
 selenium\ninsserv: warning: script 'selenium' missing LSB tags and overrides\nupdate-rc.d: 
 error: selenium Default-Start contains no runlevels, aborting.\n"}

Test cross-platform using Docker-based Travis tests

We don't need all 7 OSes I use in some of my other roles, but it would be nice to get Travis CI testing on at least Ubuntu 16.04 and CentOS 7 (the latest LTS releases of each) instead of just Ubuntu 12.04 (the current setup).

I may check into converting things quickly after I finish working on testing #3.

Question - see the @javascript in a broweser

I use the @javascript on some of my behat testing, either to see what is going on in the browser or for some debugging.

When running behat test with selenium in a drupal vm, I do not get the browser window. Do i need to configure something unique?

my behat.local.yml is:

default:
  extensions:
    Behat\MinkExtension:
      base_url: 'https://testing.test.me/'
      goutte:
        guzzle_parameters:
          verify: false
      show_cmd: open -a Safari %s
      browser_name: chrome #firefox  # Set to chrome if using the chromedriver
  suites:
    default:
      contexts:
        - FeatureContext:
            testing_hostname: 'testing.test.me'
            bootstrap_database_dump: 'init_testing.sql'
            codebase_root: '/var/www/test'
            setup_script_dir: 'var/www/test/bin'
            setup_script: 'devsite_vm_ido'
            dbusername: 'testing'
            dbpassword: 'testing'
            dbname: 'init_testing'

xvfb is not run with selenium_xvfb_args in ubuntu 16.04

ubuntu 16.04 uses systemd unit file. the template selenium-unit.j2 is missing the selenium_xvfb_args parameter!

the result is that xvfb is run with the default 640x480x8 resolution:

  • selenium.service - selenium test framework
    Loaded: loaded (/etc/systemd/system/selenium.service; enabled; vendor preset: enabled)
    Active: active (running) since Mon 2017-04-17 23:54:16 CEST; 24s ago
    Main PID: 7519 (xvfb-run)
    CGroup: /system.slice/selenium.service
    |-7519 /bin/sh /usr/bin/xvfb-run /usr/bin/java -client -jar /opt/selenium/selenium-server-standalone-2.53.1.jar
    |-7542 Xvfb :99 -screen 0 640x480x8 -nolisten tcp -auth /tmp/xvfb-run.xNbcGG/Xauthority
    `-7560 /usr/bin/java -client -jar /opt/selenium/selenium-server-standalone-2.53.1.jar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.