Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Collection of Practice
2019
1606836976-practice
Commits
7ceed910
Commit
7ceed910
authored
Dec 23, 2019
by
Yumna Pratista Tastaftian
Browse files
edited gitlab ci
parent
b9408aba
Pipeline
#28261
passed with stages
in 12 minutes and 49 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
7ceed910
...
...
@@ -3,17 +3,23 @@ stages:
-
deploy
-
postdeploy
UnitTest
:
before_script
:
-
pip install -r requirements.txt
-
python manage.py makemigrations
-
python manage.py migrate
AppHomepageTest
:
image
:
python:3.6
stage
:
test
script
:
-
coverage run --source='app_homepage' manage.py test app_homepage
-
coverage report
AccountsTest
:
image
:
python:3.6
stage
:
test
before_script
:
-
pip install -r requirements.txt
-
python manage.py makemigrations
-
python manage.py migrate
when
:
on_success
script
:
-
coverage run --
omit='manage.py
' manage.py test
-p "unit_tests*.py"
-
coverage report
-m
-
coverage run --
source='accounts
' manage.py test
accounts
-
coverage report
Deployment
:
image
:
ruby:2.4
...
...
@@ -51,7 +57,5 @@ FunctionalTest:
when
:
on_success
script
:
-
python3 manage.py test functional_tests
-
coverage run --source='app_homepage' manage.py test app_homepage
-
coverage report
-
coverage run --source='accounts' manage.py test accounts
-
coverage report
\ No newline at end of file
-
coverage run --source='.' manage.py test
-
coverage report -m
\ No newline at end of file
functional_test.py
deleted
100644 → 0
View file @
b9408aba
from
selenium
import
webdriver
import
unittest
from
selenium.webdriver.common.keys
import
Keys
import
time
class
NewVisitorTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
browser
=
webdriver
.
Firefox
()
def
tearDown
(
self
):
self
.
browser
.
quit
()
def
check_for_row_in_list_table
(
self
,
row_text
):
table
=
self
.
browser
.
find_element_by_id
(
'id_list_table'
)
rows
=
table
.
find_elements_by_tag_name
(
'tr'
)
self
.
assertIn
(
row_text
,
[
row_text
for
row
in
rows
])
def
test_can_start_a_list_and_retrieve_it_later
(
self
):
# Edith has heard about a cool new online to-do app. She goes
# to check out its homepage
self
.
browser
.
get
(
'http://localhost:8000'
)
# She notices the page title and header mention to-do lists
self
.
assertIn
(
'To-Do'
,
self
.
browser
.
title
)
header_text
=
self
.
browser
.
find_element_by_tag_name
(
'h1'
).
text
self
.
assertIn
(
'To-Do'
,
header_text
)
inputbox
=
self
.
browser
.
find_element_by_id
(
'id_new_item'
)
inputbox
.
send_keys
(
'Buy peacock feathers'
)
inputbox
.
send_keys
(
Keys
.
ENTER
)
time
.
sleep
(
5
)
# The page updates again, and now shows both items on her list
self
.
check_for_row_in_list_table
(
'1: Buy peacock feathers'
)
# She is invited to enter a to-do item straight away
# There is still a text box inviting her to add another item. She
# enters "Use peacock feathers to make a fly" (Edith is very
# methodical)
inputbox
=
self
.
browser
.
find_element_by_id
(
'id_new_item'
)
inputbox
.
send_keys
(
'Use peacock feathers to make a fly'
)
inputbox
.
send_keys
(
Keys
.
ENTER
)
time
.
sleep
(
5
)
# The page updates again, and now shows both items on her list
self
.
check_for_row_in_list_table
(
'1: Buy peacock feathers'
)
self
.
check_for_row_in_list_table
(
'2: Use peacock feathers to make a fly'
)
# Edith wonders whether the site will remember her list. Then she sees
# that the site has generated a unique URL for her -- there is some
# explanatory text to that effect.
self
.
fail
(
'Finish the test!'
)
if
__name__
==
'__main__'
:
#
unittest
.
main
(
warnings
=
'ignore'
)
#
\ No newline at end of file
functional_tests/test_list_item_validation.py
View file @
7ceed910
...
...
@@ -44,9 +44,4 @@ class ItemValidationTest(FunctionalTest):
# She tries again with some text for the item, which now works
# self.fail('finish this test!')
if
__name__
==
'__main__'
:
#
unittest
.
main
(
warnings
=
'ignore'
)
#
\ No newline at end of file
# self.fail('finish this test!')
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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