Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Collection of Practice
2019
1606837915-practice
Commits
515ade6c
Commit
515ade6c
authored
Sep 24, 2019
by
Izzatul Muttaqin
Browse files
functional test and ci
parent
df432cb4
Pipeline
#20635
passed with stage
in 1 minute and 17 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
515ade6c
...
...
@@ -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
...
...
functional_test.py
View file @
515ade6c
...
...
@@ -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
(
'http
s
://
pmpl-project.herokuapp.com
/lists'
)
self
.
assertIn
(
'To-Do'
,
self
.
browser
.
title
)
header_text
=
self
.
browser
.
find_element_by_tag_name
(
'h1'
).
text
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment