Commit 0e37f5ef authored by Walmyr Lima's avatar Walmyr Lima

Refactor plan qa tests to use login flow

And by doing so reduces the code base in 31 lines.
parent caab23bc
...@@ -7,8 +7,7 @@ module QA ...@@ -7,8 +7,7 @@ module QA
QA::Runtime::Env.personal_access_token = QA::Runtime::Env.admin_personal_access_token QA::Runtime::Env.personal_access_token = QA::Runtime::Env.admin_personal_access_token
unless QA::Runtime::Env.personal_access_token unless QA::Runtime::Env.personal_access_token
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in_as_admin
Page::Main::Login.perform(&:sign_in_using_admin_credentials)
end end
user = Resource::User.fabricate_via_api! do |user| user = Resource::User.fabricate_via_api! do |user|
...@@ -20,9 +19,7 @@ module QA ...@@ -20,9 +19,7 @@ module QA
Page::Main::Menu.perform(&:sign_out) if Page::Main::Menu.perform { |p| p.has_personal_area?(wait: 0) } Page::Main::Menu.perform(&:sign_out) if Page::Main::Menu.perform { |p| p.has_personal_area?(wait: 0) }
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
project = Resource::Project.fabricate_via_api! do |resource| project = Resource::Project.fabricate_via_api! do |resource|
resource.name = 'xss-test-for-mentions-project' resource.name = 'xss-test-for-mentions-project'
......
...@@ -7,8 +7,7 @@ module QA ...@@ -7,8 +7,7 @@ module QA
let(:commit_message) { 'Closes' } let(:commit_message) { 'Closes' }
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
issue = Resource::Issue.fabricate_via_api! do |issue| issue = Resource::Issue.fabricate_via_api! do |issue|
issue.title = issue_title issue.title = issue_title
......
...@@ -6,8 +6,7 @@ module QA ...@@ -6,8 +6,7 @@ module QA
let(:my_first_reply) { 'My first reply' } let(:my_first_reply) { 'My first reply' }
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
issue = Resource::Issue.fabricate_via_api! do |issue| issue = Resource::Issue.fabricate_via_api! do |issue|
issue.title = 'issue title' issue.title = 'issue title'
......
...@@ -4,8 +4,7 @@ module QA ...@@ -4,8 +4,7 @@ module QA
context 'Plan' do context 'Plan' do
describe 'Issue comments' do describe 'Issue comments' do
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
issue = Resource::Issue.fabricate_via_api! do |issue| issue = Resource::Issue.fabricate_via_api! do |issue|
issue.title = 'issue title' issue.title = 'issue title'
......
...@@ -6,8 +6,7 @@ module QA ...@@ -6,8 +6,7 @@ module QA
let(:issue_title) { 'issue title' } let(:issue_title) { 'issue title' }
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
end end
it 'user creates an issue' do it 'user creates an issue' do
......
...@@ -6,8 +6,7 @@ module QA ...@@ -6,8 +6,7 @@ module QA
let(:issue_title) { 'issue title' } let(:issue_title) { 'issue title' }
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
issue = Resource::Issue.fabricate_via_api! do |issue| issue = Resource::Issue.fabricate_via_api! do |issue|
issue.title = issue_title issue.title = issue_title
......
...@@ -6,8 +6,7 @@ module QA ...@@ -6,8 +6,7 @@ module QA
let(:issue_title) { 'Issue Lists are awesome' } let(:issue_title) { 'Issue Lists are awesome' }
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
project = Resource::Project.fabricate_via_api! do |resource| project = Resource::Project.fabricate_via_api! do |resource|
resource.name = 'project-for-issue-suggestions' resource.name = 'project-for-issue-suggestions'
......
...@@ -4,8 +4,7 @@ module QA ...@@ -4,8 +4,7 @@ module QA
context 'Plan', :smoke do context 'Plan', :smoke do
describe 'mention' do describe 'mention' do
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
@user = Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) @user = Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1)
......
...@@ -21,8 +21,7 @@ module QA ...@@ -21,8 +21,7 @@ module QA
end end
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
weight_of_two = 2 weight_of_two = 2
......
...@@ -6,8 +6,7 @@ module QA ...@@ -6,8 +6,7 @@ module QA
context 'Plan' do context 'Plan' do
describe 'Custom email', :requires_admin do describe 'Custom email', :requires_admin do
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in_as_admin
Page::Main::Login.perform(&:sign_in_using_admin_credentials)
Page::Main::Menu.perform(&:click_admin_area) Page::Main::Menu.perform(&:click_admin_area)
Page::Admin::Menu.perform(&:go_to_preferences_settings) Page::Admin::Menu.perform(&:go_to_preferences_settings)
end end
......
...@@ -4,8 +4,7 @@ module QA ...@@ -4,8 +4,7 @@ module QA
context 'Plan' do context 'Plan' do
describe 'Epics Management' do describe 'Epics Management' do
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
end end
it 'creates, edits, and deletes an epic' do it 'creates, edits, and deletes an epic' do
......
...@@ -6,8 +6,7 @@ module QA ...@@ -6,8 +6,7 @@ module QA
let(:issue_title) { "My Awesome Issue #{SecureRandom.hex(8)}" } let(:issue_title) { "My Awesome Issue #{SecureRandom.hex(8)}" }
it 'user promotes issue to an epic' do it 'user promotes issue to an epic' do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
group = Resource::Group.fabricate_via_api! group = Resource::Group.fabricate_via_api!
......
...@@ -16,8 +16,7 @@ module QA ...@@ -16,8 +16,7 @@ module QA
end end
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
end end
it 'presents epic on roadmap' do it 'presents epic on roadmap' do
......
...@@ -8,8 +8,7 @@ module QA ...@@ -8,8 +8,7 @@ module QA
end end
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
label_board_list.project.visit! label_board_list.project.visit!
Page::Project::Menu.perform(&:go_to_boards) Page::Project::Menu.perform(&:go_to_boards)
......
...@@ -14,8 +14,7 @@ module QA ...@@ -14,8 +14,7 @@ module QA
let(:issue_2) { 'Issue 2' } let(:issue_2) { 'Issue 2' }
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
fabricate_issue_with_label(label_board_list.project, issue_1, doing) fabricate_issue_with_label(label_board_list.project, issue_1, doing)
fabricate_issue_with_label(label_board_list.project, issue_2, ready_for_dev) fabricate_issue_with_label(label_board_list.project, issue_2, ready_for_dev)
......
...@@ -6,8 +6,7 @@ module QA ...@@ -6,8 +6,7 @@ module QA
context 'Plan' do context 'Plan' do
describe 'Group issue boards' do describe 'Group issue boards' do
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
group = QA::Resource::Group.fabricate_via_api! group = QA::Resource::Group.fabricate_via_api!
......
...@@ -14,8 +14,7 @@ module QA ...@@ -14,8 +14,7 @@ module QA
end end
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
create_group_board(board_1) create_group_board(board_1)
create_group_board(board_2) create_group_board(board_2)
......
...@@ -10,8 +10,7 @@ module QA ...@@ -10,8 +10,7 @@ module QA
end end
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
end end
it 'focuses on issue board' do it 'focuses on issue board' do
......
...@@ -14,8 +14,7 @@ module QA ...@@ -14,8 +14,7 @@ module QA
end end
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
create_group_board(board_1) create_group_board(board_1)
create_group_board(board_2) create_group_board(board_2)
......
...@@ -4,8 +4,7 @@ module QA ...@@ -4,8 +4,7 @@ module QA
context 'Plan' do context 'Plan' do
describe 'Project issue boards' do describe 'Project issue boards' do
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
end end
let(:issue_title) { 'Issue to test board list' } let(:issue_title) { 'Issue to test board list' }
......
...@@ -12,8 +12,7 @@ module QA ...@@ -12,8 +12,7 @@ module QA
end end
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
label_board_list.project.add_member(qa_user, Resource::Members::AccessLevel::GUEST) label_board_list.project.add_member(qa_user, Resource::Members::AccessLevel::GUEST)
......
...@@ -12,8 +12,7 @@ module QA ...@@ -12,8 +12,7 @@ module QA
let(:weight_for_issue_2) { 3 } let(:weight_for_issue_2) { 3 }
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
Resource::Issue.fabricate_via_api! do |issue| Resource::Issue.fabricate_via_api! do |issue|
issue.project = label_board_list.project issue.project = label_board_list.project
......
...@@ -10,8 +10,7 @@ module QA ...@@ -10,8 +10,7 @@ module QA
end end
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
end end
it 'displays a graph' do it 'displays a graph' do
......
...@@ -4,8 +4,7 @@ module QA ...@@ -4,8 +4,7 @@ module QA
context 'Plan' do context 'Plan' do
describe 'Issues weight visualization' do describe 'Issues weight visualization' do
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
end end
let(:project) do let(:project) do
......
...@@ -4,8 +4,7 @@ module QA ...@@ -4,8 +4,7 @@ module QA
context 'Plan' do context 'Plan' do
describe 'Multiple assignees per issue' do describe 'Multiple assignees per issue' do
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
user_1 = Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) user_1 = Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1)
user_2 = Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_2, Runtime::Env.gitlab_qa_password_2) user_2 = Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_2, Runtime::Env.gitlab_qa_password_2)
......
...@@ -4,8 +4,7 @@ module QA ...@@ -4,8 +4,7 @@ module QA
context 'Plan' do context 'Plan' do
describe 'Multiple assignees per issue' do describe 'Multiple assignees per issue' do
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
user_1 = Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) user_1 = Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1)
user_2 = Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_2, Runtime::Env.gitlab_qa_password_2) user_2 = Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_2, Runtime::Env.gitlab_qa_password_2)
......
...@@ -4,8 +4,7 @@ module QA ...@@ -4,8 +4,7 @@ module QA
context 'Plan' do context 'Plan' do
describe 'Multiple assignees per issue' do describe 'Multiple assignees per issue' do
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
user_1 = Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) user_1 = Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1)
@user_2 = Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_2, Runtime::Env.gitlab_qa_password_2) @user_2 = Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_2, Runtime::Env.gitlab_qa_password_2)
......
...@@ -24,8 +24,7 @@ module QA ...@@ -24,8 +24,7 @@ module QA
end end
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
end end
it 'relates and unrelates one issue to/from another' do it 'relates and unrelates one issue to/from another' do
......
...@@ -12,8 +12,7 @@ module QA ...@@ -12,8 +12,7 @@ module QA
let(:new_label_different_scope_multi_colon) { 'group::truck::mercedes-bens' } let(:new_label_different_scope_multi_colon) { 'group::truck::mercedes-bens' }
before do before do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
issue = Resource::Issue.fabricate_via_api! do |issue| issue = Resource::Issue.fabricate_via_api! do |issue|
issue.title = 'Issue to test scoped labels' issue.title = 'Issue to test scoped labels'
......
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