From 9ced60e9e04ae97e244ff821ee4f7bbba6d0ce0a Mon Sep 17 00:00:00 2001 From: Robert Richardson Date: Tue, 19 Dec 2023 10:54:56 +0100 Subject: [PATCH] WIP: Cucumber fixes --- .../features/reposync/srv_sync_repo_sync.feature | 6 ++---- testsuite/features/step_definitions/command_steps.rb | 12 +++++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/testsuite/features/reposync/srv_sync_repo_sync.feature b/testsuite/features/reposync/srv_sync_repo_sync.feature index 3edae5612be9..8a323622bbe2 100644 --- a/testsuite/features/reposync/srv_sync_repo_sync.feature +++ b/testsuite/features/reposync/srv_sync_repo_sync.feature @@ -2,7 +2,7 @@ # Licensed under the terms of the MIT license. Feature: Strict Mode for Channel Synchronization - In order to control strict mode synchronization + In order to control strict mode when syncing channels As an admin user I want to be able to toggle strict mode synchronization via the UI and command line @@ -27,7 +27,6 @@ Scenario: Prepare repos for strict test And I click on "Create Repository" Then I should see a "Repository created successfully" text -@rrichardson-test Scenario: Testing strict mode Given I am authorized for the "Admin" section And I follow the left menu "Software > Manage > Channels" @@ -38,7 +37,7 @@ Scenario: Testing strict mode And I follow "Sync" in the "content area" And I click on "Sync Now" And I wait at most 60 seconds until I do not see "Repository sync is running." text, refreshing the page - And I check the amount of packages in channel "test-strict-channel" + And I store the amount of packages in channel "test-strict-channel" And I follow "Add / Remove" And I uncheck "fake-rpm-repo" in the list And I check "fake-rpm-repo-modified" in the list @@ -48,7 +47,6 @@ Scenario: Testing strict mode And I click on "Sync Now" And I wait at most 60 seconds until I do not see "Repository sync is running." text, refreshing the page Then The amount of packages in channel "Test-Strict-Channel" should be the same as before - And I uncheck "no-strict" And I click on "Sync Now" And I wait at most 60 seconds until I do not see "Repository sync is running." text, refreshing the page diff --git a/testsuite/features/step_definitions/command_steps.rb b/testsuite/features/step_definitions/command_steps.rb index 0491bf0f72ec..6a00aded995c 100644 --- a/testsuite/features/step_definitions/command_steps.rb +++ b/testsuite/features/step_definitions/command_steps.rb @@ -135,13 +135,11 @@ raise 'Failed to login to the API' unless response.code == 200 end -$package_amount = nil - -When(/^I check the amount of packages in channel "([^"]*)"$/) do |channel_label| - channels = $api_test.channel.list_all_channels - if channels.key?(channel_label) - package_amount = channels[channel_label]['packages'] - puts "Package amount for 'test-strict': #{package_amount}" +When(/^I store the amount of packages in channel "([^"]*)"$/) do |channel_label| + add_context(channels, $api_test.channel.list_all_channels) + if get_context(channels).key?(channel_label) + add_context(package_amount, get_context(channels)[channel_label]['packages']) + puts "Package amount for 'test-strict': #{get_context(package_amount)}" else puts "#{channel_label} channel not found." end