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
1606835595-practice
Commits
effb20c4
Commit
effb20c4
authored
Sep 25, 2019
by
Kevin Albert Simanjuntak
Browse files
[red] implement comment testing
parent
324d280a
Pipeline
#20803
passed with stage
in 1 minute and 15 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
functional_tests.py
View file @
effb20c4
...
...
@@ -34,12 +34,29 @@ class NewVisitorTest(unittest.TestCase):
inputbox
.
send_keys
(
'Buy peacock feathers'
)
inputbox
.
send_keys
(
Keys
.
ENTER
)
time
.
sleep
(
5
)
self
.
check_comment_based_on_total_list
()
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
)
self
.
check_comment_based_on_total_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'
)
table
=
self
.
browser
.
find_element_by_id
(
'id_list_table'
)
rows
=
table
.
find_elements_by_tag_name
(
'tr'
)
self
.
assertEqual
(
3
,
len
(
rows
))
#comment = self.browser.find_element_by_id('comment').text
#self.assertIn('oakwowakkoaw', comment)
def
check_comment_based_on_total_list
(
self
):
table
=
self
.
browser
.
find_element_by_id
(
'id_list_table'
)
rows
=
table
.
find_elements_by_tag_name
(
'tr'
)
comment
=
self
.
browser
.
find_element_by_id
(
'comment'
).
text
if
len
(
rows
)
==
0
:
self
.
assertIn
(
'yey, waktunya berlibur'
,
comment
)
elif
len
(
rows
)
<
5
:
self
.
assertIn
(
'sibuk tapi santai'
,
comment
)
else
:
self
.
assertIn
(
'oh tidak'
,
comment
)
if
__name__
==
'__main__'
:
unittest
.
main
(
warnings
=
'ignore'
)
\ 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