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

Merge branch 'update-new-test-to-use-let-variables' into 'master'

Update new test to use let variables to follow our testing best practices

See merge request gitlab-org/gitlab!17946
parents 182d3fb8 1c787c30
...@@ -4,39 +4,43 @@ module QA ...@@ -4,39 +4,43 @@ module QA
context 'Plan' do context 'Plan' do
describe 'Related issues' do describe 'Related issues' do
let(:project) do let(:project) do
Resource::Project.fabricate_via_api! do |resource| Resource::Project.fabricate_via_api! do |project|
resource.name = 'project-to-test-related-issues' project.name = 'project-to-test-related-issues'
end end
end end
before do let(:issue_1) do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Resource::Issue.fabricate_via_api! do |issue|
Page::Main::Login.perform(&:sign_in_using_credentials)
@issue_1 = Resource::Issue.fabricate_via_api! do |issue|
issue.project = project issue.project = project
issue.title = 'Issue 1' issue.title = 'Issue 1'
end end
end
@issue_2 = Resource::Issue.fabricate_via_api! do |issue| let(:issue_2) do
Resource::Issue.fabricate_via_api! do |issue|
issue.project = project issue.project = project
issue.title = 'Issue 2' issue.title = 'Issue 2'
end end
end end
before do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
end
it 'relates and unrelates one issue to/from another' do it 'relates and unrelates one issue to/from another' do
@issue_1.visit! issue_1.visit!
Page::Project::Issue::Show.perform do |show| Page::Project::Issue::Show.perform do |show|
show.relate_issue(@issue_2) show.relate_issue(issue_2)
expect(show).to have_content("marked this issue as related to ##{@issue_2.iid}") expect(show).to have_content("marked this issue as related to ##{issue_2.iid}")
expect(show.related_issuable_item).to have_content(@issue_2.title) expect(show.related_issuable_item).to have_content(issue_2.title)
show.click_remove_issue_button show.click_remove_issue_button
expect(show).to have_content("removed the relation with ##{@issue_2.iid}") expect(show).to have_content("removed the relation with ##{issue_2.iid}")
expect(show).not_to have_content(@issue_2.title) expect(show).not_to have_content(issue_2.title)
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