Fakultas Ilmu Komputer UI

Commit 515ade6c authored by Izzatul Muttaqin's avatar Izzatul Muttaqin
Browse files

functional test and ci

parent df432cb4
Pipeline #20635 passed with stage
in 1 minute and 17 seconds
......@@ -6,18 +6,11 @@ UnitTest:
image: python:3.6
stage: 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
- pip install -r requirements.txt
- pip install requests
- pip install django-environ
- python manage.py makemigrations
- python manage.py migrate
- apt-get update -qq && apt-get install -y -qq unzip
- apt-get install -y google-chrome-stable
- apt-get install -y xvfb
- wget https://chromedriver.storage.googleapis.com/2.32/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip
- python manage.py collectstatic --no-input
- python manage.py runserver 8000 &
when: on_success
......
......@@ -4,17 +4,22 @@ from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.chrome.options import Options
import unittest
# WebDriverWait(self.browser, 10).until(
# expected_conditions.text_to_be_present_in_element(
# (By.ID, 'id_list_table'), 'Buy peacock feathers'))
class NewVisitorTest(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
self.browser.implicitly_wait(3)
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')
try:
self.browser = webdriver.Chrome('./chromedriver.exe', chrome_options=chrome_options)
except:
self.browser = webdriver.Chrome('./chromedriver', chrome_options=chrome_options)
super(NewVisitorTest, self).setUp()
def tearDown(self):
self.browser.close()
......@@ -25,7 +30,7 @@ class NewVisitorTest(unittest.TestCase):
self.assertIn(row_text, [row.text for row in rows])
def test_can_start_a_list_and_retrieve_it_later(self):
self.browser.get('http://localhost:8000/lists')
self.browser.get('https://pmpl-project.herokuapp.com/lists')
self.assertIn('To-Do', self.browser.title)
header_text = self.browser.find_element_by_tag_name('h1').text
......
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