diff --git a/test/features/organisations.feature b/test/features/organisations.feature index 098fa0e9..f60aa523 100644 --- a/test/features/organisations.feature +++ b/test/features/organisations.feature @@ -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')]" diff --git a/test/features/steps/steps.py b/test/features/steps/steps.py index ea07b481..f7e66a2b 100644 --- a/test/features/steps/steps.py +++ b/test/features/steps/steps.py @@ -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": @@ -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}"