fix window sizes in tests

This commit is contained in:
Trent Palmer 2021-09-08 15:07:41 -07:00
parent 8730970956
commit e33847df1c
3 changed files with 9 additions and 7 deletions

View File

@ -14,8 +14,8 @@ class TestScroll(TestSelenium, TestCase):
self.driver.execute_script( self.driver.execute_script(
"window.scrollTo(0,document.body.scrollHeight)" "window.scrollTo(0,document.body.scrollHeight)"
) )
self.assertEqual( self.assertGreaterEqual(
self.driver.execute_script("return window.pageYOffset"), 12461) self.driver.execute_script("return window.pageYOffset"), 12061)
def test_plus_button_scroll_to_top(self): def test_plus_button_scroll_to_top(self):
self.assertEqual( self.assertEqual(
@ -23,8 +23,8 @@ class TestScroll(TestSelenium, TestCase):
self.driver.execute_script( self.driver.execute_script(
"window.scrollTo(0,document.body.scrollHeight)" "window.scrollTo(0,document.body.scrollHeight)"
) )
self.assertEqual( self.assertGreaterEqual(
self.driver.execute_script("return window.pageYOffset"), 12461) self.driver.execute_script("return window.pageYOffset"), 12061)
self.plus_button.click() self.plus_button.click()
self.assertEqual( self.assertEqual(
self.driver.execute_script("return window.pageYOffset"), 0) self.driver.execute_script("return window.pageYOffset"), 0)
@ -36,8 +36,8 @@ class TestScroll(TestSelenium, TestCase):
self.driver.execute_script( self.driver.execute_script(
"window.scrollTo(0,document.body.scrollHeight)" "window.scrollTo(0,document.body.scrollHeight)"
) )
self.assertEqual( self.assertGreaterEqual(
self.driver.execute_script("return window.pageYOffset"), 12573) self.driver.execute_script("return window.pageYOffset"), 12125)
self.minus_button.click() self.minus_button.click()
self.assertEqual( self.assertEqual(
self.driver.execute_script("return window.pageYOffset"), 0) self.driver.execute_script("return window.pageYOffset"), 0)

View File

@ -15,6 +15,7 @@ SOURCE_PAGE = f'file://{str(SOURCE_FILE)}'
class TestSelenium(TestCase): class TestSelenium(TestCase):
def setUp(self): def setUp(self):
self.driver = webdriver.Chrome(options=OPTIONS, service=SERVICE) self.driver = webdriver.Chrome(options=OPTIONS, service=SERVICE)
self.driver.set_window_size(1920, 1080)
self.driver.get(SOURCE_PAGE) self.driver.get(SOURCE_PAGE)
def tearDown(self): def tearDown(self):

View File

@ -13,7 +13,8 @@ class TestTitle(TestSelenium, TestCase):
self.assertEqual( self.assertEqual(
self.x[0].value_of_css_property('text-align'), 'center') self.x[0].value_of_css_property('text-align'), 'center')
self.assertEqual(self.x[0].value_of_css_property('display'), 'block') self.assertEqual(self.x[0].value_of_css_property('display'), 'block')
self.assertEqual(self.x[0].value_of_css_property('max-width'), '736px') self.assertEqual(
self.x[0].value_of_css_property('max-width'), '1856px')
self.assertEqual(self.x[0].value_of_css_property('font-size'), '32px') self.assertEqual(self.x[0].value_of_css_property('font-size'), '32px')
self.assertEqual(self.x[0].value_of_css_property('font-weight'), '700') self.assertEqual(self.x[0].value_of_css_property('font-weight'), '700')
self.assertEqual( self.assertEqual(