summaryrefslogtreecommitdiff
path: root/openstack_dashboard/dashboards/project/images/tests.py
diff options
context:
space:
mode:
authorIvan Kolodyazhny <e0ne@e0ne.info>2018-04-03 00:40:19 +0300
committerIvan Kolodyazhny <e0ne@e0ne.info>2018-06-08 12:22:10 +0000
commitee95bf15d994836e8c9e9e9c94474e1d1cc75b5d (patch)
treec4cbdb99eb60964ab8e193fb3e57c200a5c62809 /openstack_dashboard/dashboards/project/images/tests.py
parent1f80d94459856a8c477310cc0fe4b0e165d8c0c1 (diff)
downloadhorizon-ee95bf15d994836e8c9e9e9c94474e1d1cc75b5d.tar.gz
Fix selenuim-headless tests
This patch leave selenuim-headless non-voting since it was broken for a while so we should be sure that it's stable enough. Related blueprint: improve-horizon-testing Change-Id: Ic2a877a4eefc2f10fb25e64c387b81fc18302a2a
Diffstat (limited to 'openstack_dashboard/dashboards/project/images/tests.py')
-rw-r--r--openstack_dashboard/dashboards/project/images/tests.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/openstack_dashboard/dashboards/project/images/tests.py b/openstack_dashboard/dashboards/project/images/tests.py
index afcee9f6c..8887cc4d6 100644
--- a/openstack_dashboard/dashboards/project/images/tests.py
+++ b/openstack_dashboard/dashboards/project/images/tests.py
@@ -19,6 +19,7 @@
import os
from socket import timeout as socket_timeout
+import tempfile
import unittest
from django import http
@@ -376,13 +377,12 @@ class SeleniumTests(test.SeleniumTestCase):
driver.get("%s%s" % (self.live_server_url, INDEX_URL))
# Open the modal menu
- driver.find_element_by_id("images__action_create").send_keys("\n")
+ driver.find_element_by_id("images__action_create").click()
wait = self.ui.WebDriverWait(self.selenium, 10,
ignored_exceptions=[socket_timeout])
wait.until(lambda x: driver.find_element_by_id("id_disk_format"))
- srctypes = self.ui.Select(driver.find_element_by_id("id_source_type"))
- srctypes.select_by_value("url")
+ driver.find_element_by_xpath('//a[@data-select-value="url"]').click()
copyfrom = driver.find_element_by_id("id_image_url")
copyfrom.send_keys("http://www.test.com/test.iso")
formats = self.ui.Select(driver.find_element_by_id("id_disk_format"))
@@ -412,15 +412,16 @@ class SeleniumTests(test.SeleniumTestCase):
driver.get("%s%s" % (self.live_server_url, INDEX_URL))
# Open the modal menu
- driver.find_element_by_id("images__action_create").send_keys("\n")
+ driver.find_element_by_id("images__action_create").click()
wait = self.ui.WebDriverWait(driver, 10,
ignored_exceptions=[socket_timeout])
wait.until(lambda x: driver.find_element_by_id("id_disk_format"))
- srctypes = self.ui.Select(driver.find_element_by_id("id_source_type"))
- srctypes.select_by_value("file")
- driver.find_element_by_id("id_image_file").send_keys("/tmp/test.iso")
+ driver.find_element_by_xpath('//a[@data-select-value="file"]').click()
+ with tempfile.NamedTemporaryFile() as tmp:
+ driver.find_element_by_id("id_image_file").send_keys(tmp.name)
formats = self.ui.Select(driver.find_element_by_id("id_disk_format"))
+ formats.select_by_visible_text('ISO - Optical Disk Image')
body = formats.first_selected_option
self.assertIn("ISO", body.text,
"ISO should be selected when the extension is *.iso")
@@ -443,11 +444,11 @@ class SeleniumTests(test.SeleniumTestCase):
ignored_exceptions=[socket_timeout])
wait.until(lambda x: driver.find_element_by_id("id_disk_format"))
- srctypes = self.ui.Select(driver.find_element_by_id("id_source_type"))
- srctypes.select_by_value("url")
+ driver.find_element_by_xpath('//a[@data-select-value="url"]').click()
copyfrom = driver.find_element_by_id("id_image_url")
copyfrom.send_keys("http://www.test.com/test.iso")
formats = self.ui.Select(driver.find_element_by_id("id_disk_format"))
+ formats.select_by_visible_text('ISO - Optical Disk Image')
body = formats.first_selected_option
self.assertIn("ISO", body.text,
"ISO should be selected when the extension is *.iso")
@@ -472,10 +473,12 @@ class SeleniumTests(test.SeleniumTestCase):
ignored_exceptions=[socket_timeout])
wait.until(lambda x: driver.find_element_by_id("id_disk_format"))
- srctypes = self.ui.Select(driver.find_element_by_id("id_source_type"))
- srctypes.select_by_value("file")
- driver.find_element_by_id("id_image_file").send_keys("/tmp/test.iso")
+ driver.find_element_by_xpath('//a[@data-select-value="file"]').click()
+ with tempfile.NamedTemporaryFile() as tmp:
+ driver.find_element_by_id("id_image_file").send_keys(tmp.name)
formats = self.ui.Select(driver.find_element_by_id("id_disk_format"))
+ formats.select_by_visible_text('ISO - Optical Disk Image')
body = formats.first_selected_option
+
self.assertIn("ISO", body.text,
"ISO should be selected when the extension is *.iso")