Skip to contentSkip to conversation

toaster-tests: maximize browser window when running UI tests

PATCH In review Elliot Smith 3 participants 5 messages Apr 26, 2016 – Jun 9, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toaster-tests: maximize browser window when running UI tests

In some pages of the UI, the UI tests failed because parts of the UI which should be visible were being reported as not visible by the Selenium PhantomJS driver.

On investigation, it turns out that PhantomJS uses a very narrow default window. This meant that some parts of the UI were being clipped and were thus not "visible" to the driver, causing test failures (specifically, on the new custom image page).

Ensure that the window is maximized before running tests to prevent this happening.

---
 bitbake/lib/toaster/tests/browser/selenium_helpers.py | 1 +
 1 file changed, 1 insertion(+)
bitbake/lib/toaster/tests/browser/selenium_helpers.py +1 -0
index 56dbe2b..54db2e8 100644
@@ -130,6 +130,7 @@ class SeleniumTestCase(StaticLiveServerTestCase):
         # instantiate the Selenium webdriver once for all the test methods
         # in this test case
         cls.driver = create_selenium_driver()
+        cls.driver.maximize_window()
 
     @classmethod
     def tearDownClass(cls):
Signature · 12 lines
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#1 lore raw
Quoted 8 lines · On 26/04/2016 17:12, "[email protected] on behalf of Elliot…

In some pages of the UI, the UI tests failed because parts of the UI which should be visible were being reported as not visible by the Selenium PhantomJS driver.

On investigation, it turns out that PhantomJS uses a very narrow default window. This meant that some parts of the UI were being clipped and were thus not "visible" to the driver, causing test failures (specifically, on the new custom image page).

Interesting: Bootstrap is responsive, so stuff should still be visible. Although our implementation of the responsive layout is not very clean, components (with the exception of tables in very narrow viewports) should wrap or stack vertically.

Do you happen to know what's the viewport size of the PhantomJS default window? Figuring out what's going on might help with the work migrating to Bootstrap 3.

Thanks!

Belén

Quoted 42 lines

Ensure that the window is maximized before running tests to prevent this happening.

---
bitbake/lib/toaster/tests/browser/selenium_helpers.py | 1 +

1 file changed, 1 insertion(+)
bitbake/lib/toaster/tests/browser/selenium_helpers.py +0 -0
index 56dbe2b..54db2e8 100644
@@ -130,6 +130,7 @@ class SeleniumTestCase(StaticLiveServerTestCase):
        # instantiate the Selenium webdriver once for all the test

methods

        # in this test case
        cls.driver = create_selenium_driver()
+        cls.driver.maximize_window()

@classmethod
def tearDownClass(cls):

Signature · 18 lines
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

-- 
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster
#2 lore raw
Quoted 13 lines · Belen
Quoted 8 lines · On 26/04/2016 17:12, "[email protected] on behalf of Elliot…

In some pages of the UI, the UI tests failed because parts of the UI which should be visible were being reported as not visible by the Selenium PhantomJS driver.

On investigation, it turns out that PhantomJS uses a very narrow default window. This meant that some parts of the UI were being clipped and were thus not "visible" to the driver, causing test failures (specifically, on the new custom image page).

Quoted 9 lines

Interesting: Bootstrap is responsive, so stuff should still be visible. Although our implementation of the responsive layout is not very clean, components (with the exception of tables in very narrow viewports) should wrap or stack vertically.

Do you happen to know what's the viewport size of the PhantomJS default window? Figuring out what's going on might help with the work migrating to Bootstrap 3.

About 194px. I've attached a screenshot.

Elliot

Quoted 49 lines

Thanks!

Belén

Quoted 42 lines

Ensure that the window is maximized before running tests to prevent this happening.

---
bitbake/lib/toaster/tests/browser/selenium_helpers.py | 1 +

1 file changed, 1 insertion(+)
bitbake/lib/toaster/tests/browser/selenium_helpers.py +0 -0
index 56dbe2b..54db2e8 100644
@@ -130,6 +130,7 @@ class SeleniumTestCase(StaticLiveServerTestCase):
        # instantiate the Selenium webdriver once for all the test

methods

        # in this test case
        cls.driver = create_selenium_driver()
+        cls.driver.maximize_window()

@classmethod
def tearDownClass(cls):
--
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Signature · 3 lines
Elliot Smith
Software Engineer
Intel Open Source Technology Centre
#3 lore raw
Quoted 21 lines · Elliot

On 28 April 2016 at 14:23, Barros Pena, Belen
<[email protected]> wrote:

Quoted 8 lines · On 26/04/2016 17:12, "[email protected] on behalf of Elliot…

In some pages of the UI, the UI tests failed because parts of the UI which should be visible were being reported as not visible by the Selenium PhantomJS driver.

On investigation, it turns out that PhantomJS uses a very narrow default window. This meant that some parts of the UI were being clipped and were thus not "visible" to the driver, causing test failures (specifically, on the new custom image page).

Interesting: Bootstrap is responsive, so stuff should still be visible. Although our implementation of the responsive layout is not very clean, components (with the exception of tables in very narrow viewports) should wrap or stack vertically.

Quoted 8 lines

Do you happen to know what's the viewport size of the PhantomJS default window? Figuring out what's going on might help with the work migrating to Bootstrap 3.

About 194px. I've attached a screenshot.

Excellent: so tables and modals are causing the trouble. This is good to know.

Thanks!

Belén

Quoted 71 lines

Elliot

Thanks!

Belén

Quoted 44 lines

Ensure that the window is maximized before running tests to prevent this happening.

---
bitbake/lib/toaster/tests/browser/selenium_helpers.py | 1 +

1 file changed, 1 insertion(+)
bitbake/lib/toaster/tests/browser/selenium_helpers.py +0 -0
index 56dbe2b..54db2e8 100644
@@ -130,6 +130,7 @@ class SeleniumTestCase(StaticLiveServerTestCase):
        # instantiate the Selenium webdriver once for all the test

methods

        # in this test case
        cls.driver = create_selenium_driver()
+        cls.driver.maximize_window()

@classmethod
def tearDownClass(cls):
--
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Signature · 3 lines
Elliot Smith
Software Engineer
Intel Open Source Technology Centre
#4 lore raw

Thanks - Added to toaster-next

Michael

Quoted 105 lines · Belen
Quoted 20 lines · Elliot

On 28 April 2016 at 14:23, Barros Pena, Belen
<[email protected]> wrote:

Quoted 8 lines · On 26/04/2016 17:12, "[email protected] on behalf of Elliot…

In some pages of the UI, the UI tests failed because parts of the UI which should be visible were being reported as not visible by the Selenium PhantomJS driver.

On investigation, it turns out that PhantomJS uses a very narrow default window. This meant that some parts of the UI were being clipped and were thus not "visible" to the driver, causing test failures (specifically, on the new custom image page).

Interesting: Bootstrap is responsive, so stuff should still be visible. Although our implementation of the responsive layout is not very clean, components (with the exception of tables in very narrow viewports) should wrap or stack vertically.

Quoted 8 lines

Do you happen to know what's the viewport size of the PhantomJS default window? Figuring out what's going on might help with the work migrating to Bootstrap 3.

About 194px. I've attached a screenshot.

Excellent: so tables and modals are causing the trouble. This is good to know.

Thanks!

Belén

Quoted 67 lines

Elliot

Thanks!

Belén

Quoted 42 lines

Ensure that the window is maximized before running tests to prevent this happening.

---
bitbake/lib/toaster/tests/browser/selenium_helpers.py | 1 +

1 file changed, 1 insertion(+)
bitbake/lib/toaster/tests/browser/selenium_helpers.py +0 -0
index 56dbe2b..54db2e8 100644
@@ -130,6 +130,7 @@ class SeleniumTestCase(StaticLiveServerTestCase):
         # instantiate the Selenium webdriver once for all the test

methods

         # in this test case
         cls.driver = create_selenium_driver()
+        cls.driver.maximize_window()

@classmethod
def tearDownClass(cls):
--
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Signature · 3 lines
Elliot Smith
Software Engineer
Intel Open Source Technology Centre