diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-16 15:10:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-16 15:10:54 +0300 |
commit | f01d3c8c095e70981ffc1d20c050c153f3766421 (patch) | |
tree | 1f072a51c12791df3847fd90bd8e6a369631e990 /spec/features/commit_spec.rb | |
parent | cb20cd86e45ad06b0dc43562c0a1121c3e505c36 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/commit_spec.rb')
-rw-r--r-- | spec/features/commit_spec.rb | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/spec/features/commit_spec.rb b/spec/features/commit_spec.rb index a3208ca6d37..dd96b763e55 100644 --- a/spec/features/commit_spec.rb +++ b/spec/features/commit_spec.rb @@ -16,7 +16,6 @@ RSpec.describe 'Commit', feature_category: :source_code_management do let(:files) { commit.diffs.diff_files.to_a } before do - stub_feature_flags(async_commit_diff_files: false) project.add_maintainer(user) sign_in(user) end @@ -28,15 +27,9 @@ RSpec.describe 'Commit', feature_category: :source_code_management do visit project_commit_path(project, commit) end - it "shows the short commit message" do + it "shows the short commit message, number of total changes and stats", :js, :aggregate_failures do expect(page).to have_content(commit.title) - end - - it "reports the correct number of total changes" do expect(page).to have_content("Changes #{commit.diffs.size}") - end - - it 'renders diff stats', :js do expect(page).to have_selector(".diff-stats") end @@ -50,22 +43,24 @@ RSpec.describe 'Commit', feature_category: :source_code_management do visit project_commit_path(project, commit) end - it "shows an adjusted count for changed files on this page", :js do - expect(page).to have_content("Showing 1 changed file") + def diff_files_on_page + page.all('.files .diff-file').pluck(:id) end - it "shows only the first diff on the first page" do - expect(page).to have_selector(".files ##{files[0].file_hash}") - expect(page).not_to have_selector(".files ##{files[1].file_hash}") - end + it "shows paginated content and controls to navigate", :js, :aggregate_failures do + expect(page).to have_content("Showing 1 changed file") + + wait_for_requests + + expect(diff_files_on_page).to eq([files[0].file_hash]) - it "can navigate to the second page" do within(".files .gl-pagination") do click_on("2") end - expect(page).not_to have_selector(".files ##{files[0].file_hash}") - expect(page).to have_selector(".files ##{files[1].file_hash}") + wait_for_requests + + expect(diff_files_on_page).to eq([files[1].file_hash]) end end end |