Skip to contentSkip to conversation

toaster: tests test_new_project_page Catch button not enabled exception

PATCH In review Michael Wood 2 participants 2 messages Aug 2, 2016 – Aug 5, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toaster: tests test_new_project_page Catch button not enabled exception

When using firefox and selenium we get an exception generated when a disabled button click is attempted. This should happen in the test but we need to catch the exception to make sure it doesn't cause the test to fail.

[YOCTO #10056]

---
 bitbake/lib/toaster/tests/browser/test_new_project_page.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
bitbake/lib/toaster/tests/browser/test_new_project_page.py +5 -1
index 1b038ac..77e5f15 100644
@@ -22,6 +22,7 @@
 from django.core.urlresolvers import reverse
 from tests.browser.selenium_helpers import SeleniumTestCase
 from selenium.webdriver.support.ui import Select
+from selenium.common.exceptions import InvalidElementStateException
 
 from orm.models import Project, Release, BitbakeVersion
 
@@ -102,7 +103,10 @@ class TestNewProjectPage(SeleniumTestCase):
 
         # Try and click it anyway, if it submits we'll have a new project in
         # the db and assert then
-        self.click("#create-project-button")
+        try:
+            self.click("#create-project-button")
+        except InvalidElementStateException:
+            pass
 
         self.assertTrue(
             (Project.objects.filter(name=project_name).count() == 1),
Signature · 1 line
2.7.4
#1 lore raw

Sent to bitbake-devel and added to toaster-next.

Thanks.
Elliot

Quoted 47 lines · Michael Wood

When using firefox and selenium we get an exception generated when a disabled button click is attempted. This should happen in the test but we need to catch the exception to make sure it doesn't cause the test to fail.

[YOCTO #10056]

---
 bitbake/lib/toaster/tests/browser/test_new_project_page.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
bitbake/lib/toaster/tests/browser/test_new_project_page.py +1 -0
index 1b038ac..77e5f15 100644
@@ -22,6 +22,7 @@
 from django.core.urlresolvers import reverse
 from tests.browser.selenium_helpers import SeleniumTestCase
 from selenium.webdriver.support.ui import Select
+from selenium.common.exceptions import InvalidElementStateException
 
 from orm.models import Project, Release, BitbakeVersion
 
@@ -102,7 +103,10 @@ class TestNewProjectPage(SeleniumTestCase):
 
         # Try and click it anyway, if it submits we'll have a new project

in

         # the db and assert then
bitbake/lib/toaster/tests/browser/test_new_project_page.py +4 -2
-        self.click("#create-project-button")
+        try:
+            self.click("#create-project-button")
+        except InvalidElementStateException:
+            pass
 
         self.assertTrue(
             (Project.objects.filter(name=project_name).count() == 1),
--

2.7.4

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

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