Skip to content

Commit

Permalink
[QOLDEV-955] adjust search facet testing to handle newer markup struc…
Browse files Browse the repository at this point in the history
…ture

- 'title' is replaced with 'data-bs-title'
  • Loading branch information
ThrawnCA committed Jan 28, 2025
1 parent 7dab60f commit cb2c112
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/features/organisations.feature
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ Feature: Organization APIs
# Search facets should be truncated but preserve full name in a tooltip
When I create a dataset and resource with key-value parameters "notes=Testing long org name::owner_org=Org name more than" and "name=Test"
And I press "Org name more than"
Then I should see an element with xpath "//li[contains(@class, 'nav-item')]//a[contains(string(), 'Org name more than') and contains(string(), '...') and contains(@title, 'Org name more than 35 characters')]"
When I press the element with xpath "//li[contains(@class, 'nav-item')]//a[contains(string(), 'Org name more than') and contains(string(), '...') and contains(@title, 'Org name more than 35 characters')]"
Then I should see an element with xpath "//li[contains(@class, 'nav-item') and contains(@class, 'active')]//a[contains(string(), 'Org name more than') and contains(string(), '...') and contains(@title, 'Org name more than 35 characters')]"
Then I should see a search facet for "Org name more than 35 characters" truncated to "Org name more than"
When I press the search facet pointing to "Org name more than 35 characters"
Then I should see an active search facet for "Org name more than 35 characters" truncated to "Org name more than"
When I go to dataset page
Then I should see an element with xpath "//li[contains(@class, 'nav-item')]//a[contains(string(), 'Org name more than') and contains(string(), '...') and contains(@title, 'Org name more than 35 characters')]"
When I press the element with xpath "//li[contains(@class, 'nav-item')]//a[contains(string(), 'Org name more than') and contains(string(), '...') and contains(@title, 'Org name more than 35 characters')]"
Then I should see an element with xpath "//li[contains(@class, 'nav-item') and contains(@class, 'active')]//a[contains(string(), 'Org name more than') and contains(string(), '...') and contains(@title, 'Org name more than 35 characters')]"
Then I should see a search facet for "Org name more than 35 characters" truncated to "Org name more than"
When I press the search facet pointing to "Org name more than 35 characters"
Then I should see an active search facet for "Org name more than 35 characters" truncated to "Org name more than"
21 changes: 21 additions & 0 deletions test/features/steps/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,27 @@ def request_reset(context):
""")


@then(u'I should see a search facet for "{title}" truncated to "{truncated_title}"')
def truncated_facet_visible(context, title, truncated_title):
context.execute_steps(u"""
Then I should see an element with xpath "//li[contains(@class, 'nav-item')]//a[contains(string(), '{truncated_title}') and contains(string(), '...') and (contains(@title, '{title}') or contains(@data-bs-title, '{title}')]"
""".format(title=title, truncated_title=truncated_title))


@then(u'I should see an active search facet for "{title}" truncated to "{truncated_title}"')
def active_truncated_facet_visible(context, title, truncated_title):
context.execute_steps(u"""
Then I should see an element with xpath "//li[contains(@class, 'nav-item') and contains(@class, 'active')]//a[contains(string(), '{truncated_title}') and contains(string(), '...') and (contains(@title, '{title}') or contains(@data-bs-title, '{title}')]"
""".format(title=title, truncated_title=truncated_title))


@when(u'I press the search facet pointing to "{title}"')
def press_search_facet(context, title):
context.execute_steps(u"""
When I press the element with xpath "//li[contains(@class, 'nav-item')]//a[contains(@title, '{0}') or contains(@data-bs-title, '{0}')]"
""".format(title))


@when(u'I fill in "{name}" with "{value}" if present')
def fill_in_field_if_present(context, name, value):
context.execute_steps(u"""
Expand Down

0 comments on commit cb2c112

Please sign in to comment.