From d7cbeda57ef5e7b7fce50049c3429e5d46c12043 Mon Sep 17 00:00:00 2001 From: Mark Lapierre Date: Mon, 27 May 2019 13:52:36 +1000 Subject: Fabricate a file via the API --- .../user_views_commit_diff_patch_spec.rb | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'qa/qa/specs/features/browser_ui') 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 index b7400cdca97..680c5e21fa4 100644 --- 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 @@ -3,13 +3,16 @@ 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) + # Get the user's details to confirm they're included in the email patch + @user = Resource::User.fabricate_via_api! do |user| + user.username = Runtime::User.username + end + project_push = Resource::Repository::ProjectPush.fabricate! do |push| push.file_name = 'README.md' push.file_content = '# This is a test project' @@ -21,12 +24,13 @@ module QA # 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 + Resource::File.fabricate_via_api! do |file| + file.project = @project + file.name = 'second' + file.content = 'second file content' + file.commit_message = @commit_message + file.author_name = @user.name + file.author_email = @user.public_email end end @@ -42,15 +46,11 @@ module QA 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("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 -- cgit v1.2.1 From 9fc4ff52a5e5ef2d09583ea0fe26594080fc7739 Mon Sep 17 00:00:00 2001 From: Mark Lapierre Date: Mon, 27 May 2019 16:18:03 +1000 Subject: Add file via browser when testing the UI Now that it's possible to add a file via the API we need to make sure the UI test uses the browser UI fabrication, not the API. --- .../3_create/repository/create_edit_delete_file_via_web_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qa/qa/specs/features/browser_ui') diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb index 46346d1b984..d345fbfe995 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb @@ -12,7 +12,7 @@ module QA file_content = 'QA Test - File content' commit_message_for_create = 'QA Test - Create new file' - Resource::File.fabricate! do |file| + Resource::File.fabricate_via_browser_ui! do |file| file.name = file_name file.content = file_content file.commit_message = commit_message_for_create -- cgit v1.2.1