Skip to content

Commit

Permalink
[QOLDEV-312] adjust schema alignment test expectations to handle non-…
Browse files Browse the repository at this point in the history
…JS better

- Don't rely on the text being present or absent, examine the state of the checkbox
  • Loading branch information
ThrawnCA committed Sep 5, 2023
1 parent 75b7942 commit c45571d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/features/resource_align_default_schema.feature
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Feature: Resource align_default_schema field

# now default and resource schema are the same
When I press "Manage"
Then I should not see "Align this data schema with the dataset default"
Then I should not see an element with xpath "//input[@name='align_default_schema' and not(@checked)]"

# now default and resource schema are different
When I execute the script "$('#field-schema-json ~ a.btn-remove-url').click()"
Expand All @@ -89,14 +89,16 @@ Feature: Resource align_default_schema field
When I press the element with xpath "//button[string()='Update Resource']"
And I press "Manage"
Then I should see "Align this data schema with the dataset default"
And I should see an element with xpath "//input[@name='align_default_schema' and not(@checked)]"

When I press the element with xpath "//button[string()='Update Resource']"
And I click the link with text "View Schema File"
Then I should see an element with xpath "//body[contains(string(), '"Resource schema"')]"

When I go back
And I press "Manage"
Then I should see an element with xpath "//input[@type='checkbox' and @name='align_default_schema' and not(@checked)]/following-sibling::label[@for='field-align_default_schema' and contains(string(), 'Align this data schema with the dataset default')]"
Then I should see "Align this data schema with the dataset default"
And I should see an element with xpath "//input[@name='align_default_schema' and not(@checked)]"

When I check "align_default_schema"
And I press the element with xpath "//button[string()='Update Resource']"
Expand Down
1 change: 1 addition & 0 deletions test/features/steps/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ def reveal_non_js_schema_fields(context):
When I execute the script "$('#resource-schema-buttons ~ div.form-group').attr('style', '')"
""")


# Enter a JSON schema value
# This can require JavaScript interaction, and doesn't fit well into
# a step invocation due to all the double quotes.
Expand Down

0 comments on commit c45571d

Please sign in to comment.