Merge "Integration tests no longer rely on entities' display names in tables"

This commit is contained in:
Jenkins 2015-08-25 13:07:29 +00:00 committed by Gerrit Code Review
commit 98b567e41e
2 changed files with 10 additions and 2 deletions

View File

@ -651,10 +651,14 @@ class Cell(html.HTMLElement):
self.inline_edit_mod = False
# add tooltip to cells if the truncate variable is set
if column.truncate:
# NOTE(tsufiev): trying to pull cell raw data out of datum for
# those columns where truncate is False leads to multiple errors
# in unit tests
data = getattr(datum, column.name, '') or ''
if len(data) > column.truncate:
self.attrs['data-toggle'] = 'tooltip'
self.attrs['title'] = data
self.attrs['data-selenium'] = data
self.data = self.get_data(datum, column, row)
def get_data(self, datum, column, row):

View File

@ -148,10 +148,14 @@ class BasicTableRegion(baseregion.BaseRegion):
searched text, otherwise occurrence of searched text in the column
text will result in row match.
"""
def get_text(element):
text = element.get_attribute('data-selenium')
return text or element.text
for row in self.rows:
if exact_match and text == row.cells[column_index].text:
if exact_match and text == get_text(row.cells[column_index]):
return row
if not exact_match and text in row.cells[column_index].text:
if not exact_match and text in get_text(row.cells[column_index]):
return row
return None