Skip to content

Commit

Permalink
Update tests to remove Select2
Browse files Browse the repository at this point in the history
  • Loading branch information
Etheryte committed Oct 24, 2023
1 parent cb16ad1 commit 8f4e0b0
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Feature: Synchronize extra products in the products page of the Setup Wizard
When I follow the left menu "Admin > Setup Wizard > Products"
And I wait until I do not see "Loading" text
And I enter "Ubuntu" as the filtered product description
And I select "amd64-deb" in the dropdown list of the architecture filter
And I select "amd64-deb" from "product-arch-filter"
And I wait until I see "Ubuntu 22.04" text
And I select "Ubuntu 22.04" as a product
Then I should see the "Ubuntu 22.04" selected
Expand Down
2 changes: 1 addition & 1 deletion testsuite/features/reposync/srv_sync_products.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Feature: Synchronize products in the products page of the Setup Wizard
And I wait until I do not see "Loading" text
And I enter "RHEL or SLES ES" as the filtered product description
Then I should see a "RHEL or SLES ES or CentOS 8 Base" text
When I select "x86_64" in the dropdown list of the architecture filter
When I select "x86_64" from "product-arch-filter"
Then I should see a "RHEL or SLES ES or CentOS 8 Base" text

@scc_credentials
Expand Down
24 changes: 12 additions & 12 deletions testsuite/features/secondary/srv_dist_channel_mapping.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
And I click on "Create Mapping"
Then I should see a "SUSE Linux Enterprise Server 15 SP 4" link in the content area

Expand All @@ -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

Expand All @@ -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" from "channel_label" dropdown
And I select "x86_64" from "architecture"
And I select "Fake-Base-Channel" from "channel_label"
And I click on "Create Mapping"
Then I should see a "Ubuntu 22.04.01 LTS" link in the content area

Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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" from "channel_label" dropdown
And I select "Fake-Base-Channel" 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" in the Channel Label field
Expand All @@ -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
Expand Down
9 changes: 0 additions & 9 deletions testsuite/features/step_definitions/navigation_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,6 @@
end
end

# select an item from any dropdown
When(/^I select "(.*?)" from "([^"]*)" dropdown/) do |selection, label|
# let the the select2js box filter open the hidden options
xpath_query = "//select[@name='#{label}']"
raise "xpath: #{xpath_query} not found" unless find(:xpath, xpath_query).click
# select the desired option
raise "#{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)
Expand Down
8 changes: 0 additions & 8 deletions testsuite/features/step_definitions/setup_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,6 @@
end
end

When(/^I select "(.*?)" in the dropdown list of the architecture filter$/) do |architecture|
# let the the select2js box filter open the hidden options
xpath_query = '//div[@id=\'s2id_product-arch-filter\']/ul/li/input'
raise "xpath: #{xpath_query} not found" unless find(:xpath, xpath_query).click
# select the desired option
raise "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']"
Expand Down
2 changes: 1 addition & 1 deletion web/html/src/manager/admin/setup/products/products.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ class Products extends React.Component<ProductsProps> {
{/* TODO: Remove this <Form> wrapper once https://github.com/SUSE/spacewalk/issues/14250 is implemented */}
<Form>
<Select
name="type-criteria"
name="product-arch-filter"
placeholder={t("Filter by architecture")}
options={this.getDistinctArchsFromData(this.props.data)}
isMulti
Expand Down

0 comments on commit 8f4e0b0

Please sign in to comment.