diff options
author | Linda Dai <3424400-lindai@users.noreply.gitlab.com> | 2019-03-05 22:47:01 +0000 |
---|---|---|
committer | Mark Lapierre <mlapierre@gitlab.com> | 2019-03-05 22:47:01 +0000 |
commit | a0c6d085d7838d36f0e65d33841c0ad32b8ce4e2 (patch) | |
tree | 4a8ea3b278c5ebbffa15cc6db7751cdb005317b0 /qa/qa/specs/features/browser_ui/3_create/repository/user_views_commit_diff_patch_spec.rb | |
parent | d11b112664db578327d028cb4552f408e89222d0 (diff) | |
download | gitlab-ce-a0c6d085d7838d36f0e65d33841c0ad32b8ce4e2.tar.gz |
Add QA test to download merge request patch/diffs
Diffstat (limited to 'qa/qa/specs/features/browser_ui/3_create/repository/user_views_commit_diff_patch_spec.rb')
-rw-r--r-- | qa/qa/specs/features/browser_ui/3_create/repository/user_views_commit_diff_patch_spec.rb | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/user_views_commit_diff_patch_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/user_views_commit_diff_patch_spec.rb new file mode 100644 index 00000000000..b862a7bd1ed --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/repository/user_views_commit_diff_patch_spec.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +module QA + context 'Create' do + # failure reported: https://gitlab.com/gitlab-org/quality/nightly/issues/42 + # also failing in staging until the fix is picked into the next release: + # https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24533 + describe 'Commit data', :quarantine do + before(:context) do + Runtime::Browser.visit(:gitlab, Page::Main::Login) + Page::Main::Login.perform(&:sign_in_using_credentials) + + project_push = Resource::Repository::ProjectPush.fabricate! do |push| + push.file_name = 'README.md' + push.file_content = '# This is a test project' + push.commit_message = 'Add README.md' + end + @project = project_push.project + + # first file added has no parent commit, thus no diff data + # add second file to repo to enable diff from initial commit + @commit_message = 'Add second file' + + Page::Project::Show.perform(&:create_new_file!) + Page::File::Form.perform do |f| + f.add_name('second') + f.add_content('second file content') + f.add_commit_message(@commit_message) + f.commit_changes + end + end + + def view_commit + @project.visit! + Page::Project::Show.perform do |page| + page.go_to_commit(@commit_message) + end + end + + def raw_content + find('pre').text + end + + it 'user views raw email patch' do + user = Resource::User.fabricate_via_api! do |user| + user.username = Runtime::User.username + end + + view_commit + + Page::Project::Commit::Show.perform(&:select_email_patches) + + expect(page).to have_content("From: #{user.name} <#{user.public_email}>") + expect(page).to have_content('Subject: [PATCH] Add second file') + expect(page).to have_content('diff --git a/second b/second') + end + + it 'user views raw commit diff' do + view_commit + + Page::Project::Commit::Show.perform(&:select_plain_diff) + + expect(raw_content).to start_with('diff --git a/second b/second') + expect(page).to have_content('+second file content') + end + end + end +end |