Fix 3-components accessors for TabbedTables in i9n tests

When using just 2 last segments of the path to table for generating
accessor method name it's possible that resulting names will clash,
say for Project->Compute->Volumes->Volumes and for
Admin->System->Volumes->Volumes. To avoid this situation, we need to
use 3 components name for tables which are at 4th level of nesting.

Change-Id: If63ae14a99f4c53030927f96a69b7189bd83c4e5
Closes-Bug: #1467615
This commit is contained in:
Timur Sufiev 2015-11-06 21:14:04 +03:00
parent 54495c3185
commit 4dad7c5004
3 changed files with 11 additions and 7 deletions

View File

@ -278,11 +278,13 @@ class Navigation(object):
* consist of 'go_to_subsubmenu_menuitem_page'
"""
submenu, menu_item = self.path[-2:]
if len(self.path) < 4:
path_2_name = list(self.path[-2:])
else:
path_2_name = list(self.path[-3:])
name = "".join((self.METHOD_NAME_PREFIX, submenu,
self.METHOD_NAME_DELIMITER, menu_item,
self.METHOD_NAME_SUFFIX))
name = self.METHOD_NAME_DELIMITER.join(path_2_name)
name = self.METHOD_NAME_PREFIX + name + self.METHOD_NAME_SUFFIX
name = Navigation.unify_page_path(name, preserve_spaces=False)
return name

View File

@ -21,7 +21,7 @@ class TestFloatingip(helpers.TestCase):
def test_floatingip(self):
floatingip_page = \
self.home_pg.go_to_accessandsecurity_floatingipspage()
self.home_pg.go_to_compute_accessandsecurity_floatingipspage()
floating_ip = floatingip_page.allocate_floatingip()
self.assertTrue(floatingip_page.is_floatingip_present(floating_ip))

View File

@ -23,10 +23,12 @@ class TestKeypair(helpers.TestCase):
KEYPAIR_NAME = helpers.gen_random_resource_name("keypair")
def test_keypair(self):
keypair_page = self.home_pg.go_to_accessandsecurity_keypairspage()
keypair_page = self.home_pg.\
go_to_compute_accessandsecurity_keypairspage()
keypair_page.create_keypair(self.KEYPAIR_NAME)
keypair_page = self.home_pg.go_to_accessandsecurity_keypairspage()
keypair_page = self.home_pg.\
go_to_compute_accessandsecurity_keypairspage()
self.assertTrue(keypair_page.is_keypair_present(self.KEYPAIR_NAME))
keypair_page.delete_keypair(self.KEYPAIR_NAME)