Fakultas Ilmu Komputer UI

Commit effb20c4 authored by Kevin Albert Simanjuntak's avatar Kevin Albert Simanjuntak
Browse files

[red] implement comment testing

parent 324d280a
Pipeline #20803 passed with stage
in 1 minute and 15 seconds
......@@ -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
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