-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drop Select2 #7701
Drop Select2 #7701
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Remove Select2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,8 +25,8 @@ Feature: Distribution Channel Mapping | |
Then I should see a "Create Distribution Channel Map" text | ||
When I enter "SUSE Linux Enterprise Server 15 SP 4" as "os" | ||
And I enter "15.5" as "release" | ||
And I select "x86_64" from "architecture" dropdown | ||
And I select "SLE-Product-SLES15-SP4-Pool for x86_64" from "channel_label" dropdown | ||
And I select "x86_64" from "architecture" | ||
And I select "SLE-Product-SLES15-SP4-Pool for x86_64" from "channel_label" | ||
Comment on lines
+28
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be better to hide these technical details inside new step definitions too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In that case, do you want to add this to all other tests that use dropdowns? We do the same for dropdowns everywhere else: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @srbarrios ping. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, I think I did not get it the first time. I see, so we already have a step definition doing exactly the same, but without Still, we should improve it later, and don't use element ids as step definition parameters, exposing them in the Gherkin text, instead, we should be hiding this inside the step. Example:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or see my proposal above. |
||
And I click on "Create Mapping" | ||
Then I should see a "SUSE Linux Enterprise Server 15 SP 4" link in the content area | ||
|
||
|
@@ -37,8 +37,8 @@ Feature: Distribution Channel Mapping | |
Then I should see a "Create Distribution Channel Map" text | ||
When I enter "openSUSE Leap 15.5" as "os" | ||
And I enter "15.5" as "release" | ||
And I select "x86_64" from "architecture" dropdown | ||
And I select "openSUSE Leap 15.5 (x86_64)" from "channel_label" dropdown | ||
And I select "x86_64" from "architecture" | ||
And I select "openSUSE Leap 15.5 (x86_64)" from "channel_label" | ||
And I click on "Create Mapping" | ||
Then I should see a "openSUSE Leap 15.5" link in the content area | ||
|
||
|
@@ -48,8 +48,8 @@ Feature: Distribution Channel Mapping | |
Then I should see a "Create Distribution Channel Map" text | ||
When I enter "Ubuntu 22.04.01 LTS" as "os" | ||
And I enter "22.04" as "release" | ||
And I select "x86_64" from "architecture" dropdown | ||
And I select "Fake-Base-Channel-Debian-like" from "channel_label" dropdown | ||
And I select "x86_64" from "architecture" | ||
And I select "Fake-Base-Channel-Debian-like" from "channel_label" | ||
And I click on "Create Mapping" | ||
Then I should see a "Ubuntu 22.04.01 LTS" link in the content area | ||
|
||
|
@@ -60,8 +60,8 @@ Feature: Distribution Channel Mapping | |
Then I should see a "Create Distribution Channel Map" text | ||
When I enter "SUSE Linux Enterprise Server 15 SP 4 iSeries" as "os" | ||
And I enter "15.5" as "release" | ||
And I select "iSeries" from "architecture" dropdown | ||
And I select "Fake-Base-Channel-i586" from "channel_label" dropdown | ||
And I select "iSeries" from "architecture" | ||
And I select "Fake-Base-Channel-i586" from "channel_label" | ||
And I click on "Create Mapping" | ||
Then I should see a "SUSE Linux Enterprise Server 15 SP 4 iSeries" link in the content area | ||
|
||
|
@@ -75,7 +75,7 @@ Feature: Distribution Channel Mapping | |
When I follow "SUSE Linux Enterprise Server 15 SP 4" | ||
Then I should see a "Update Distribution Channel Map" text | ||
When I enter "SUSE Linux Enterprise Server 15 SP 4 modified" as "os" | ||
And I select "SLE-Product-SLES15-SP4-Pool for x86_64" from "channel_label" dropdown | ||
And I select "SLE-Product-SLES15-SP4-Pool for x86_64" from "channel_label" | ||
And I click on "Update Mapping" | ||
Then I should see the text "SUSE Linux Enterprise Server 15 SP 4 modified" in the Operating System field | ||
And I should see the text "sle-product-sles15-sp4-pool-x86_64" in the Channel Label field | ||
|
@@ -89,7 +89,7 @@ Feature: Distribution Channel Mapping | |
When I follow "openSUSE Leap 15.5" | ||
Then I should see a "Update Distribution Channel Map" text | ||
When I enter "openSUSE Leap 15.5 modified" as "os" | ||
And I select "openSUSE Leap 15.5 (x86_64)" from "channel_label" dropdown | ||
And I select "openSUSE Leap 15.5 (x86_64)" from "channel_label" | ||
And I click on "Update Mapping" | ||
Then I should see the text "openSUSE Leap 15.5 modified" in the Operating System field | ||
And I should see the text "opensuse_leap15_5-x86_64" in the Channel Label field | ||
|
@@ -101,7 +101,7 @@ Feature: Distribution Channel Mapping | |
And I should see the text "sle-product-sles15-sp4-pool-x86_64" in the Channel Label field | ||
When I follow "Ubuntu 22.04.01 LTS" | ||
And I enter "Ubuntu 22.04.01 LTS modified" as "os" | ||
And I select "Fake-Base-Channel-Debian-like" from "channel_label" dropdown | ||
And I select "Fake-Base-Channel-Debian-like" from "channel_label" | ||
And I click on "Update Mapping" | ||
Then I should see the text "Ubuntu 22.04.01 LTS modified" in the Operating System field | ||
And I should see the text "fake-base-channel-suse-like" in the Channel Label field | ||
|
@@ -114,7 +114,7 @@ Feature: Distribution Channel Mapping | |
And I should see the text "fake-base-channel-i586" in the Channel Label field | ||
When I follow "SUSE Linux Enterprise Server 15 SP 4 iSeries" | ||
And I enter "SUSE Linux Enterprise Server 15 SP 4 iSeries modified" as "os" | ||
And I select "Fake-Base-Channel-Debian-like" from "channel_label" dropdown | ||
And I select "Fake-Base-Channel-Debian-like" from "channel_label" | ||
And I click on "Update Mapping" | ||
Then I should see the text "SUSE Linux Enterprise Server 15 SP 4 iSeries modified" in the Operating System field | ||
And I should see the text "fake-base-channel-debian-like" in the Channel Label field | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -202,15 +202,6 @@ | |
end | ||
end | ||
|
||
# select an item from any dropdown | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked, it's not used anywhere else, good. |
||
When(/^I select "(.*?)" from "([^"]*)" dropdown/) do |selection, label| | ||
# let the the select2js box filter open the hidden options | ||
xpath_query = "//select[@name='#{label}']" | ||
raise ScriptError, "xpath: #{xpath_query} not found" unless find(:xpath, xpath_query).click | ||
# select the desired option | ||
raise ScriptError, "#{label} #{selection} not found" unless find(:xpath, "//select[@name='#{label}']/option[contains(text(), '#{selection}')]").click | ||
end | ||
|
||
When(/^I select the parent channel for the "([^"]*)" from "([^"]*)"$/) do |client, from| | ||
product_key = $is_container_provider ? 'Fake' : product | ||
select(BASE_CHANNEL_BY_CLIENT[product_key][client], from: from, exact: false) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,14 +73,6 @@ | |
end | ||
end | ||
|
||
When(/^I select "(.*?)" in the dropdown list of the architecture filter$/) do |architecture| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same, i checked it is not used anywhere else, good |
||
# let the the select2js box filter open the hidden options | ||
xpath_query = '//div[@id=\'s2id_product-arch-filter\']/ul/li/input' | ||
raise ScriptError, "xpath: #{xpath_query} not found" unless find(:xpath, xpath_query).click | ||
# select the desired option | ||
raise ScriptError, "Architecture #{architecture} not found" unless find(:xpath, "//div[@id='select2-drop']/ul/li/div[contains(text(), '#{architecture}')]").click | ||
end | ||
|
||
When(/^I (deselect|select) "([^"]*)" as a product$/) do |select, product| | ||
# click on the checkbox to select the product | ||
xpath = "//span[contains(text(), '#{product}')]/ancestor::div[contains(@class, 'product-details-wrapper')]/div/input[@type='checkbox']" | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, we better hide this technical detail in the step definition.
That way, if we change this id in the future, we only need to change it in the step definition and not in all the scenarios using it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Etheryte the Gherkin syntax and Cucumber scenarios have been designed to use natural language to describe the steps a user must follow to achieve something. Ideally, we should write the scenarios as if were on the official documentation. So, even if other steps don't follow this good practice, let's try to do it properly wherever we can.
The good news is that's easy to fix, we only need to create a new step definition, where inside it we use this id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we should avoid using internals as much as we could. The "feature" part should remain "as the end user sees it", and end users don't see ids when they are in front of the UI, they see texts...
That being said, instead of adding new specialized steps, we might try to write a generic step that uses texts instead of ids and labels.