Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-09-20 02:18:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-20 02:18:09 +0300
commit6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch)
treedc4d20fe6064752c0bd323187252c77e0a89144b /spec/support/shared_examples/features
parent9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff)
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'spec/support/shared_examples/features')
-rw-r--r--spec/support/shared_examples/features/board_sidebar_labels_examples.rb2
-rw-r--r--spec/support/shared_examples/features/comments_on_merge_request_files_shared_examples.rb4
-rw-r--r--spec/support/shared_examples/features/content_editor_shared_examples.rb121
-rw-r--r--spec/support/shared_examples/features/deploy_token_shared_examples.rb21
-rw-r--r--spec/support/shared_examples/features/discussion_comments_shared_example.rb4
-rw-r--r--spec/support/shared_examples/features/manage_applications_shared_examples.rb92
-rw-r--r--spec/support/shared_examples/features/packages_shared_examples.rb4
-rw-r--r--spec/support/shared_examples/features/protected_branches_access_control_ce_shared_examples.rb12
-rw-r--r--spec/support/shared_examples/features/protected_branches_with_deploy_keys_examples.rb6
-rw-r--r--spec/support/shared_examples/features/rss_shared_examples.rb4
-rw-r--r--spec/support/shared_examples/features/runners_shared_examples.rb44
-rw-r--r--spec/support/shared_examples/features/snippets_shared_examples.rb2
-rw-r--r--spec/support/shared_examples/features/variable_list_shared_examples.rb8
-rw-r--r--spec/support/shared_examples/features/wiki/user_previews_wiki_changes_shared_examples.rb2
-rw-r--r--spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb11
-rw-r--r--spec/support/shared_examples/features/wiki/user_views_asciidoc_page_with_includes_shared_examples.rb4
16 files changed, 256 insertions, 85 deletions
diff --git a/spec/support/shared_examples/features/board_sidebar_labels_examples.rb b/spec/support/shared_examples/features/board_sidebar_labels_examples.rb
index 520980c2615..4e5b371c18d 100644
--- a/spec/support/shared_examples/features/board_sidebar_labels_examples.rb
+++ b/spec/support/shared_examples/features/board_sidebar_labels_examples.rb
@@ -17,7 +17,7 @@ RSpec.shared_context 'labels from nested groups and projects' do
let_it_be(:maintainer) { create(:user) }
let(:labels_select) { find("[data-testid='sidebar-labels']") }
- let(:labels_dropdown) { labels_select.find('[data-testid="dropdown-content"]')}
+ let(:labels_dropdown) { labels_select.find('[data-testid="dropdown-content"]') }
before do
group.add_maintainer(maintainer)
diff --git a/spec/support/shared_examples/features/comments_on_merge_request_files_shared_examples.rb b/spec/support/shared_examples/features/comments_on_merge_request_files_shared_examples.rb
index 8a07e52019c..f7cdc4c61ec 100644
--- a/spec/support/shared_examples/features/comments_on_merge_request_files_shared_examples.rb
+++ b/spec/support/shared_examples/features/comments_on_merge_request_files_shared_examples.rb
@@ -1,6 +1,10 @@
# frozen_string_literal: true
RSpec.shared_examples 'comment on merge request file' do
+ before do
+ stub_feature_flags(remove_user_attributes_projects: false)
+ end
+
it 'adds a comment' do
click_diff_line(find_by_scrolling("[id='#{sample_commit.line_code}']"))
diff --git a/spec/support/shared_examples/features/content_editor_shared_examples.rb b/spec/support/shared_examples/features/content_editor_shared_examples.rb
index 3fa7beea97e..21f264a8b6a 100644
--- a/spec/support/shared_examples/features/content_editor_shared_examples.rb
+++ b/spec/support/shared_examples/features/content_editor_shared_examples.rb
@@ -1,22 +1,87 @@
# frozen_string_literal: true
RSpec.shared_examples 'edits content using the content editor' do
- content_editor_testid = '[data-testid="content-editor"] [contenteditable].ProseMirror'
+ let(:content_editor_testid) { '[data-testid="content-editor"] [contenteditable].ProseMirror' }
+
+ def switch_to_content_editor
+ find('[data-testid="toggle-editing-mode-button"] label', text: 'Rich text').click
+ end
+
+ def type_in_content_editor(keys)
+ find(content_editor_testid).send_keys keys
+ end
+
+ def open_insert_media_dropdown
+ page.find('svg[data-testid="media-icon"]').click
+ end
+
+ def set_source_editor_content(content)
+ find('.js-gfm-input').set content
+ end
+
+ def expect_formatting_menu_to_be_visible
+ expect(page).to have_css('[data-testid="formatting-bubble-menu"]')
+ end
+
+ def expect_formatting_menu_to_be_hidden
+ expect(page).not_to have_css('[data-testid="formatting-bubble-menu"]')
+ end
+
+ def expect_media_bubble_menu_to_be_visible
+ expect(page).to have_css('[data-testid="media-bubble-menu"]')
+ end
+
+ def upload_asset(fixture_name)
+ attach_file('content_editor_image', Rails.root.join('spec', 'fixtures', fixture_name), make_visible: true)
+ end
describe 'formatting bubble menu' do
- it 'shows a formatting bubble menu for a regular paragraph' do
+ it 'shows a formatting bubble menu for a regular paragraph and headings' do
+ switch_to_content_editor
+
expect(page).to have_css(content_editor_testid)
- find(content_editor_testid).send_keys 'Typing text in the content editor'
- find(content_editor_testid).send_keys [:shift, :left]
+ type_in_content_editor 'Typing text in the content editor'
+ type_in_content_editor [:shift, :left]
+
+ expect_formatting_menu_to_be_visible
+
+ type_in_content_editor [:right, :right, :enter, '## Heading']
- expect(page).to have_css('[data-testid="formatting-bubble-menu"]')
+ expect_formatting_menu_to_be_hidden
+
+ type_in_content_editor [:shift, :left]
+
+ expect_formatting_menu_to_be_visible
+ end
+ end
+
+ describe 'media elements bubble menu' do
+ before do
+ switch_to_content_editor
+
+ open_insert_media_dropdown
+ end
+
+ def test_displays_media_bubble_menu(media_element_selector, fixture_file)
+ upload_asset fixture_file
+
+ wait_for_requests
+
+ expect(page).to have_css(media_element_selector)
+
+ page.find(media_element_selector).click
+
+ expect_formatting_menu_to_be_hidden
+ expect_media_bubble_menu_to_be_visible
end
- it 'does not show a formatting bubble menu for code blocks' do
- find(content_editor_testid).send_keys '```js '
+ it 'displays correct media bubble menu for images', :js do
+ test_displays_media_bubble_menu '[data-testid="content_editor_editablebox"] img[src]', 'dk.png'
+ end
- expect(page).not_to have_css('[data-testid="formatting-bubble-menu"]')
+ it 'displays correct media bubble menu for video', :js do
+ test_displays_media_bubble_menu '[data-testid="content_editor_editablebox"] video', 'video_sample.mp4'
end
end
@@ -30,45 +95,50 @@ RSpec.shared_examples 'edits content using the content editor' do
page.go_back
refresh
+ switch_to_content_editor
end
it 'applies theme classes to code blocks' do
expect(page).not_to have_css('.content-editor-code-block.code.highlight.dark')
- find(content_editor_testid).send_keys [:enter, :enter]
- find(content_editor_testid).send_keys '```js ' # trigger input rule
- find(content_editor_testid).send_keys 'var a = 0'
+ type_in_content_editor [:enter, :enter]
+ type_in_content_editor '```js ' # trigger input rule
+ type_in_content_editor 'var a = 0'
expect(page).to have_css('.content-editor-code-block.code.highlight.dark')
end
end
describe 'code block bubble menu' do
+ before do
+ switch_to_content_editor
+ end
+
it 'shows a code block bubble menu for a code block' do
- find(content_editor_testid).send_keys [:enter, :enter]
+ type_in_content_editor [:enter, :enter]
- find(content_editor_testid).send_keys '```js ' # trigger input rule
- find(content_editor_testid).send_keys 'var a = 0'
- find(content_editor_testid).send_keys [:shift, :left]
+ type_in_content_editor '```js ' # trigger input rule
+ type_in_content_editor 'var a = 0'
+ type_in_content_editor [:shift, :left]
- expect(page).not_to have_css('[data-testid="formatting-bubble-menu"]')
+ expect_formatting_menu_to_be_hidden
expect(page).to have_css('[data-testid="code-block-bubble-menu"]')
end
it 'sets code block type to "javascript" for `js`' do
- find(content_editor_testid).send_keys [:enter, :enter]
+ type_in_content_editor [:enter, :enter]
- find(content_editor_testid).send_keys '```js '
- find(content_editor_testid).send_keys 'var a = 0'
+ type_in_content_editor '```js '
+ type_in_content_editor 'var a = 0'
expect(find('[data-testid="code-block-bubble-menu"]')).to have_text('Javascript')
end
it 'sets code block type to "Custom (nomnoml)" for `nomnoml`' do
- find(content_editor_testid).send_keys [:enter, :enter]
+ type_in_content_editor [:enter, :enter]
- find(content_editor_testid).send_keys '```nomnoml '
- find(content_editor_testid).send_keys 'test'
+ type_in_content_editor '```nomnoml '
+ type_in_content_editor 'test'
expect(find('[data-testid="code-block-bubble-menu"]')).to have_text('Custom (nomnoml)')
end
@@ -76,10 +146,11 @@ RSpec.shared_examples 'edits content using the content editor' do
describe 'mermaid diagram' do
before do
- find(content_editor_testid).send_keys [:enter, :enter]
+ switch_to_content_editor
- find(content_editor_testid).send_keys '```mermaid '
- find(content_editor_testid).send_keys ['graph TD;', :enter, ' JohnDoe12 --> HelloWorld34']
+ type_in_content_editor [:enter, :enter]
+ type_in_content_editor '```mermaid '
+ type_in_content_editor ['graph TD;', :enter, ' JohnDoe12 --> HelloWorld34']
end
it 'renders and updates the diagram correctly in a sandboxed iframe' do
diff --git a/spec/support/shared_examples/features/deploy_token_shared_examples.rb b/spec/support/shared_examples/features/deploy_token_shared_examples.rb
index 25dfe089f51..79ad5bd6c7f 100644
--- a/spec/support/shared_examples/features/deploy_token_shared_examples.rb
+++ b/spec/support/shared_examples/features/deploy_token_shared_examples.rb
@@ -30,6 +30,27 @@ RSpec.shared_examples 'a deploy token in settings' do
expect(page).to have_selector("input[name='deploy-token-user'][value='deployer']")
expect(page).to have_selector("input[name='deploy-token'][readonly='readonly']")
end
+
+ expect(find("input#deploy_token_name").value).to eq nil
+ expect(find("input#deploy_token_read_repository").checked?).to eq false
+ end
+
+ context "with form errors" do
+ before do
+ visit page_path
+ fill_in "deploy_token_name", with: "new_deploy_key"
+ fill_in "deploy_token_username", with: "deployer"
+ click_button "Create deploy token"
+ end
+
+ it "shows form errors" do
+ expect(page).to have_text("Scopes can't be blank")
+ end
+
+ it "keeps form inputs" do
+ expect(find("input#deploy_token_name").value).to eq "new_deploy_key"
+ expect(find("input#deploy_token_username").value).to eq "deployer"
+ end
end
context 'when User#time_display_relative is false', :js do
diff --git a/spec/support/shared_examples/features/discussion_comments_shared_example.rb b/spec/support/shared_examples/features/discussion_comments_shared_example.rb
index 24dc4bcfc59..f209070d82a 100644
--- a/spec/support/shared_examples/features/discussion_comments_shared_example.rb
+++ b/spec/support/shared_examples/features/discussion_comments_shared_example.rb
@@ -304,7 +304,7 @@ RSpec.shared_examples 'thread comments for issue, epic and merge request' do |re
let(:reply_id) { find("#{comments_selector} .note:last-of-type", match: :first)['data-note-id'] }
it 'can be replied to after resolving' do
- find('button[data-qa-selector="resolve_discussion_button"]').click # rubocop:disable QA/SelectorUsage
+ find('button[data-testid="resolve-discussion-button"]').click
wait_for_requests
refresh
@@ -316,7 +316,7 @@ RSpec.shared_examples 'thread comments for issue, epic and merge request' do |re
it 'shows resolved thread when toggled' do
submit_reply('a')
- find('button[data-qa-selector="resolve_discussion_button"]').click # rubocop:disable QA/SelectorUsage
+ find('button[data-testid="resolve-discussion-button"]').click
wait_for_requests
expect(page).to have_selector(".note-row-#{note_id}", visible: true)
diff --git a/spec/support/shared_examples/features/manage_applications_shared_examples.rb b/spec/support/shared_examples/features/manage_applications_shared_examples.rb
index 442264e7ae4..b59f3f1e27b 100644
--- a/spec/support/shared_examples/features/manage_applications_shared_examples.rb
+++ b/spec/support/shared_examples/features/manage_applications_shared_examples.rb
@@ -5,39 +5,87 @@ RSpec.shared_examples 'manage applications' do
let_it_be(:application_name_changed) { "#{application_name} changed" }
let_it_be(:application_redirect_uri) { 'https://foo.bar' }
- it 'allows user to manage applications', :js do
- visit new_application_path
+ context 'when hash_oauth_secrets flag set' do
+ before do
+ stub_feature_flags(hash_oauth_secrets: true)
+ end
+
+ it 'allows user to manage applications', :js do
+ visit new_application_path
- expect(page).to have_content 'Add new application'
+ expect(page).to have_content 'Add new application'
- fill_in :doorkeeper_application_name, with: application_name
- fill_in :doorkeeper_application_redirect_uri, with: application_redirect_uri
- check :doorkeeper_application_scopes_read_user
- click_on 'Save application'
+ fill_in :doorkeeper_application_name, with: application_name
+ fill_in :doorkeeper_application_redirect_uri, with: application_redirect_uri
+ check :doorkeeper_application_scopes_read_user
+ click_on 'Save application'
- validate_application(application_name, 'Yes')
- expect(page).to have_link('Continue', href: index_path)
+ validate_application(application_name, 'Yes')
+ expect(page).to have_content _('This is the only time the secret is accessible. Copy the secret and store it securely')
+ expect(page).to have_link('Continue', href: index_path)
- application = Doorkeeper::Application.find_by(name: application_name)
- expect(page).to have_css("button[title=\"Copy secret\"][data-clipboard-text=\"#{application.secret}\"]", text: 'Copy')
+ expect(page).to have_css("button[title=\"Copy secret\"]", text: 'Copy')
- click_on 'Edit'
+ click_on 'Edit'
- application_name_changed = "#{application_name} changed"
+ application_name_changed = "#{application_name} changed"
- fill_in :doorkeeper_application_name, with: application_name_changed
- uncheck :doorkeeper_application_confidential
- click_on 'Save application'
+ fill_in :doorkeeper_application_name, with: application_name_changed
+ uncheck :doorkeeper_application_confidential
+ click_on 'Save application'
+
+ validate_application(application_name_changed, 'No')
+ expect(page).not_to have_link('Continue')
+ expect(page).to have_content _('The secret is only available when you first create the application')
+
+ visit_applications_path
+
+ page.within '.oauth-applications' do
+ click_on 'Destroy'
+ end
+ expect(page.find('.oauth-applications')).not_to have_content 'test_changed'
+ end
+ end
+
+ context 'when hash_oauth_secrets flag not set' do
+ before do
+ stub_feature_flags(hash_oauth_secrets: false)
+ end
+
+ it 'allows user to manage applications', :js do
+ visit new_application_path
+
+ expect(page).to have_content 'Add new application'
+
+ fill_in :doorkeeper_application_name, with: application_name
+ fill_in :doorkeeper_application_redirect_uri, with: application_redirect_uri
+ check :doorkeeper_application_scopes_read_user
+ click_on 'Save application'
+
+ validate_application(application_name, 'Yes')
+ expect(page).to have_link('Continue', href: index_path)
+
+ application = Doorkeeper::Application.find_by(name: application_name)
+ expect(page).to have_css("button[title=\"Copy secret\"][data-clipboard-text=\"#{application.secret}\"]", text: 'Copy')
+
+ click_on 'Edit'
+
+ application_name_changed = "#{application_name} changed"
+
+ fill_in :doorkeeper_application_name, with: application_name_changed
+ uncheck :doorkeeper_application_confidential
+ click_on 'Save application'
- validate_application(application_name_changed, 'No')
- expect(page).not_to have_link('Continue')
+ validate_application(application_name_changed, 'No')
+ expect(page).not_to have_link('Continue')
- visit_applications_path
+ visit_applications_path
- page.within '.oauth-applications' do
- click_on 'Destroy'
+ page.within '.oauth-applications' do
+ click_on 'Destroy'
+ end
+ expect(page.find('.oauth-applications')).not_to have_content 'test_changed'
end
- expect(page.find('.oauth-applications')).not_to have_content 'test_changed'
end
context 'when scopes are blank' do
diff --git a/spec/support/shared_examples/features/packages_shared_examples.rb b/spec/support/shared_examples/features/packages_shared_examples.rb
index 323bd4f5171..7aad5e2de80 100644
--- a/spec/support/shared_examples/features/packages_shared_examples.rb
+++ b/spec/support/shared_examples/features/packages_shared_examples.rb
@@ -14,7 +14,7 @@ RSpec.shared_examples 'packages list' do |check_project_name: false|
end
def package_table_row(index)
- page.all("#{packages_table_selector} > [data-qa-selector=\"package_row\"]")[index].text # rubocop:disable QA/SelectorUsage
+ page.all("#{packages_table_selector} > [data-testid=\"package-row\"]")[index].text
end
end
@@ -84,7 +84,7 @@ RSpec.shared_examples 'shared package sorting' do
end
def packages_table_selector
- '[data-qa-selector="packages-table"]' # rubocop:disable QA/SelectorUsage
+ '[data-testid="packages-table"]'
end
def click_sort_option(option, ascending)
diff --git a/spec/support/shared_examples/features/protected_branches_access_control_ce_shared_examples.rb b/spec/support/shared_examples/features/protected_branches_access_control_ce_shared_examples.rb
index 8212f14d6be..81d548e000a 100644
--- a/spec/support/shared_examples/features/protected_branches_access_control_ce_shared_examples.rb
+++ b/spec/support/shared_examples/features/protected_branches_access_control_ce_shared_examples.rb
@@ -8,7 +8,7 @@ RSpec.shared_examples "protected branches > access control > CE" do
set_protected_branch_name('master')
find(".js-allowed-to-merge").click
- within('.rspec-allowed-to-merge-dropdown') do
+ within('[data-testid="allowed-to-merge-dropdown"]') do
expect(first("li")).to have_content("Roles")
find(:link, 'No one').click
end
@@ -35,13 +35,13 @@ RSpec.shared_examples "protected branches > access control > CE" do
set_protected_branch_name('master')
find(".js-allowed-to-merge").click
- within('.rspec-allowed-to-merge-dropdown') do
+ within('[data-testid="allowed-to-merge-dropdown"]') do
expect(first("li")).to have_content("Roles")
find(:link, 'No one').click
end
find(".js-allowed-to-push").click
- within('.rspec-allowed-to-push-dropdown') do
+ within('[data-testid="allowed-to-push-dropdown"]') do
expect(first("li")).to have_content("Roles")
find(:link, 'No one').click
end
@@ -83,7 +83,7 @@ RSpec.shared_examples "protected branches > access control > CE" do
end
find(".js-allowed-to-push").click
- within('.rspec-allowed-to-push-dropdown') do
+ within('[data-testid="allowed-to-push-dropdown"]') do
expect(first("li")).to have_content("Roles")
find(:link, 'No one').click
end
@@ -100,13 +100,13 @@ RSpec.shared_examples "protected branches > access control > CE" do
set_protected_branch_name('master')
find(".js-allowed-to-merge").click
- within('.rspec-allowed-to-merge-dropdown') do
+ within('[data-testid="allowed-to-merge-dropdown"]') do
expect(first("li")).to have_content("Roles")
find(:link, 'No one').click
end
find(".js-allowed-to-push").click
- within('.rspec-allowed-to-push-dropdown') do
+ within('[data-testid="allowed-to-push-dropdown"]') do
expect(first("li")).to have_content("Roles")
find(:link, 'No one').click
end
diff --git a/spec/support/shared_examples/features/protected_branches_with_deploy_keys_examples.rb b/spec/support/shared_examples/features/protected_branches_with_deploy_keys_examples.rb
index 14142793a0d..90b0e600228 100644
--- a/spec/support/shared_examples/features/protected_branches_with_deploy_keys_examples.rb
+++ b/spec/support/shared_examples/features/protected_branches_with_deploy_keys_examples.rb
@@ -23,7 +23,7 @@ RSpec.shared_examples 'Deploy keys with protected branches' do
find(".js-allowed-to-push").click
wait_for_requests
- within('.qa-allowed-to-push-dropdown') do # rubocop:disable QA/SelectorUsage
+ within('[data-testid="allowed-to-push-dropdown"]') do
dropdown_headers = page.all('.dropdown-header').map(&:text)
expect(dropdown_headers).to contain_exactly(*all_dropdown_sections)
@@ -38,7 +38,7 @@ RSpec.shared_examples 'Deploy keys with protected branches' do
find(".js-allowed-to-merge").click
wait_for_requests
- within('.qa-allowed-to-merge-dropdown') do # rubocop:disable QA/SelectorUsage
+ within('[data-testid="allowed-to-merge-dropdown"]') do
dropdown_headers = page.all('.dropdown-header').map(&:text)
expect(dropdown_headers).to contain_exactly(*dropdown_sections_minus_deploy_keys)
@@ -68,7 +68,7 @@ RSpec.shared_examples 'Deploy keys with protected branches' do
find(".js-allowed-to-push").click
wait_for_requests
- within('.qa-allowed-to-push-dropdown') do # rubocop:disable QA/SelectorUsage
+ within('[data-testid="allowed-to-push-dropdown"]') do
dropdown_headers = page.all('.dropdown-header').map(&:text)
expect(dropdown_headers).to contain_exactly(*dropdown_sections_minus_deploy_keys)
diff --git a/spec/support/shared_examples/features/rss_shared_examples.rb b/spec/support/shared_examples/features/rss_shared_examples.rb
index 0991de21d8d..ad865b084e1 100644
--- a/spec/support/shared_examples/features/rss_shared_examples.rb
+++ b/spec/support/shared_examples/features/rss_shared_examples.rb
@@ -9,7 +9,7 @@ end
RSpec.shared_examples "it has an RSS button with current_user's feed token" do
it "shows the RSS button with current_user's feed token" do
expect(page)
- .to have_css("a:has(.qa-rss-icon)[href*='feed_token=#{user.feed_token}']") # rubocop:disable QA/SelectorUsage
+ .to have_css("a:has([data-testid='rss-icon'])[href*='feed_token=#{user.feed_token}']")
end
end
@@ -22,7 +22,7 @@ end
RSpec.shared_examples "it has an RSS button without a feed token" do
it "shows the RSS button without a feed token" do
expect(page)
- .to have_css("a:has(.qa-rss-icon):not([href*='feed_token'])") # rubocop:disable QA/SelectorUsage
+ .to have_css("a:has([data-testid='rss-icon']):not([href*='feed_token'])")
end
end
diff --git a/spec/support/shared_examples/features/runners_shared_examples.rb b/spec/support/shared_examples/features/runners_shared_examples.rb
index 52f3fd60c07..31ee08ea9db 100644
--- a/spec/support/shared_examples/features/runners_shared_examples.rb
+++ b/spec/support/shared_examples/features/runners_shared_examples.rb
@@ -64,9 +64,9 @@ end
RSpec.shared_examples 'shows no runners registered' do
it 'shows counts with 0' do
- expect(page).to have_text "Online runners 0"
- expect(page).to have_text "Offline runners 0"
- expect(page).to have_text "Stale runners 0"
+ expect(page).to have_text "#{s_('Runners|Online')} 0"
+ expect(page).to have_text "#{s_('Runners|Offline')} 0"
+ expect(page).to have_text "#{s_('Runners|Stale')} 0"
end
it 'shows "no runners" message' do
@@ -101,7 +101,7 @@ RSpec.shared_examples 'pauses, resumes and deletes a runner' do
within_runner_row(runner.id) do
click_button "Pause"
- expect(page).to have_text 'paused'
+ expect(page).to have_text s_('Runners|Paused')
expect(page).to have_button 'Resume'
expect(page).not_to have_button 'Pause'
@@ -145,3 +145,39 @@ RSpec.shared_examples 'pauses, resumes and deletes a runner' do
end
end
end
+
+RSpec.shared_examples 'submits edit runner form' do
+ it 'breadcrumb contains runner id and token' do
+ page.within '[data-testid="breadcrumb-links"]' do
+ expect(page).to have_link("##{runner.id} (#{runner.short_sha})")
+ expect(page.find('[data-testid="breadcrumb-current-link"]')).to have_content("Edit")
+ end
+ end
+
+ describe 'runner header', :js do
+ it 'contains the runner id' do
+ expect(page).to have_content("Runner ##{runner.id} created")
+ end
+ end
+
+ context 'when a runner is updated', :js do
+ before do
+ find('[data-testid="runner-field-description"] input').set('new-runner-description')
+
+ click_on _('Save changes')
+ wait_for_requests
+ end
+
+ it 'redirects to runner page' 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
+end
diff --git a/spec/support/shared_examples/features/snippets_shared_examples.rb b/spec/support/shared_examples/features/snippets_shared_examples.rb
index c402333107c..bf870b3ce66 100644
--- a/spec/support/shared_examples/features/snippets_shared_examples.rb
+++ b/spec/support/shared_examples/features/snippets_shared_examples.rb
@@ -194,7 +194,7 @@ end
RSpec.shared_examples 'personal snippet with references' do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:merge_request) { create(:merge_request, source_project: project) }
- let_it_be(:project_snippet) { create(:project_snippet, :repository, project: project)}
+ let_it_be(:project_snippet) { create(:project_snippet, :repository, project: project) }
let_it_be(:issue) { create(:issue, project: project) }
let_it_be(:commit) { project.commit }
diff --git a/spec/support/shared_examples/features/variable_list_shared_examples.rb b/spec/support/shared_examples/features/variable_list_shared_examples.rb
index 9d81c0e9a3e..d1e5046a39e 100644
--- a/spec/support/shared_examples/features/variable_list_shared_examples.rb
+++ b/spec/support/shared_examples/features/variable_list_shared_examples.rb
@@ -91,7 +91,7 @@ RSpec.shared_examples 'variable list' do |is_admin|
end
page.within('#add-ci-variable') do
- find('[data-qa-selector="ci_variable_key_field"] input').set('new_key') # rubocop:disable QA/SelectorUsage
+ find('[data-testid="pipeline-form-ci-variable-key"] input').set('new_key')
click_button('Update variable')
end
@@ -173,7 +173,7 @@ RSpec.shared_examples 'variable list' do |is_admin|
click_button('Add variable')
page.within('#add-ci-variable') do
- find('[data-qa-selector="ci_variable_key_field"] input').set('empty_mask_key') # rubocop:disable QA/SelectorUsage
+ find('[data-testid="pipeline-form-ci-variable-key"] input').set('empty_mask_key')
find('[data-testid="ci-variable-protected-checkbox"]').click
find('[data-testid="ci-variable-masked-checkbox"]').click
@@ -290,8 +290,8 @@ RSpec.shared_examples 'variable list' do |is_admin|
wait_for_requests
page.within('#add-ci-variable') do
- find('[data-qa-selector="ci_variable_key_field"] input').set(key) # rubocop:disable QA/SelectorUsage
- find('[data-qa-selector="ci_variable_value_field"]').set(value) if value.present? # rubocop:disable QA/SelectorUsage
+ find('[data-testid="pipeline-form-ci-variable-key"] input').set(key)
+ find('[data-testid="pipeline-form-ci-variable-value"]').set(value) if value.present?
find('[data-testid="ci-variable-protected-checkbox"]').click if protected
find('[data-testid="ci-variable-masked-checkbox"]').click if masked
diff --git a/spec/support/shared_examples/features/wiki/user_previews_wiki_changes_shared_examples.rb b/spec/support/shared_examples/features/wiki/user_previews_wiki_changes_shared_examples.rb
index 2285d9a17e2..3e285bb8ad7 100644
--- a/spec/support/shared_examples/features/wiki/user_previews_wiki_changes_shared_examples.rb
+++ b/spec/support/shared_examples/features/wiki/user_previews_wiki_changes_shared_examples.rb
@@ -64,7 +64,7 @@ RSpec.shared_examples 'User previews wiki changes' do
end
it_behaves_like 'relative links' do
- let(:element) { page.find('[data-testid="wiki_page_content"]') }
+ let(:element) { page.find('[data-testid="wiki-page-content"]') }
end
end
diff --git a/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb b/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb
index 87067336a36..5c63d6a973d 100644
--- a/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb
+++ b/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb
@@ -137,16 +137,7 @@ RSpec.shared_examples 'User updates wiki page' do
end
end
- context 'when using the content editor' do
- context 'with feature flag on' do
- before do
- find('[data-testid="toggle-editing-mode-button"] label', text: 'Rich text').click
- end
-
- it_behaves_like 'edits content using the content editor'
- end
- end
-
+ it_behaves_like 'edits content using the content editor'
it_behaves_like 'autocompletes items'
end
diff --git a/spec/support/shared_examples/features/wiki/user_views_asciidoc_page_with_includes_shared_examples.rb b/spec/support/shared_examples/features/wiki/user_views_asciidoc_page_with_includes_shared_examples.rb
index 6fdc5ecae73..fde38df558f 100644
--- a/spec/support/shared_examples/features/wiki/user_views_asciidoc_page_with_includes_shared_examples.rb
+++ b/spec/support/shared_examples/features/wiki/user_views_asciidoc_page_with_includes_shared_examples.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
RSpec.shared_examples 'User views AsciiDoc page with includes' do
- let_it_be(:wiki_content_selector) { '[data-qa-selector=wiki_page_content]' } # rubocop:disable QA/SelectorUsage
- let!(:included_wiki_page) { create_wiki_page('included_page', content: 'Content from the included page')}
+ let_it_be(:wiki_content_selector) { '[data-testid=wiki-page-content]' }
+ let!(:included_wiki_page) { create_wiki_page('included_page', content: 'Content from the included page') }
let!(:wiki_page) { create_wiki_page('home', content: "Content from the main page.\ninclude::included_page.asciidoc[]") }
def create_wiki_page(title, content:)