Skip to content

Commit

Permalink
WIP: Cucumber fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
r-richardson committed Dec 19, 2023
1 parent c32b546 commit 7173575
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
6 changes: 2 additions & 4 deletions testsuite/features/reposync/srv_sync_repo_sync.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand Down
20 changes: 9 additions & 11 deletions testsuite/features/step_definitions/command_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,28 +135,26 @@
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
end

Then(/^The amount of packages in channel "([^"]*)" should be the same as before$/) do |channel_label|
channels = $api_test.channel.list_all_channels
if channels.key?(channel_label) && ($package_amount != channels[channel_label]['packages'])
add_context('channels', $api_test.channel.list_all_channels)
if get_context('channels').key?(channel_label) && ( get_context('package_amount') != get_context('channels')[channel_label]['packages'] )
raise 'Package counts do not match'
end
end

Then(/^The amount of packages in channel "([^"]*)" should be fewer than before$/) do |channel_label|
channels = $api_test.channel.list_all_channels
if channels.key?(channel_label) && channels[channel_label]['packages'] >= $package_amount
add_context('channels', $api_test.channel.list_all_channels)
if get_context('channels').key?(channel_label) && get_context('channels')[channel_label]['packages'] >= $package_amount
raise 'Package count is not fewer than before'
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
- features/reposync/srv_create_fake_repositories.feature
- features/reposync/srv_sync_fake_channels.feature
- features/reposync/srv_create_activationkey.feature
- features/reposync/srv_sync_repo_sync.feature
- features/core/srv_osimage.feature
- features/core/srv_docker.feature
## Container features END ###

0 comments on commit 7173575

Please sign in to comment.