summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2018-02-07 08:10:39 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-02-07 08:10:39 +0000
commit586ecbc5d3ec55858e6ee9258f59b1790c543d18 (patch)
tree798a9bb11ea6bb6c8660402cb1da4d670ddf2d0f
parenta08fc12348dd16f35f15b05aa2ad3ee24150e56f (diff)
parent739916748d692194c561b7ad07cd33d867079bed (diff)
downloadgitlab-ce-586ecbc5d3ec55858e6ee9258f59b1790c543d18.tar.gz
Merge branch 'sh-add-ldap-qa' into 'master'
Add QA specs for LDAP login See merge request gitlab-org/gitlab-ce!16914
-rw-r--r--qa/qa.rb1
-rw-r--r--qa/qa/page/main/login.rb22
-rw-r--r--qa/qa/scenario/test/integration/ldap.rb11
-rw-r--r--qa/qa/specs/features/login/ldap_spec.rb15
4 files changed, 49 insertions, 0 deletions
diff --git a/qa/qa.rb b/qa/qa.rb
index 8630e2a522c..3c7778a4260 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..0d1ffd9694a 100644
--- a/qa/qa/page/main/login.rb
+++ b/qa/qa/page/main/login.rb
@@ -14,12 +14,32 @@ 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
+
+ view 'app/views/devise/shared/_tabs_ldap.html.haml' do
+ element :ldap_tab, "link_to server['label']"
+ element :standard_tab, "link_to 'Standard'"
+ 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 +48,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..257ed81d9e1
--- /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