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
This commit is contained in:
parent
214f0e8d5b
commit
f61cbbf72f
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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…
Reference in New Issue
Block a user