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: ...@@ -35,12 +35,16 @@ FunctionalTest:
image: python:3.7 image: python:3.7
stage: functional_test stage: functional_test
before_script: 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 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 - 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; - wget https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip
- pip3 install -r requirements.txt - unzip chromedriver_linux64.zip
- python3 manage.py migrate --noinput - python3 manage.py collectstatic --noinput
when: on_success when: on_success
script: script:
......
from selenium.common.exceptions import WebDriverException from selenium.common.exceptions import WebDriverException
from django.contrib.staticfiles.testing import StaticLiveServerTestCase from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from selenium import webdriver from selenium import webdriver
from selenium.webdriver.firefox.options import Options from selenium.webdriver.chrome.options import Options
import time import time
import environ import environ
...@@ -10,10 +10,14 @@ MAX_WAIT = 10 ...@@ -10,10 +10,14 @@ MAX_WAIT = 10
class FunctionalTest(StaticLiveServerTestCase): class FunctionalTest(StaticLiveServerTestCase):
def setUp(self): def setUp(self):
options = Options() chrome_options = Options()
options.headless = True chrome_options.add_argument('--dns-prefetch-disable')
self.browser = webdriver.Firefox(options=options) chrome_options.add_argument('--no-sandbox')
self.browser.implicitly_wait(5) 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): def tearDown(self):
self.browser.quit() self.browser.quit()
......
from .base import FunctionalTest from .base import FunctionalTest
from selenium import webdriver from selenium import webdriver
from selenium.webdriver.common.keys import Keys 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): ...@@ -70,11 +70,14 @@ class NewVisitorTest(FunctionalTest):
## We use a new browser session to make sure that no information ## We use a new browser session to make sure that no information
## of Edith's is coming through from cookies etc ## of Edith's is coming through from cookies etc
self.browser.quit() chrome_options = Options()
options = Options() chrome_options.add_argument('--dns-prefetch-disable')
options.headless = True chrome_options.add_argument('--no-sandbox')
self.browser = webdriver.Firefox(options=options) chrome_options.add_argument('--headless')
self.browser.implicitly_wait(5) 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 # Francis visits the home page. There is no sign of Edith's
# list # 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