diff --git a/test/features/data_usability_rating.feature b/test/features/data_usability_rating.feature index 438ff13a..7d4bf012 100644 --- a/test/features/data_usability_rating.feature +++ b/test/features/data_usability_rating.feature @@ -9,9 +9,9 @@ Feature: Data usability rating And I create a dataset and resource with key-value parameters "license=other-open" and "format=::upload=" And I press the element with xpath "//ol[contains(@class, 'breadcrumb')]//a[starts-with(@href, '/dataset/')]" And I reload page every 3 seconds until I see an element with xpath "//div[contains(@class, 'qa') and contains(@class, 'openness-')]" but not more than 10 times - Then I should see "Data usability rating" + Then I should see data usability rating When I press "Test Resource" - Then I should see an element with xpath "//div[contains(@class, 'qa openness-')]" + Then I should see data usability rating Examples: Formats | Format | Filename | Score | diff --git a/test/features/steps/steps.py b/test/features/steps/steps.py index dfe4f05d..75b5dccc 100644 --- a/test/features/steps/steps.py +++ b/test/features/steps/steps.py @@ -95,10 +95,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')]" """) @@ -187,9 +188,13 @@ 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/')]"): + context.execute_steps(u""" + When I press "Resources" + """) context.execute_steps(u""" - When I press "Resources" - And I press "Add new resource" + When I press "Add new resource" And I take a debugging screenshot """) @@ -548,7 +553,7 @@ def create_resource_from_params(context, resource_params): """.format(key, value)) context.execute_steps(u""" When I take a debugging screenshot - And I press the element with xpath "//form[contains(@class, 'resource-form')]//button[contains(@class, 'btn-primary')]" + And I press the element with xpath "//form[contains(@data-module, 'resource-form')]//button[contains(@class, 'btn-primary')]" And I take a debugging screenshot """) @@ -569,11 +574,7 @@ def filter_contents(mail): payload_bytes = quopri.decodestring(payload) if len(payload_bytes) > 0: payload_bytes += b'=' # do fix the padding error issue - if six.PY2: - decoded_payload = payload_bytes.decode('base64') - else: - import base64 - decoded_payload = six.ensure_text(base64.b64decode(six.ensure_binary(payload_bytes))) + decoded_payload = six.ensure_text(base64.b64decode(six.ensure_binary(payload_bytes))) print('Searching for', text, ' and ', text2, ' in decoded_payload: ', decoded_payload) return text in decoded_payload and (not text2 or text2 in decoded_payload) @@ -792,6 +793,16 @@ def go_to_data_request_comments(context, subject): """ % (subject)) +# ckanext-qa + + +@then(u'I should see data usability rating {score}') +def data_usability_rating_visible(context, score): + context.execute_steps(u""" + Then I should see an element with xpath "//div[contains(@class, 'openness-{0}')]" + """.format(score)) + + # ckanext-report