From 9638ecbcbc5b03e65961c21492df378b90a75485 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sun, 4 Feb 2018 04:15:06 -0800 Subject: Add QA specs for LDAP login --- qa/qa.rb | 1 + qa/qa/page/main/login.rb | 17 +++++++++++++++++ qa/qa/scenario/test/integration/ldap.rb | 11 +++++++++++ qa/qa/specs/features/login/ldap_spec.rb | 15 +++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 qa/qa/scenario/test/integration/ldap.rb create mode 100644 qa/qa/specs/features/login/ldap_spec.rb diff --git a/qa/qa.rb b/qa/qa.rb index 8630e2a522c..3a4c2d575f1 100644 --- a/qa/qa.rb +++ b/qa/qa.rb @@ -64,6 +64,7 @@ module QA autoload :Instance, 'qa/scenario/test/instance' module Integration + autoload :Ldap, 'qa/scenario/test/integration/ldap' autoload :Mattermost, 'qa/scenario/test/integration/mattermost' end diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb index 95880475ffa..454573621ce 100644 --- a/qa/qa/page/main/login.rb +++ b/qa/qa/page/main/login.rb @@ -14,12 +14,27 @@ module QA element :sign_in_button, 'submit "Sign in"' end + view 'app/views/devise/sessions/_new_ldap.html.haml' do + element :username_field, 'text_field_tag :username' + element :password_field, 'password_field_tag :password' + element :sign_in_button, 'submit_tag "Sign in"' + end + def initialize wait(max: 500) do page.has_css?('.application') end end + def sign_in_using_ldap_credentials + click_link 'LDAP' + + fill_in :username, with: Runtime::User.name + fill_in :password, with: Runtime::User.password + + click_button 'Sign in' + end + def sign_in_using_credentials using_wait_time 0 do if page.has_content?('Change your password') @@ -28,6 +43,8 @@ module QA click_button 'Change your password' end + click_link 'Standard' if page.has_content?('LDAP') + fill_in :user_login, with: Runtime::User.name fill_in :user_password, with: Runtime::User.password click_button 'Sign in' diff --git a/qa/qa/scenario/test/integration/ldap.rb b/qa/qa/scenario/test/integration/ldap.rb new file mode 100644 index 00000000000..6f68ad9db5c --- /dev/null +++ b/qa/qa/scenario/test/integration/ldap.rb @@ -0,0 +1,11 @@ +module QA + module Scenario + module Test + module Integration + class Ldap < Test::Instance + tags :ldap + end + end + end + end +end diff --git a/qa/qa/specs/features/login/ldap_spec.rb b/qa/qa/specs/features/login/ldap_spec.rb new file mode 100644 index 00000000000..ac2bd5a3c39 --- /dev/null +++ b/qa/qa/specs/features/login/ldap_spec.rb @@ -0,0 +1,15 @@ +module QA + feature 'LDAP user login', :ldap do + scenario 'user logs in using LDAP credentials' do + Runtime::Browser.visit(:gitlab, Page::Main::Login) + Page::Main::Login.act { sign_in_using_ldap_credentials } + + # TODO, since `Signed in successfully` message was removed + # this is the only way to tell if user is signed in correctly. + # + Page::Menu::Main.perform do |menu| + expect(menu).to have_personal_area + end + end + end +end -- cgit v1.2.1