summaryrefslogtreecommitdiff
path: root/spec/features/projects/commit
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/projects/commit')
-rw-r--r--spec/features/projects/commit/cherry_pick_spec.rb13
-rw-r--r--spec/features/projects/commit/comments/user_edits_comments_spec.rb2
-rw-r--r--spec/features/projects/commit/mini_pipeline_graph_spec.rb50
-rw-r--r--spec/features/projects/commit/user_reverts_commit_spec.rb17
4 files changed, 39 insertions, 43 deletions
diff --git a/spec/features/projects/commit/cherry_pick_spec.rb b/spec/features/projects/commit/cherry_pick_spec.rb
index 489a90cc8fc..cd944436228 100644
--- a/spec/features/projects/commit/cherry_pick_spec.rb
+++ b/spec/features/projects/commit/cherry_pick_spec.rb
@@ -91,7 +91,7 @@ RSpec.describe 'Cherry-pick Commits', :js do
context 'when the project is archived' do
let(:project) { create(:project, :repository, :archived, namespace: user.namespace) }
- it 'does not show the cherry-pick link' do
+ it 'does not show the cherry-pick button' do
open_dropdown
expect(page).not_to have_text("Cherry-pick")
@@ -106,12 +106,15 @@ RSpec.describe 'Cherry-pick Commits', :js do
end
def open_dropdown
- find('.header-action-buttons .dropdown').click
+ find(dropdown_selector).click
end
def open_modal
open_dropdown
- find('[data-testid="cherry-pick-commit-link"]').click
+
+ page.within(dropdown_selector) do
+ click_button 'Cherry-pick'
+ end
end
def submit_cherry_pick(create_merge_request: false)
@@ -121,6 +124,10 @@ RSpec.describe 'Cherry-pick Commits', :js do
end
end
+ def dropdown_selector
+ '[data-testid="commit-options-dropdown"]'
+ end
+
def modal_selector
'[data-testid="modal-commit"]'
end
diff --git a/spec/features/projects/commit/comments/user_edits_comments_spec.rb b/spec/features/projects/commit/comments/user_edits_comments_spec.rb
index 787d8cdb02b..8ac15c9cb7f 100644
--- a/spec/features/projects/commit/comments/user_edits_comments_spec.rb
+++ b/spec/features/projects/commit/comments/user_edits_comments_spec.rb
@@ -19,7 +19,7 @@ RSpec.describe "User edits a comment on a commit", :js do
end
it "edits comment" do
- new_comment_text = "+1 Awesome!".freeze
+ new_comment_text = "+1 Awesome!"
page.within(".main-notes-list") do
note = find(".note")
diff --git a/spec/features/projects/commit/mini_pipeline_graph_spec.rb b/spec/features/projects/commit/mini_pipeline_graph_spec.rb
index 7d206f76031..6de02556175 100644
--- a/spec/features/projects/commit/mini_pipeline_graph_spec.rb
+++ b/spec/features/projects/commit/mini_pipeline_graph_spec.rb
@@ -16,46 +16,28 @@ RSpec.describe 'Mini Pipeline Graph in Commit View', :js do
let(:build) { create(:ci_build, pipeline: pipeline, status: :running) }
- shared_examples 'shows ci icon and mini pipeline' do
- before do
- build.run
- visit project_commit_path(project, project.commit.id)
- end
-
- it 'display icon with status' do
- expect(page).to have_selector('.ci-status-icon-running')
- end
-
- it 'displays a mini pipeline graph' do
- expect(page).to have_selector('.mr-widget-pipeline-graph')
-
- first('.mini-pipeline-graph-dropdown-toggle').click
-
- wait_for_requests
-
- page.within '.js-builds-dropdown-list' do
- expect(page).to have_selector('.ci-status-icon-running')
- expect(page).to have_content(build.stage)
- end
+ before do
+ build.run
+ visit project_commit_path(project, project.commit.id)
+ end
- build.drop
- end
+ it 'display icon with status' do
+ expect(page).to have_selector('.ci-status-icon-running')
end
- context 'when ci_commit_pipeline_mini_graph_vue is disabled' do
- before do
- stub_feature_flags(ci_commit_pipeline_mini_graph_vue: false)
- end
+ it 'displays a mini pipeline graph' do
+ expect(page).to have_selector('[data-testid="pipeline-mini-graph"]')
- it_behaves_like 'shows ci icon and mini pipeline'
- end
+ first('.mini-pipeline-graph-dropdown-toggle').click
- context 'when ci_commit_pipeline_mini_graph_vue is enabled' do
- before do
- stub_feature_flags(ci_commit_pipeline_mini_graph_vue: true)
+ wait_for_requests
+
+ page.within '.js-builds-dropdown-list' do
+ expect(page).to have_selector('.ci-status-icon-running')
+ expect(page).to have_content(build.stage)
end
- it_behaves_like 'shows ci icon and mini pipeline'
+ build.drop
end
end
@@ -65,7 +47,7 @@ RSpec.describe 'Mini Pipeline Graph in Commit View', :js do
end
it 'does not display a mini pipeline graph' do
- expect(page).not_to have_selector('.mr-widget-pipeline-graph')
+ expect(page).not_to have_selector('[data-testid="pipeline-mini-graph"]')
end
end
end
diff --git a/spec/features/projects/commit/user_reverts_commit_spec.rb b/spec/features/projects/commit/user_reverts_commit_spec.rb
index 72c639a027e..ad327b86aa7 100644
--- a/spec/features/projects/commit/user_reverts_commit_spec.rb
+++ b/spec/features/projects/commit/user_reverts_commit_spec.rb
@@ -62,10 +62,10 @@ RSpec.describe 'User reverts a commit', :js do
context 'when the project is archived' do
let(:project) { create(:project, :repository, :archived, namespace: user.namespace) }
- it 'does not show the revert link' do
+ it 'does not show the revert button' do
open_dropdown
- expect(page).not_to have_link('Revert')
+ expect(page).not_to have_button('Revert')
end
end
end
@@ -75,17 +75,24 @@ RSpec.describe 'User reverts a commit', :js do
page.within(modal_selector) do
uncheck('create_merge_request') unless create_merge_request
- click_button('Revert')
+ click_button 'Revert'
end
end
def open_dropdown
- find('.header-action-buttons .dropdown').click
+ find(dropdown_selector).click
end
def open_modal
open_dropdown
- find('[data-testid="revert-commit-link"]').click
+
+ page.within(dropdown_selector) do
+ click_button 'Revert'
+ end
+ end
+
+ def dropdown_selector
+ '[data-testid="commit-options-dropdown"]'
end
def modal_selector