Commit 8669a344 authored by Dan Davison's avatar Dan Davison

Merge branch 'egb-refactor-jira-spec' into 'master'

Refactor 3_create/jira/jira_basic_integration_spec.rb to use let syntax

See merge request gitlab-org/gitlab!34227
parents c30a44e4 b90b9ba5
...@@ -6,18 +6,19 @@ module QA ...@@ -6,18 +6,19 @@ module QA
describe 'Jira integration', :jira, :orchestrated, :requires_admin do describe 'Jira integration', :jira, :orchestrated, :requires_admin do
let(:jira_project_key) { 'JITP' } let(:jira_project_key) { 'JITP' }
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = "project_with_jira_integration"
end
end
before(:all) do before do
page.visit Vendor::Jira::JiraAPI.perform(&:base_url) page.visit Vendor::Jira::JiraAPI.perform(&:base_url)
QA::Support::Retrier.retry_until(sleep_interval: 3, reload_page: page, max_attempts: 20, raise_on_failure: true) do QA::Support::Retrier.retry_until(sleep_interval: 3, reload_page: page, max_attempts: 20, raise_on_failure: true) do
page.has_text? 'Welcome to Jira' page.has_text? 'Welcome to Jira'
end end
@project = Resource::Project.fabricate_via_api! do |project|
project.name = "project_with_jira_integration"
end
# Retry is required because allow_local_requests_from_web_hooks_and_services # Retry is required because allow_local_requests_from_web_hooks_and_services
# takes some time to get enabled. # takes some time to get enabled.
# Bug issue: https://gitlab.com/gitlab-org/gitlab/-/issues/217010 # Bug issue: https://gitlab.com/gitlab-org/gitlab/-/issues/217010
...@@ -27,7 +28,7 @@ module QA ...@@ -27,7 +28,7 @@ module QA
page.visit Runtime::Scenario.gitlab_address page.visit Runtime::Scenario.gitlab_address
Flow::Login.sign_in_unless_signed_in Flow::Login.sign_in_unless_signed_in
@project.visit! project.visit!
Page::Project::Menu.perform(&:go_to_integrations_settings) Page::Project::Menu.perform(&:go_to_integrations_settings)
QA::Page::Project::Settings::Integrations.perform(&:click_jira_link) QA::Page::Project::Settings::Integrations.perform(&:click_jira_link)
...@@ -67,9 +68,11 @@ module QA ...@@ -67,9 +68,11 @@ module QA
expect_issue_done(issue_key) expect_issue_done(issue_key)
end end
private
def create_mr_with_description(description) def create_mr_with_description(description)
Resource::MergeRequest.fabricate! do |merge_request| Resource::MergeRequest.fabricate! do |merge_request|
merge_request.project = @project merge_request.project = project
merge_request.target_new_branch = !master_branch_exists? merge_request.target_new_branch = !master_branch_exists?
merge_request.description = description merge_request.description = description
end end
...@@ -80,7 +83,7 @@ module QA ...@@ -80,7 +83,7 @@ module QA
push.branch_name = 'master' push.branch_name = 'master'
push.commit_message = commit_message push.commit_message = commit_message
push.file_content = commit_message push.file_content = commit_message
push.project = @project push.project = project
push.new_branch = !master_branch_exists? push.new_branch = !master_branch_exists?
end end
end end
...@@ -98,7 +101,7 @@ module QA ...@@ -98,7 +101,7 @@ module QA
end end
def master_branch_exists? def master_branch_exists?
@project.repository_branches.map { |item| item[:name] }.include?("master") project.repository_branches.map { |item| item[:name] }.include?("master")
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment