8.1 What to Functionally Test About Layout and Style

master
Jason Zhu 2020-11-11 17:32:22 +11:00
parent c1e75783d6
commit f8ea01f895
1 changed files with 24 additions and 1 deletions

View File

@ -118,3 +118,26 @@ class NewVisitorTest(LiveServerTestCase):
self.assertIn('Buy milk', page_text)
# Satisfied, they both go back to sleep
def test_layout_and_styling(self):
# Edith goes to the home page
self.browser.get(self.live_server_url)
self.browser.set_window_size(1024, 768)
# She notices the input box is nicely centered
inputbox = self.browser.find_element_by_id('id_new_item')
self.assertAlmostEqual(
inputbox.location['x'] + inputbox.size['width']/2,
512,
delta=10)
# She starts a new list and sees the input is nicely centered there too
inputbox.send_keys('testing')
inputbox.send_keys(Keys.ENTER)
self.wait_for_row_in_list_table('1: testing')
inputbox = self.browser.find_element_by_id('id_new_item')
self.assertAlmostEqual(
inputbox.location['x'] + inputbox.size['width'] / 2,
512,
delta=10
)