Fakultas Ilmu Komputer UI

Commit 5830ee11 authored by Farah Alhaniy's avatar Farah Alhaniy
Browse files

change to chrome

parent 198c3f56
Pipeline #24104 passed with stages
in 12 minutes and 3 seconds
......@@ -35,12 +35,16 @@ FunctionalTest:
image: python:3.7
stage: functional_test
before_script:
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
- echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list
- pip3 install -r requirements.txt
- apt-get update -qq && apt-get install -y -qq unzip
- apt-get install -qy --fix-missing --no-install-recommends xvfb firefox-esr
- apt-get install -y google-chrome-stable
- apt-get install -y xvfb
- wget https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz; mkdir geckodriver; tar -xzf geckodriver-v0.26.0-linux64.tar.gz -C geckodriver; export PATH=$PATH:$PWD/geckodriver;
- pip3 install -r requirements.txt
- python3 manage.py migrate --noinput
- wget https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip
- python3 manage.py collectstatic --noinput
when: on_success
script:
......
from selenium.common.exceptions import WebDriverException
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.chrome.options import Options
import time
import environ
......@@ -10,10 +10,14 @@ MAX_WAIT = 10
class FunctionalTest(StaticLiveServerTestCase):
def setUp(self):
options = Options()
options.headless = True
self.browser = webdriver.Firefox(options=options)
self.browser.implicitly_wait(5)
chrome_options = Options()
chrome_options.add_argument('--dns-prefetch-disable')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--headless')
chrome_options.add_argument('disable-gpu')
self.browser = webdriver.Chrome('./chromedriver', chrome_options=chrome_options)
self.browser.implicitly_wait(10)
def tearDown(self):
self.browser.quit()
......
from .base import FunctionalTest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.chrome.options import Options
......@@ -70,11 +70,14 @@ class NewVisitorTest(FunctionalTest):
## We use a new browser session to make sure that no information
## of Edith's is coming through from cookies etc
self.browser.quit()
options = Options()
options.headless = True
self.browser = webdriver.Firefox(options=options)
self.browser.implicitly_wait(5)
chrome_options = Options()
chrome_options.add_argument('--dns-prefetch-disable')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--headless')
chrome_options.add_argument('disable-gpu')
self.browser = webdriver.Chrome('./chromedriver', chrome_options=chrome_options)
self.browser.implicitly_wait(10)
# Francis visits the home page. There is no sign of Edith's
# list
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment