diff options
Diffstat (limited to 'qa')
-rw-r--r-- | qa/README.md | 3 | ||||
-rw-r--r-- | qa/qa.rb | 1 | ||||
-rw-r--r-- | qa/qa/factory/resource/secret_variable.rb | 2 | ||||
-rw-r--r-- | qa/qa/page/main/login.rb | 22 | ||||
-rw-r--r-- | qa/qa/page/project/settings/secret_variables.rb | 43 | ||||
-rw-r--r-- | qa/qa/page/project/show.rb | 3 | ||||
-rw-r--r-- | qa/qa/scenario/test/instance.rb | 7 | ||||
-rw-r--r-- | qa/qa/scenario/test/integration/ldap.rb | 11 | ||||
-rw-r--r-- | qa/qa/specs/features/login/ldap_spec.rb | 15 | ||||
-rw-r--r-- | qa/qa/specs/runner.rb | 2 | ||||
-rw-r--r-- | qa/spec/scenario/test/instance_spec.rb | 3 |
11 files changed, 77 insertions, 35 deletions
diff --git a/qa/README.md b/qa/README.md index b937dc4c7a0..3c1b61900d9 100644 --- a/qa/README.md +++ b/qa/README.md @@ -34,9 +34,6 @@ You can use GitLab QA to exercise tests on any live instance! For example, the following call would login to a local [GDK] instance and run all specs in `qa/specs/features`: -First, `cd` into the `$gdk/gitlab/qa` directory. -The `bin/qa` script expects you to be in the `qa` folder of the app. - ``` bin/qa Test::Instance http://localhost:3000 ``` @@ -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/factory/resource/secret_variable.rb b/qa/qa/factory/resource/secret_variable.rb index 54ef4d8d964..af0fa8af2df 100644 --- a/qa/qa/factory/resource/secret_variable.rb +++ b/qa/qa/factory/resource/secret_variable.rb @@ -31,7 +31,7 @@ module QA page.fill_variable_key(key) page.fill_variable_value(value) - page.add_variable + page.save_variables end end 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/page/project/settings/secret_variables.rb b/qa/qa/page/project/settings/secret_variables.rb index e3bfbfcf080..fea4acb389a 100644 --- a/qa/qa/page/project/settings/secret_variables.rb +++ b/qa/qa/page/project/settings/secret_variables.rb @@ -5,49 +5,40 @@ module QA class SecretVariables < Page::Base include Common - view 'app/views/ci/variables/_table.html.haml' do - element :variable_key, '.variable-key' - element :variable_value, '.variable-value' + view 'app/views/ci/variables/_variable_row.html.haml' do + element :variable_key, '.js-ci-variable-input-key' + element :variable_value, '.js-ci-variable-input-value' end view 'app/views/ci/variables/_index.html.haml' do - element :add_new_variable, 'btn_text: "Add new variable"' - end - - view 'app/assets/javascripts/behaviors/secret_values.js' do - element :reveal_value, 'Reveal value' - element :hide_value, 'Hide value' + element :save_variables, '.js-secret-variables-save-button' end def fill_variable_key(key) - fill_in 'variable_key', with: key + page.within('.js-ci-variable-list-section .js-row:nth-child(1)') do + page.find('.js-ci-variable-input-key').set(key) + end end def fill_variable_value(value) - fill_in 'variable_value', with: value + page.within('.js-ci-variable-list-section .js-row:nth-child(1)') do + page.find('.js-ci-variable-input-value').set(value) + end end - def add_variable - click_on 'Add new variable' + def save_variables + click_button('Save variables') end def variable_key - page.find('.variable-key').text - end - - def variable_value - reveal_value do - page.find('.variable-value').text + page.within('.js-ci-variable-list-section .js-row:nth-child(1)') do + page.find('.js-ci-variable-input-key').value end end - private - - def reveal_value - click_button('Reveal value') - - yield.tap do - click_button('Hide value') + def variable_value + page.within('.js-ci-variable-list-section .js-row:nth-child(1)') do + page.find('.js-ci-variable-input-value').value end end end diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 553d35f9579..9d2a84ea644 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -3,7 +3,6 @@ module QA module Project class Show < Page::Base view 'app/views/shared/_clone_panel.html.haml' do - element :clone_holder, '.git-clone-holder' element :clone_dropdown element :clone_options_dropdown, '.clone-options-dropdown' element :project_repository_location, 'text_field_tag :project_clone' @@ -31,7 +30,7 @@ module QA end # Ensure git clone textbox was updated to http URI - page.has_css?('.git-clone-holder input#project_clone[value*="http"]') + repository_location.include?('http') end end diff --git a/qa/qa/scenario/test/instance.rb b/qa/qa/scenario/test/instance.rb index 993bbd723a3..0af9afd1ea4 100644 --- a/qa/qa/scenario/test/instance.rb +++ b/qa/qa/scenario/test/instance.rb @@ -22,7 +22,12 @@ module QA Specs::Runner.perform do |specs| specs.tty = true specs.tags = self.class.focus - specs.files = files.any? ? files : 'qa/specs/features' + specs.files = + if files.any? + files + else + File.expand_path('../../specs/features', __dir__) + end end end end 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 diff --git a/qa/qa/specs/runner.rb b/qa/qa/specs/runner.rb index 3f7b75df986..752e3e60b8c 100644 --- a/qa/qa/specs/runner.rb +++ b/qa/qa/specs/runner.rb @@ -8,7 +8,7 @@ module QA def initialize @tty = false @tags = [] - @files = ['qa/specs/features'] + @files = [File.expand_path('./features', __dir__)] end def perform diff --git a/qa/spec/scenario/test/instance_spec.rb b/qa/spec/scenario/test/instance_spec.rb index 1824db54c9b..bd09c28e924 100644 --- a/qa/spec/scenario/test/instance_spec.rb +++ b/qa/spec/scenario/test/instance_spec.rb @@ -29,7 +29,8 @@ describe QA::Scenario::Test::Instance do it 'should call runner with default arguments' do subject.perform("test") - expect(runner).to have_received(:files=).with('qa/specs/features') + expect(runner).to have_received(:files=) + .with(File.expand_path('../../../qa/specs/features', __dir__)) end end |