Commit 9a19d44b authored by Walmyr Lima e Silva Filho's avatar Walmyr Lima e Silva Filho Committed by Mark Lapierre

Simplify end-to-end test setup

Besides that, this commit tries to fix an issue that happens on
staging, where user fabrication via API doesn't work, and it may
be due to the usage of let(:user) since other tests using
User.fabricate_via_api! don't use it in a let declaration.

In this commit I'm moving the user fabrication to the before block
and exposing it as an instance variable @user, so that it can be
used in the test itself.

Also, I have removed unnecessary steps that makes the test slower.
parent 230a9277
......@@ -3,29 +3,12 @@
module QA
context 'Plan', :smoke do
describe 'mention' do
let(:user) do
Resource::User.fabricate_via_api! do |user|
user.name = "bob"
user.password = "1234test"
end
end
before do
QA::Runtime::Env.personal_access_token = QA::Runtime::Env.admin_personal_access_token
unless QA::Runtime::Env.personal_access_token
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_admin_credentials)
end
QA::Runtime::Env.personal_access_token = nil
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)
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)
project = Resource::Project.fabricate_via_api! do |resource|
resource.name = 'project-to-test-mention'
end
......@@ -33,7 +16,7 @@ module QA
Page::Project::Show.perform(&:go_to_members_settings)
Page::Project::Settings::Members.perform do |members|
members.add_member(user.username)
members.add_member(@user.username)
end
issue = Resource::Issue.fabricate_via_api! do |issue|
......@@ -45,7 +28,7 @@ module QA
it 'user mentions another user in an issue' do
Page::Project::Issue::Show.perform do |show|
at_username = "@#{user.username}"
at_username = "@#{@user.username}"
show.select_all_activities_filter
show.comment(at_username)
......
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