Commit 4c7e380c authored by Rémy Coutable's avatar Rémy Coutable

[EE] Change Page::Main::Entry to only visit an entrypoint and introduce...

[EE] Change Page::Main::Entry to only visit an entrypoint and introduce Page::Main::Login to handle actual log-in
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 01932584
...@@ -62,6 +62,7 @@ module QA ...@@ -62,6 +62,7 @@ module QA
module Main module Main
autoload :Entry, 'qa/page/main/entry' autoload :Entry, 'qa/page/main/entry'
autoload :Login, 'qa/page/main/login'
autoload :Menu, 'qa/page/main/menu' autoload :Menu, 'qa/page/main/menu'
end end
......
...@@ -4,7 +4,8 @@ module QA ...@@ -4,7 +4,8 @@ module QA
module License module License
class Add < QA::Scenario::Template class Add < QA::Scenario::Template
def perform(license) def perform(license)
QA::Page::Main::Entry.act { sign_in_using_credentials } QA::Page::Main::Entry.act { visit_login_page }
QA::Page::Main::Login.act { sign_in_using_credentials }
QA::Page::Main::Menu.act { go_to_admin_area } QA::Page::Main::Menu.act { go_to_admin_area }
QA::Page::Admin::Menu.act { go_to_license } QA::Page::Admin::Menu.act { go_to_license }
......
...@@ -23,7 +23,7 @@ module QA ...@@ -23,7 +23,7 @@ module QA
def password=(pass) def password=(pass)
@password = pass @password = pass
@uri.password = pass @uri.password = CGI.escape(pass)
end end
def use_default_credentials def use_default_credentials
......
...@@ -2,9 +2,14 @@ module QA ...@@ -2,9 +2,14 @@ module QA
module Page module Page
module Main module Main
class Entry < Page::Base class Entry < Page::Base
def initialize def visit_login_page
visit(Runtime::Scenario.gitlab_address) visit("#{Runtime::Scenario.gitlab_address}/users/sign_in")
wait_for_instance_to_be_ready
end
private
def wait_for_instance_to_be_ready
# This resolves cold boot / background tasks problems # This resolves cold boot / background tasks problems
# #
start = Time.now start = Time.now
...@@ -14,18 +19,6 @@ module QA ...@@ -14,18 +19,6 @@ module QA
refresh refresh
end end
end end
def sign_in_using_credentials
if page.has_content?('Change your password')
fill_in :user_password, with: Runtime::User.password
fill_in :user_password_confirmation, with: Runtime::User.password
click_button 'Change your password'
end
fill_in :user_login, with: Runtime::User.name
fill_in :user_password, with: Runtime::User.password
click_button 'Sign in'
end
end end
end end
end end
......
module QA
module Page
module Main
class Login < Page::Base
def sign_in_using_credentials
if page.has_content?('Change your password')
fill_in :user_password, with: Runtime::User.password
fill_in :user_password_confirmation, with: Runtime::User.password
click_button 'Change your password'
end
fill_in :user_login, with: Runtime::User.name
fill_in :user_password, with: Runtime::User.password
click_button 'Sign in'
end
end
end
end
end
module QA module QA
feature 'standard root login', :core do feature 'standard root login', :core do
scenario 'user logs in using credentials' do scenario 'user logs in using credentials' do
Page::Main::Entry.act { sign_in_using_credentials } Page::Main::Entry.act { visit_login_page }
Page::Main::Login.act { sign_in_using_credentials }
# TODO, since `Signed in successfully` message was removed # TODO, since `Signed in successfully` message was removed
# this is the only way to tell if user is signed in correctly. # this is the only way to tell if user is signed in correctly.
......
module QA module QA
feature 'create a new group', :mattermost do feature 'create a new group', :mattermost do
scenario 'creating a group with a mattermost team' do scenario 'creating a group with a mattermost team' do
Page::Main::Entry.act { sign_in_using_credentials } Page::Main::Entry.act { visit_login_page }
Page::Main::Login.act { sign_in_using_credentials }
Page::Main::Menu.act { go_to_groups } Page::Main::Menu.act { go_to_groups }
Page::Dashboard::Groups.perform do |page| Page::Dashboard::Groups.perform do |page|
......
module QA module QA
feature 'logging in to Mattermost', :mattermost do feature 'logging in to Mattermost', :mattermost do
scenario 'can use gitlab oauth' do scenario 'can use gitlab oauth' do
Page::Main::Entry.act { sign_in_using_credentials } Page::Main::Entry.act { visit_login_page }
Page::Main::Login.act { sign_in_using_credentials }
Page::Mattermost::Login.act { sign_in_using_oauth } Page::Mattermost::Login.act { sign_in_using_oauth }
Page::Mattermost::Main.perform do |page| Page::Mattermost::Main.perform do |page|
......
module QA module QA
feature 'create a new project', :core do feature 'create a new project', :core do
scenario 'user creates a new project' do scenario 'user creates a new project' do
Page::Main::Entry.act { sign_in_using_credentials } Page::Main::Entry.act { visit_login_page }
Page::Main::Login.act { sign_in_using_credentials }
Scenario::Gitlab::Project::Create.perform do |project| Scenario::Gitlab::Project::Create.perform do |project|
project.name = 'awesome-project' project.name = 'awesome-project'
......
...@@ -9,7 +9,8 @@ module QA ...@@ -9,7 +9,8 @@ module QA
end end
before do before do
Page::Main::Entry.act { sign_in_using_credentials } Page::Main::Entry.act { visit_login_page }
Page::Main::Login.act { sign_in_using_credentials }
Scenario::Gitlab::Project::Create.perform do |scenario| Scenario::Gitlab::Project::Create.perform do |scenario|
scenario.name = 'project-with-code' scenario.name = 'project-with-code'
......
...@@ -2,7 +2,8 @@ module QA ...@@ -2,7 +2,8 @@ module QA
feature 'push code to repository', :core do feature 'push code to repository', :core do
context 'with regular account over http' do context 'with regular account over http' do
scenario 'user pushes code to the repository' do scenario 'user pushes code to the repository' do
Page::Main::Entry.act { sign_in_using_credentials } Page::Main::Entry.act { visit_login_page }
Page::Main::Login.act { sign_in_using_credentials }
Scenario::Gitlab::Project::Create.perform do |scenario| Scenario::Gitlab::Project::Create.perform do |scenario|
scenario.name = 'project_with_code' scenario.name = 'project_with_code'
......
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