summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanad Liaquat <sliaquat@gitlab.com>2019-01-31 20:37:00 +0500
committerSanad Liaquat <sliaquat@gitlab.com>2019-01-31 20:37:00 +0500
commit5143dfec58b14250754f162574b7b7a07e85601d (patch)
tree042512db08162c31726c8a38d7917cd748ed9c0e
parent1a4a982aa8296b46f498a4b25b181d47168bfe65 (diff)
downloadgitlab-ce-qa-github-oauth-login-test.tar.gz
Implement review feedbackqa-github-oauth-login-test
-rw-r--r--app/helpers/auth_helper.rb7
-rw-r--r--app/views/devise/shared/_omniauth_box.html.haml2
-rw-r--r--qa/qa.rb1
-rw-r--r--qa/qa/page/main/login.rb6
-rw-r--r--qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb2
-rw-r--r--qa/qa/vendor/github/page/login.rb2
6 files changed, 14 insertions, 6 deletions
diff --git a/app/helpers/auth_helper.rb b/app/helpers/auth_helper.rb
index 01a0fb34484..966d1c10dac 100644
--- a/app/helpers/auth_helper.rb
+++ b/app/helpers/auth_helper.rb
@@ -16,6 +16,13 @@ module AuthHelper
PROVIDERS_WITH_ICONS.include?(name.to_s)
end
+ def qa_class_for_provider(provider)
+ {
+ saml: 'qa-saml-login-button',
+ github: 'qa-github-login-button'
+ }[provider.to_sym]
+ end
+
def auth_providers
Gitlab::Auth::OAuth::Provider.providers
end
diff --git a/app/views/devise/shared/_omniauth_box.html.haml b/app/views/devise/shared/_omniauth_box.html.haml
index 3758dbe93ba..1b583ea85d6 100644
--- a/app/views/devise/shared/_omniauth_box.html.haml
+++ b/app/views/devise/shared/_omniauth_box.html.haml
@@ -5,7 +5,7 @@
.d-flex.justify-content-between.flex-wrap
- providers.each do |provider|
- has_icon = provider_has_icon?(provider)
- = link_to omniauth_authorize_path(:user, provider), method: :post, class: "btn d-flex align-items-center omniauth-btn text-left oauth-login qa-#{provider}-login-button", id: "oauth-login-#{provider}" do
+ = link_to omniauth_authorize_path(:user, provider), method: :post, class: "btn d-flex align-items-center omniauth-btn text-left oauth-login #{qa_class_for_provider(provider)}", id: "oauth-login-#{provider}" do
- if has_icon
= provider_image_tag(provider)
%span
diff --git a/qa/qa.rb b/qa/qa.rb
index 49cb32ddab9..b81c3e38bc5 100644
--- a/qa/qa.rb
+++ b/qa/qa.rb
@@ -342,6 +342,7 @@ module QA
autoload :Login, 'qa/vendor/saml_idp/page/login'
end
end
+
module Github
module Page
autoload :Base, 'qa/vendor/github/page/base'
diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb
index 5804c2517cb..a0a154c0344 100644
--- a/qa/qa/page/main/login.rb
+++ b/qa/qa/page/main/login.rb
@@ -31,9 +31,9 @@ module QA
element :register_tab
end
- view 'app/views/devise/shared/_omniauth_box.html.haml' do
- element :saml_login_button, 'qa-#{provider}-login-button' # rubocop:disable QA/ElementWithPattern, Lint/InterpolationCheck
- element :github_login_button, 'qa-#{provider}-login-button' # rubocop:disable QA/ElementWithPattern, Lint/InterpolationCheck
+ view 'app/helpers/auth_helper.rb' do
+ element :saml_login_button
+ element :github_login_button
end
view 'app/views/layouts/devise.html.haml' do
diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb
index 50e8423ee6f..a118176eb8a 100644
--- a/qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb
+++ b/qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb
@@ -3,7 +3,7 @@
module QA
context 'Manage', :orchestrated, :oauth do
describe 'OAuth login' do
- it 'User logs in to gitlab with github oauth' do
+ it 'User logs in to GitLab with GitHub OAuth' do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_with_github)
diff --git a/qa/qa/vendor/github/page/login.rb b/qa/qa/vendor/github/page/login.rb
index d025887d7fc..f6dc408e248 100644
--- a/qa/qa/vendor/github/page/login.rb
+++ b/qa/qa/vendor/github/page/login.rb
@@ -12,7 +12,7 @@ module QA
fill_in 'password', with: QA::Runtime::Env.github_password
click_on 'Sign in'
- if has_text?("Authorize GitLab-OAuth", wait: 2.0)
+ if has_text?("Authorize GitLab-OAuth", wait: 2)
click_on 'Authorize gitlab-qa' if has_button?('Authorize gitlab-qa')
end
end