Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-02-09 13:12:20 +0300
committerLin Jen-Shin <godfat@godfat.org>2018-02-09 13:12:20 +0300
commit09a3b8fb655ac673a5d706548d13c26cdb53aa9f (patch)
tree1de0f5552cf1235587cc36f59c1ddc92c1a50752 /qa
parent1264e2b6e8ce53f578255e9296875947845431bf (diff)
parent7534f7a892d6e8c50475720e387b8689c94582da (diff)
Merge remote-tracking branch 'upstream/master' into qa-clone-with-deploy-key
* upstream/master: (466 commits) Set initial password for instance in LDAP QA test Backport EE changes to some hashed storage documentation to CE Remove allow_n_plus_1 from Git::Repository#branches_filter Bumps Gitlab Shell version to 6.0.3 Make resetting column information overridable in EE Added 'clear' button to ci lint editor Issues and merge requests in subgroups docs Update docs labels CE Refactored merge_requests/show path in dispatcher.js wording don't check against a hardcoded user name 10.5 Update the dependencies license list 10.5 Update the .gitignore, .gitlab-ci.yml, and Dockerfile templates Create update guide for 10.5 Update 10.5 source install guide Add docs for MR link in commit page Add groups to OpenID Connect claims Replaced $.get with axois.get Memoize MergeRequest#rebase_in_progress? to prevent N+1 queries in Gitaly Update style_guide_scss.md ...
Diffstat (limited to 'qa')
-rw-r--r--qa/README.md3
-rw-r--r--qa/qa.rb1
-rw-r--r--qa/qa/factory/resource/secret_variable.rb2
-rw-r--r--qa/qa/page/component/dropzone.rb2
-rw-r--r--qa/qa/page/main/login.rb39
-rw-r--r--qa/qa/page/project/issue/show.rb2
-rw-r--r--qa/qa/page/project/settings/secret_variables.rb43
-rw-r--r--qa/qa/page/project/show.rb10
-rw-r--r--qa/qa/runtime/browser.rb2
-rw-r--r--qa/qa/scenario/test/instance.rb7
-rw-r--r--qa/qa/scenario/test/integration/ldap.rb11
-rw-r--r--qa/qa/specs/features/api/users_spec.rb4
-rw-r--r--qa/qa/specs/features/login/ldap_spec.rb15
-rw-r--r--qa/qa/specs/runner.rb2
-rw-r--r--qa/spec/scenario/test/instance_spec.rb3
15 files changed, 98 insertions, 48 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
```
diff --git a/qa/qa.rb b/qa/qa.rb
index b5536a449f1..c1b5d278186 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/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/component/dropzone.rb b/qa/qa/page/component/dropzone.rb
index 5e6fdff20eb..15bdc742fda 100644
--- a/qa/qa/page/component/dropzone.rb
+++ b/qa/qa/page/component/dropzone.rb
@@ -4,6 +4,8 @@ module QA
class Dropzone
attr_reader :page, :container
+ # page - A QA::Page::Base object
+ # container - CSS selector of the comment textarea's container
def initialize(page, container)
@page = page
@container = container
diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb
index 95880475ffa..fd49b27cb1a 100644
--- a/qa/qa/page/main/login.rb
+++ b/qa/qa/page/main/login.rb
@@ -14,19 +14,48 @@ 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 set_initial_password_if_present
+ if page.has_content?('Change your password')
+ fill_in :user_password, with: Runtime::User.password
+ fill_in :user_password_confirmation, with: Runtime::User.password
+ click_button 'Change your password'
+ end
+ end
+
+ def sign_in_using_ldap_credentials
+ using_wait_time 0 do
+ set_initial_password_if_present
+
+ click_link 'LDAP'
+
+ fill_in :username, with: Runtime::User.name
+ fill_in :password, with: Runtime::User.password
+ click_button 'Sign in'
+ end
+ end
+
def sign_in_using_credentials
using_wait_time 0 do
- if page.has_content?('Change your password')
- fill_in :user_password, with: Runtime::User.password
- fill_in :user_password_confirmation, with: Runtime::User.password
- click_button 'Change your password'
- end
+ set_initial_password_if_present
+
+ click_link 'Standard' if page.has_content?('LDAP')
fill_in :user_login, with: Runtime::User.name
fill_in :user_password, with: Runtime::User.password
diff --git a/qa/qa/page/project/issue/show.rb b/qa/qa/page/project/issue/show.rb
index 364a2c61665..5bc0598a524 100644
--- a/qa/qa/page/project/issue/show.rb
+++ b/qa/qa/page/project/issue/show.rb
@@ -27,7 +27,7 @@ module QA
fill_in(with: text, name: 'note[note]')
unless attachment.nil?
- QA::Page::Component::Dropzone.new(page, '.new-note')
+ QA::Page::Component::Dropzone.new(self, '.new-note')
.attach_file(attachment)
end
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 e8b26900460..1f1fede2149 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'
@@ -23,11 +22,11 @@ module QA
end
def choose_repository_clone_http
- choose_repository_clone('HTTP')
+ choose_repository_clone('HTTP', 'http')
end
def choose_repository_clone_ssh
- choose_repository_clone('SSH')
+ choose_repository_clone('SSH', '@')
end
def repository_location
@@ -55,7 +54,7 @@ module QA
private
- def choose_repository_clone(kind)
+ def choose_repository_clone(kind, detect_text)
wait(reload: false) do
click_element :clone_dropdown
@@ -64,8 +63,7 @@ module QA
end
# Ensure git clone textbox was updated to http URI
- page.has_css?(
- %Q{.git-clone-holder input#project_clone[value*="#{kind}"]})
+ repository_location.include?(detect_text)
end
end
end
diff --git a/qa/qa/runtime/browser.rb b/qa/qa/runtime/browser.rb
index ce888b51ea5..a12d95683af 100644
--- a/qa/qa/runtime/browser.rb
+++ b/qa/qa/runtime/browser.rb
@@ -84,7 +84,7 @@ module QA
config.javascript_driver = :chrome
config.default_max_wait_time = 10
# https://github.com/mattheworiordan/capybara-screenshot/issues/164
- config.save_path = 'tmp'
+ config.save_path = File.expand_path('../../tmp', __dir__)
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/api/users_spec.rb b/qa/qa/specs/features/api/users_spec.rb
index 9d039590a0e..d4ff4ebbc9a 100644
--- a/qa/qa/specs/features/api/users_spec.rb
+++ b/qa/qa/specs/features/api/users_spec.rb
@@ -14,7 +14,7 @@ module QA
end
scenario 'submit request with a valid user name' do
- get request.url, { params: { username: 'root' } }
+ get request.url, { params: { username: Runtime::User.name } }
expect_status(200)
expect(json_body).to be_an Array
@@ -23,7 +23,7 @@ module QA
end
scenario 'submit request with an invalid user name' do
- get request.url, { params: { username: 'invalid' } }
+ get request.url, { params: { username: SecureRandom.hex(10) } }
expect_status(200)
expect(json_body).to be_an Array
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