Commit dedacada authored by Sanad Liaquat's avatar Sanad Liaquat

Using existing users

parent d786cf32
......@@ -77,6 +77,22 @@ module QA
ENV['GITLAB_FORKER_PASSWORD']
end
def gitlab_qa_username_1
ENV['GITLAB_QA_USERNAME_1']
end
def gitlab_qa_password_1
ENV['GITLAB_QA_PASSWORD_1']
end
def gitlab_qa_username_2
ENV['GITLAB_QA_USERNAME_2']
end
def gitlab_qa_password_2
ENV['GITLAB_QA_PASSWORD_2']
end
def ldap_username
ENV['GITLAB_LDAP_USERNAME']
end
......
......@@ -7,7 +7,7 @@ module QA
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
user = Resource::User.fabricate!
user = create_or_use_existing_user(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1)
project = Resource::Project.fabricate! do |resource|
resource.name = 'add-member-project'
......@@ -21,6 +21,17 @@ module QA
expect(page).to have_content("#{user.name} @#{user.username} Given access")
end
def create_or_use_existing_user(username, password)
if Runtime::Env.signup_disabled?
Resource::User.new.tap do |user|
user.username = username
user.password = password
end
else
Resource::User.fabricate!
end
end
end
end
end
......@@ -21,8 +21,8 @@ module QA
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
@user = Resource::User.fabricate!
@user2 = Resource::User.fabricate!
@user = create_or_use_existing_user(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1)
@user2 = create_or_use_existing_user(Runtime::Env.gitlab_qa_username_2, Runtime::Env.gitlab_qa_password_2)
@project = Resource::Project.fabricate! do |project|
project.name = "codeowners"
......@@ -73,6 +73,17 @@ module QA
expect(page).to have_content(@user2.name)
expect(page).not_to have_content(@user.name)
end
def create_or_use_existing_user(username, password)
if Runtime::Env.signup_disabled?
Resource::User.new.tap do |user|
user.username = username
user.password = password
end
else
Resource::User.fabricate!
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