From c45571dd05a4934667c50293138380975574ee00 Mon Sep 17 00:00:00 2001 From: ThrawnCA Date: Tue, 5 Sep 2023 17:09:38 +1000 Subject: [PATCH] [QOLDEV-312] adjust schema alignment test expectations to handle non-JS better - Don't rely on the text being present or absent, examine the state of the checkbox --- test/features/resource_align_default_schema.feature | 6 ++++-- test/features/steps/steps.py | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/features/resource_align_default_schema.feature b/test/features/resource_align_default_schema.feature index cbefeea0..a536517c 100644 --- a/test/features/resource_align_default_schema.feature +++ b/test/features/resource_align_default_schema.feature @@ -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()" @@ -89,6 +89,7 @@ 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" @@ -96,7 +97,8 @@ Feature: Resource align_default_schema field 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']" diff --git a/test/features/steps/steps.py b/test/features/steps/steps.py index 2f7de52c..cffdc58a 100644 --- a/test/features/steps/steps.py +++ b/test/features/steps/steps.py @@ -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.