Skip to content

Commit

Permalink
[QOLSVC-8587] sync scenario testing with Open Data theme
Browse files Browse the repository at this point in the history
  • Loading branch information
ThrawnCA committed Dec 13, 2024
1 parent a7a0e38 commit 32489f8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
20 changes: 9 additions & 11 deletions test/features/organisations.feature
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,19 @@ Feature: Organization APIs
When I log in
And I go to organisation page
And I click the link to "/organization/new"
And I fill in "title" with "Org name more than 35 characters aaaaaaaaaaaa"
# This is actually the URL
And I fill in "name" with "org-name-more-than-35-characters-aaaaaaaaaaaa" if present
And I fill in title with random text starting with "Org name more than 35 characters"
And I press the element with xpath "//button[contains(@class, 'btn-primary')]"
And I take a debugging screenshot
# Breadcrumb should be truncated but preserve full name in a tooltip
Then I should see an element with xpath "//ol[contains(@class, 'breadcrumb')]//a[contains(string(), 'Org name more than') and contains(string(), '...') and @title = 'Org name more than 35 characters aaaaaaaaaaaa']"
Then I should see an element with xpath "//ol[contains(@class, 'breadcrumb')]//a[contains(string(), 'Org name more than') and contains(string(), '...') and contains(@title, 'Org name more than 35 characters')]"

# 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 35 characters aaaaaaaaaaaa" and "name=Test"
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 @title = 'Org name more than 35 characters aaaaaaaaaaaa']"
When I press the element with xpath "//li[contains(@class, 'nav-item')]//a[contains(string(), 'Org name more than') and contains(string(), '...') and @title = 'Org name more than 35 characters aaaaaaaaaaaa']"
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 @title = 'Org name more than 35 characters aaaaaaaaaaaa']"
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')]"
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 @title = 'Org name more than 35 characters aaaaaaaaaaaa']"
When I press the element with xpath "//li[contains(@class, 'nav-item')]//a[contains(string(), 'Org name more than') and contains(string(), '...') and @title = 'Org name more than 35 characters aaaaaaaaaaaa']"
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 @title = 'Org name more than 35 characters aaaaaaaaaaaa']"
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')]"
13 changes: 11 additions & 2 deletions test/features/steps/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,15 @@ def select_licence(context, licence_id):
""".format(licence_id))


@when(u'I select the organisation with title "{title}"')
def select_organisation(context, title):
# Organisation requires special interaction due to fancy JavaScript
context.execute_steps(u"""
When I execute the script "org_uuid=$('#field-organizations').find('option:contains({0})').val(); $('#field-organizations').val(org_uuid).trigger('change')"
And I take a debugging screenshot
""".format(title))


@when(u'I enter the resource URL "{url}"')
def enter_resource_url(context, url):
if url != "default":
Expand Down Expand Up @@ -453,8 +462,8 @@ def _create_dataset_from_params(context, params):
if key == "owner_org":
# Owner org uses UUIDs as its values, so we need to rely on displayed text
context.execute_steps(u"""
When I select by text "{1}" from "{0}"
""".format(key, value))
When I select the organisation with title "{0}"
""".format(value))
elif key in ["update_frequency", "request_privacy_assessment", "private"]:
context.execute_steps(u"""
When I select "{1}" from "{0}"
Expand Down

0 comments on commit 32489f8

Please sign in to comment.