Commit f2c29115 authored by Walmyr Lima e Silva Filho's avatar Walmyr Lima e Silva Filho

Merge branch 'refactor-e2e-test-to-make-it-more-robust' into 'master'

Refactor end-to-end test to make it more robust

Closes #36688

See merge request gitlab-org/gitlab!21652
parents b0ece70a e6aa05e7
...@@ -3,19 +3,18 @@ ...@@ -3,19 +3,18 @@
module QA module QA
context 'Plan' do context 'Plan' do
describe 'Close issue' do describe 'Close issue' do
let(:issue_title) { 'issue title' } let(:issue) do
let(:commit_message) { 'Closes' } Resource::Issue.fabricate_via_api! do |issue|
issue.title = 'Issue to be closed via pushing a commit'
end
end
let(:project) { issue.project }
let(:issue_id) { issue.api_response[:iid] }
before do before do
Flow::Login.sign_in Flow::Login.sign_in
issue = Resource::Issue.fabricate_via_api! do |issue|
issue.title = issue_title
end
@project = issue.project
@issue_id = issue.api_response[:iid]
# Initial commit should be pushed because # Initial commit should be pushed because
# the very first commit to the project doesn't close the issue # the very first commit to the project doesn't close the issue
# https://gitlab.com/gitlab-org/gitlab-foss/issues/38965 # https://gitlab.com/gitlab-org/gitlab-foss/issues/38965
...@@ -23,24 +22,15 @@ module QA ...@@ -23,24 +22,15 @@ module QA
end end
it 'user closes an issue by pushing commit' do it 'user closes an issue by pushing commit' do
push_commit("#{commit_message} ##{@issue_id}", false) push_commit("Closes ##{issue_id}", false)
@project.visit!
Page::Project::Show.perform do |show|
show.click_commit(commit_message)
end
commit_sha = Page::Project::Commit::Show.perform(&:commit_sha)
Page::Project::Menu.perform(&:click_issues) issue.visit!
Page::Project::Issue::Index.perform do |index|
index.click_closed_issues_link
index.click_issue_link(issue_title)
end
Page::Project::Issue::Show.perform do |show| Page::Project::Issue::Show.perform do |show|
show.select_all_activities_filter reopen_issue_button_visible = show.wait(reload: true) do
expect(show).to have_element(:reopen_issue_button) show.has_element?(:reopen_issue_button, wait: 1.0)
expect(show).to have_content("closed via commit #{commit_sha}") end
expect(reopen_issue_button_visible).to be_truthy
end end
end end
...@@ -49,7 +39,7 @@ module QA ...@@ -49,7 +39,7 @@ module QA
push.commit_message = commit_message push.commit_message = commit_message
push.new_branch = new_branch push.new_branch = new_branch
push.file_content = commit_message push.file_content = commit_message
push.project = @project push.project = project
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