Browse Source

Zoom out pages in i9n tests

Since Selenium 2.50.1 release it's no longer possible to click
elements which are outside of visible viewport. To keep both tests
working and error screenshots still visible, standard xvfb screensize
is set to 1920x1080 and page scale is set to 67%.

Also temporarily disable create_instance test since it fails on some
nodes due to missing network.

Related-Bug: #1542211
Closes-Bug: #1541876
Change-Id: Ie96606cf52860dd8bb3286971962a16cb3415daf
changes/23/276123/5
Timur Sufiev 5 years ago
parent
commit
5a9413c28b
2 changed files with 18 additions and 1 deletions
  1. +16
    -1
      openstack_dashboard/test/integration_tests/helpers.py
  2. +2
    -0
      openstack_dashboard/test/integration_tests/tests/test_instances.py

+ 16
- 1
openstack_dashboard/test/integration_tests/helpers.py View File

@ -17,6 +17,9 @@ import time
import traceback
import uuid
from selenium.webdriver.common import action_chains
from selenium.webdriver.common import by
from selenium.webdriver.common import keys
import testtools
import xvfbwrapper
@ -54,7 +57,7 @@ class BaseTestCase(testtools.TestCase):
if os.environ.get('INTEGRATION_TESTS', False):
# Start a virtual display server for running the tests headless.
if os.environ.get('SELENIUM_HEADLESS', False):
self.vdisplay = xvfbwrapper.Xvfb(width=1280, height=720)
self.vdisplay = xvfbwrapper.Xvfb(width=1920, height=1080)
args = []
# workaround for memory leak in Xvfb taken from:
@ -127,6 +130,17 @@ class BaseTestCase(testtools.TestCase):
finally:
self.addDetail("PageHTMLSource.html", content)
def zoom_out(self, times=3):
"""Zooming out prevents different elements being driven out of xvfb
viewport (which in Selenium>=2.50.1 prevents interaction with them.
"""
html = self.driver.find_element(by.By.TAG_NAME, 'html')
html.send_keys(keys.Keys.NULL)
zoom_out_keys = (keys.Keys.SUBTRACT,) * times
action_chains.ActionChains(self.driver).key_down(
keys.Keys.CONTROL).send_keys(*zoom_out_keys).key_up(
keys.Keys.CONTROL).perform()
def _save_screenshot(self, exc_info):
screenshot_dir = os.path.join(
ROOT_PATH,
@ -169,6 +183,7 @@ class TestCase(BaseTestCase):
super(TestCase, self).setUp()
self.login_pg = loginpage.LoginPage(self.driver, self.CONFIG)
self.login_pg.go_to_login_page()
self.zoom_out()
self.home_pg = self.login_pg.login(self.TEST_USER_NAME,
self.TEST_PASSWORD)


+ 2
- 0
openstack_dashboard/test/integration_tests/tests/test_instances.py View File

@ -9,6 +9,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from openstack_dashboard.test.integration_tests import decorators
from openstack_dashboard.test.integration_tests import helpers
from openstack_dashboard.test.integration_tests.regions import messages
@ -16,6 +17,7 @@ INSTANCES_NAME = helpers.gen_random_resource_name('instance',
timestamp=False)
@decorators.skip_because(bugs=["1542211"])
class TestInstances(helpers.AdminTestCase):
"""This is a basic scenario to test:
* Create Instance and Delete Instance


Loading…
Cancel
Save