Skip to content

Commit

Permalink
[QOLDEV-955] prepare scenario test expectations for latest CKAN
Browse files Browse the repository at this point in the history
  • Loading branch information
ThrawnCA committed Nov 20, 2024
1 parent bff3e3b commit 6114909
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test/features/resources.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Feature: Resource UI
When I log in
And I open the new resource form for dataset "test-dataset"
And I create a resource with key-value parameters "name=<name>::url=<url>"
And I press the element with xpath "//a[contains(@title, '<name>') and contains(string(), '<name>')]"
And I press the element with xpath "//a[(contains(@title, '<name>') or contains(@data-bs-title, '<name>')) and contains(string(), '<name>')]"
Then I should see "<url>"

Examples:
Expand Down
12 changes: 7 additions & 5 deletions test/features/steps/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ def log_in_directly(context):
:return:
"""

assert context.persona, "A persona is required to log in, found [{}] in context. Have you configured the personas in before_scenario?".format(context.persona)
assert context.persona, "A persona is required to log in, found [{}] in context." \
" Have you configured the personas in before_scenario?".format(context.persona)
context.execute_steps(u"""
When I attempt to log in with password "$password"
Then I should see an element with xpath "//*[@title='Log out']/i[contains(@class, 'fa-sign-out')]"
Then I should see an element with xpath "//*[@title='Log out' or @data-bs-title='Log out']/i[contains(@class, 'fa-sign-out')]"
""")


Expand Down Expand Up @@ -161,7 +162,8 @@ def go_to_new_resource_form(context, name):
""")
else:
# Existing dataset, browse to the resource form
if context.browser.is_element_present_by_xpath("//a[contains(string(), 'Resources') and contains(@href, '/dataset/resources/')]"):
if context.browser.is_element_present_by_xpath(
"//a[contains(string(), 'Resources') and contains(@href, '/dataset/resources/')]"):
context.execute_steps(u"""
When I press "Resources"
""")
Expand Down Expand Up @@ -254,7 +256,7 @@ def fill_in_default_link_resource_fields(context):
@when(u'I upload "{file_name}" of type "{file_format}" to resource')
def upload_file_to_resource(context, file_name, file_format):
context.execute_steps(u"""
When I execute the script "$('#resource-upload-button').trigger(click);"
When I execute the script "$('#resource-upload-button').trigger('click');"
And I attach the file "{file_name}" to "upload"
# Don't quote the injected string since it can have trailing spaces
And I execute the script "document.getElementById('field-format').value='{file_format}'"
Expand Down Expand Up @@ -476,7 +478,7 @@ def go_to_admin_config(context):
@when(u'I log out')
def log_out(context):
context.execute_steps(u"""
When I press the element with xpath "//*[@title='Log out']"
When I press the element with xpath "//*[@title='Log out' or @data-bs-title='Log out']"
Then I should see "Log in"
""")

Expand Down
2 changes: 1 addition & 1 deletion test/features/users.feature
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,6 @@ Feature: User APIs
Then I should see "Promoted Test Admin to sysadmin"
And I should see an element with xpath "//table//a[string() = 'Test Admin' and @href = '/user/test_org_admin']"

When I press the element with xpath "//tr/td/a[@href = '/user/test_org_admin']/../following-sibling::td//button[contains(@title, 'Revoke')]"
When I press the element with xpath "//tr/td/a[@href = '/user/test_org_admin']/../following-sibling::td//button[contains(@title, 'Revoke') or contains(@data-bs-title, 'Revoke')]"
Then I should see "Revoked sysadmin permission from Test Admin"
And I should not see an element with xpath "//table//a[@href = '/user/test_org_admin']"

0 comments on commit 6114909

Please sign in to comment.