Browse Source

Switch to Firefox from PhantomJS

As PhantomJS is no longer maintained and there are packaging problems,
let's switch to using Firefox in a headless configuration which is a
scenario supported by Selenium.

Change-Id: Ic98c5b71202f033b9013c126f6bacdb49980acfa
changes/06/722306/2
Dmitrii Shcherbakov 6 months ago
parent
commit
f61cbbf72f
3 changed files with 9 additions and 20 deletions
  1. +4
    -5
      tests/framework.py
  2. +3
    -8
      tools/basic_setup.sh
  3. +2
    -7
      tools/lxd_build.sh

+ 4
- 5
tests/framework.py View File

@@ -4,11 +4,11 @@ import unittest
import os
import subprocess
import time
import xvfbwrapper
from typing import List

import petname
from selenium import webdriver
from selenium.webdriver.firefox.options import Options as FirefoxOptions
from selenium.webdriver.common.by import By


@@ -58,9 +58,9 @@ def gui_wrapper(func):
def wrapper(cls, *args, **kwargs):

# Setup Selenium Driver
cls.display = xvfbwrapper.Xvfb(width=1280, height=720)
cls.display.start()
cls.driver = webdriver.PhantomJS()
options = FirefoxOptions()
options.add_argument("-headless")
cls.driver = webdriver.Firefox(options=options)

# Run function
try:
@@ -69,7 +69,6 @@ def gui_wrapper(func):
finally:
# Tear down driver
cls.driver.quit()
cls.display.stop()

return wrapper



+ 3
- 8
tools/basic_setup.sh View File

@@ -2,11 +2,6 @@

set -ex

#sudo apt update

# Install the X virtual framebuffer, which is required for selenium
# tests of the horizon dashboard.
sudo apt install -y xvfb npm libfontconfig1
phantomjs -v || sudo npm install -g phantomjs-prebuilt
# Verify that PhantomJS, our selenium web driver, works.
phantomjs -v
sudo apt update
# install Firefox which will be used for Web UI testing in a headless mode.
sudo apt install -y firefox-geckodriver python3-petname python3-selenium

+ 2
- 7
tools/lxd_build.sh View File

@@ -5,13 +5,8 @@ set -ex
export PATH=/snap/bin:$PATH

sudo apt update

# Install the X virtual framebuffer, which is required for selenium
# tests of the horizon dashboard.
sudo apt install -y xvfb npm libfontconfig1
sudo npm install -g phantomjs-prebuilt
# Verify that PhantomJS, our selenium web driver, works.
phantomjs -v
# install Firefox which will be used for Web UI testing in a headless mode.
sudo apt install -y firefox-geckodriver python3-petname python3-selenium

# Setup snapd and snapcraft
sudo apt install -y snapd


Loading…
Cancel
Save