diff options
author | Stan Hu <stanhu@gmail.com> | 2018-02-04 15:15:06 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-02-05 08:38:07 +0300 |
commit | 9638ecbcbc5b03e65961c21492df378b90a75485 (patch) | |
tree | 3dfe1c2ec0ce82cba61cd13ba619980f99c32ba9 | |
parent | 5aea8dc1a6dc17d4a73e65f3c3a0f8b7e29686eb (diff) |
Add QA specs for LDAP login
-rw-r--r-- | qa/qa.rb | 1 | ||||
-rw-r--r-- | qa/qa/page/main/login.rb | 17 | ||||
-rw-r--r-- | qa/qa/scenario/test/integration/ldap.rb | 11 | ||||
-rw-r--r-- | qa/qa/specs/features/login/ldap_spec.rb | 15 |
4 files changed, 44 insertions, 0 deletions
@@ -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 |