diff options
-rw-r--r-- | app/presenters/project_presenter.rb | 2 | ||||
-rw-r--r-- | qa/qa/page/project/issue/show.rb | 4 | ||||
-rw-r--r-- | qa/qa/page/project/show.rb | 8 | ||||
-rw-r--r-- | qa/qa/resource/issue.rb | 3 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/2_plan/issue/issue_gets_closed_after_push_spec.rb | 11 |
5 files changed, 18 insertions, 10 deletions
diff --git a/app/presenters/project_presenter.rb b/app/presenters/project_presenter.rb index 9bd64ea217e..08a92c0eb93 100644 --- a/app/presenters/project_presenter.rb +++ b/app/presenters/project_presenter.rb @@ -197,7 +197,7 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated AnchorData.new(false, statistic_icon + _('New file'), project_new_blob_path(project, default_branch || 'master'), - 'success') + 'success qa-new-file') end end diff --git a/qa/qa/page/project/issue/show.rb b/qa/qa/page/project/issue/show.rb index 5bede6f28e3..86a47cb9f81 100644 --- a/qa/qa/page/project/issue/show.rb +++ b/qa/qa/page/project/issue/show.rb @@ -55,10 +55,6 @@ module QA all_elements(:filter_options).first.click end - def issue_id - URI.parse(current_url).path.split('/').last - end - def first_note_header wait_for_notes_to_be_displayed all_elements(:note_header).first.text diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 99d849db439..dbcd26914c6 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -51,6 +51,10 @@ module QA element :branches_dropdown end + view 'app/presenters/project_presenter.rb' do + element :new_file + end + def create_first_new_file! within_element(:quick_actions) do click_link_with_text 'New file' @@ -111,6 +115,10 @@ module QA has_css?('.tree-holder') end end + + def click_add_new_file + click_element :new_file + end end end end diff --git a/qa/qa/resource/issue.rb b/qa/qa/resource/issue.rb index 2c2f27fe231..b9458cc4fa3 100644 --- a/qa/qa/resource/issue.rb +++ b/qa/qa/resource/issue.rb @@ -1,9 +1,11 @@ # frozen_string_literal: true +require 'uri' module QA module Resource class Issue < Base attr_writer :description + attribute :id attribute :project do Project.fabricate! do |resource| @@ -24,6 +26,7 @@ module QA page.add_description(@description) page.create_new_issue end + @id = URI.parse(current_url).path.split('/').last end end end diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/issue_gets_closed_after_push_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/issue_gets_closed_after_push_spec.rb index 8c2d4d7095b..4d6d0fcd797 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/issue_gets_closed_after_push_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/issue_gets_closed_after_push_spec.rb @@ -9,15 +9,18 @@ module QA it 'closes the issue after pushing a commit' do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act {sign_in_using_credentials} - Resource::Issue.fabricate! do |issue| + issue = Resource::Issue.fabricate! do |issue| issue.title = issue_title end - issue_id = Page::Project::Issue::Show.perform(&:issue_id) + Page::Project::Menu.act {click_project} + Page::Project::Show.act {click_add_new_file} # It is necessary to initiate an initial commit - as the first push into a repository doesn't trigger the closing # https://gitlab.com/gitlab-org/gitlab-ce/issues/54722 push_file("initial commit", "firstfile") - push_file("Closes ##{issue_id}", "secondfile") + Page::Project::Menu.act {click_project} + Page::Project::Show.act {create_new_file!} + push_file("Closes ##{issue.id}", "secondfile") commit_sha = Page::File::Show.perform(&:commit_sha) Page::Project::Menu.act {click_issues} Page::Project::Issue::Index.perform do |page| @@ -31,8 +34,6 @@ module QA end def push_file(commit_message, filename) - Page::Project::Menu.act {click_project} - Page::Project::Show.act {create_new_file!} Page::File::Form.perform do |page| page.add_name(filename) page.add_content(FFaker::Lorem.phrase) |