diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
commit | 9297025d0b7ddf095eb618dfaaab2ff8f2018d8b (patch) | |
tree | 865198c01d1824a9b098127baa3ab980c9cd2c06 /spec/support/shared_examples/features/runners_shared_examples.rb | |
parent | 6372471f43ee03c05a7c1f8b0c6ac6b8a7431dbe (diff) |
Add latest changes from gitlab-org/gitlab@16-7-stable-eev16.7.0-rc42
Diffstat (limited to 'spec/support/shared_examples/features/runners_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/features/runners_shared_examples.rb | 120 |
1 files changed, 33 insertions, 87 deletions
diff --git a/spec/support/shared_examples/features/runners_shared_examples.rb b/spec/support/shared_examples/features/runners_shared_examples.rb index 861c205337a..8e1e2b10bef 100644 --- a/spec/support/shared_examples/features/runners_shared_examples.rb +++ b/spec/support/shared_examples/features/runners_shared_examples.rb @@ -4,67 +4,41 @@ RSpec.shared_examples 'shows and resets runner registration token' do include Features::RunnersHelpers include Spec::Support::Helpers::ModalHelpers - before do + it 'shows registration instructions' do click_on dropdown_text - end - - describe 'shows registration instructions' do - before do - click_on 'Show runner installation and registration instructions' - - wait_for_requests - end - - it 'opens runner installation modal', :aggregate_failures do - within_modal do - expect(page).to have_text "Install a runner" - expect(page).to have_text "Environment" - expect(page).to have_text "Architecture" - expect(page).to have_text "Download and install binary" - end - end - - it 'dismisses runner installation modal' do - within_modal do - click_button('Close', match: :first) - end + click_on 'Show runner installation and registration instructions' - expect(page).not_to have_text "Install a runner" + within_modal do + expect(page).to have_text "Install a runner" + expect(page).to have_text "Environment" + expect(page).to have_text "Architecture" + expect(page).to have_text "Download and install binary" end end - it 'has a registration token' do + it 'resets current registration token' do + click_on dropdown_text click_on 'Click to reveal' - expect(page.find_field('token-value').value).to have_content(registration_token) - end - describe 'reset registration token' do - let!(:old_registration_token) { find_field('token-value').value } + # current registration token + expect(page.find_field('token-value').value).to eq(registration_token) - before do - click_on 'Reset registration token' - - within_modal do - click_button('Reset token', match: :first) - end - - wait_for_requests + # reset registration token + click_on 'Reset registration token' + within_modal do + click_button('Reset token', match: :first) end - it 'changes registration token' do - expect(find('.gl-toast')).to have_content('New registration token generated!') - - click_on dropdown_text - click_on 'Click to reveal' - - expect(find_field('token-value').value).not_to eq old_registration_token - end + # new registration token + click_on dropdown_text + expect(find_field('token-value').value).not_to eq(registration_token) + expect(find('.gl-toast')).to have_content('New registration token generated!') end end RSpec.shared_examples 'shows no runners registered' do it 'shows 0 count and the empty state' do - expect(find('[data-testid="runner-type-tabs"]')).to have_text "#{s_('Runners|All')} 0" + expect(find('[data-testid="runner-type-tabs"]')).to have_text "All 0" # No stats are shown expect(page).not_to have_text s_('Runners|Online') @@ -82,22 +56,19 @@ RSpec.shared_examples 'shows no runners found' do end end -RSpec.shared_examples 'shows runner in list' do - it 'shows runner row and no empty state' do +RSpec.shared_examples 'shows runner summary and navigates to details' do + it 'shows runner summary and details' do + expect(page).not_to have_content s_('Runners|Get started with runners') + + # see runner summary in list within_runner_row(runner.id) do expect(page).to have_text "##{runner.id}" expect(page).to have_text runner.short_sha expect(page).to have_text runner.description end - expect(page).not_to have_content s_('Runners|Get started with runners') - end -end - -RSpec.shared_examples 'shows runner details from list' do - it 'shows runner details page' do + # navigate to see runner details click_link("##{runner.id} (#{runner.short_sha})") - expect(current_url).to include(runner_page_path) expect(page).to have_selector 'h1', text: "##{runner.id} (#{runner.short_sha})" @@ -131,12 +102,10 @@ RSpec.shared_examples 'pauses, resumes and deletes a runner' do end end - it 'shows a confirmation modal' do + it 'confirms runner deletion' do expect(page).to have_text "Delete runner ##{runner.id} (#{runner.short_sha})?" expect(page).to have_text "Are you sure you want to continue?" - end - it 'deletes a runner' do within_modal do click_on 'Permanently delete runner' end @@ -150,8 +119,6 @@ RSpec.shared_examples 'pauses, resumes and deletes a runner' do click_on 'Cancel' end - wait_for_requests - expect(page).to have_content runner.description end end @@ -166,8 +133,6 @@ RSpec.shared_examples 'deletes runners in bulk' do within_modal do click_on "Permanently delete #{runner_count} runners" end - - wait_for_requests end it_behaves_like 'shows no runners registered' @@ -187,17 +152,11 @@ RSpec.shared_examples 'filters by tag' do end RSpec.shared_examples 'shows runner jobs tab' do - context 'when clicking on jobs tab' do - before do - click_on("#{s_('Runners|Jobs')} #{job_count}") + it 'show jobs in tab' do + click_on("#{s_('Runners|Jobs')} #{job_count}") - wait_for_requests - end - - it 'shows job in list' do - within "[data-testid='job-row-#{job.id}']" do - expect(page).to have_link("##{job.id}") - end + within "[data-testid='job-row-#{job.id}']" do + expect(page).to have_link("##{job.id}") end end end @@ -217,29 +176,17 @@ RSpec.shared_examples 'submits edit runner form' do end end - describe 'runner header', :js do - it 'contains the runner id' do - expect(page).to have_content("##{runner.id} (#{runner.short_sha})") - end - end - context 'when a runner is updated', :js do before do - fill_in s_('Runners|Runner description'), with: 'new-runner-description' + fill_in s_('Runners|Runner description'), with: 'new-runner-description', fill_options: { clear: :backspace } click_on _('Save changes') - wait_for_requests end - it 'redirects to runner page' do + it 'redirects to runner page and shows succesful update' do expect(current_url).to match(runner_page_path) - end - it 'show success alert' do expect(page.find('[data-testid="alert-success"]')).to have_content('saved') - end - - it 'shows updated information' do expect(page).to have_content("#{s_('Runners|Description')} new-runner-description") end end @@ -251,7 +198,6 @@ RSpec.shared_examples 'creates runner and shows register page' do fill_in s_('Runners|Runner description'), with: 'runner-foo' fill_in s_('Runners|Tags'), with: 'tag1' click_on s_('Runners|Create runner') - wait_for_requests end it 'navigates to registration page and opens install instructions drawer' do |