diff options
author | Martin Wortschack <mwortschack@gitlab.com> | 2018-09-11 08:43:10 +0200 |
---|---|---|
committer | Martin Wortschack <mwortschack@gitlab.com> | 2018-09-11 08:43:10 +0200 |
commit | a2f7936c74e6c9c4eed7b1c5641f0c43d4ff1375 (patch) | |
tree | 82b1ea27fe2a9a1be884467e10d9bde688ce97d1 /qa/qa | |
parent | bfd2181310097f5c0a92a43ffc2b7b9540b96ad3 (diff) | |
parent | 2f990e3408d00cad473d8dcf8a4e49155cc3cc33 (diff) | |
download | gitlab-ce-a2f7936c74e6c9c4eed7b1c5641f0c43d4ff1375.tar.gz |
merge master and resolve conflicts
Diffstat (limited to 'qa/qa')
-rw-r--r-- | qa/qa/page/component/groups_filter.rb | 4 | ||||
-rw-r--r-- | qa/qa/page/dashboard/groups.rb | 5 | ||||
-rw-r--r-- | qa/qa/page/group/show.rb | 4 | ||||
-rw-r--r-- | qa/qa/page/main/login.rb | 25 | ||||
-rw-r--r-- | qa/qa/page/project/new.rb | 3 | ||||
-rw-r--r-- | qa/qa/runtime/env.rb | 22 | ||||
-rw-r--r-- | qa/qa/runtime/user.rb | 18 | ||||
-rw-r--r-- | qa/qa/scenario/test/sanity/framework.rb (renamed from qa/qa/scenario/test/sanity/failing.rb) | 7 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb | 4 | ||||
-rw-r--r-- | qa/qa/specs/features/sanity/failing_spec.rb | 13 | ||||
-rw-r--r-- | qa/qa/specs/features/sanity/framework_spec.rb | 23 | ||||
-rw-r--r-- | qa/qa/specs/runner.rb | 7 |
12 files changed, 89 insertions, 46 deletions
diff --git a/qa/qa/page/component/groups_filter.rb b/qa/qa/page/component/groups_filter.rb index 69d465e8ac7..e647d368f0f 100644 --- a/qa/qa/page/component/groups_filter.rb +++ b/qa/qa/page/component/groups_filter.rb @@ -7,7 +7,7 @@ module QA def self.included(base) base.view 'app/views/shared/groups/_search_form.html.haml' do element :groups_filter, 'search_field_tag :filter' - element :groups_filter_placeholder, 'Filter by name...' + element :groups_filter_placeholder, 'Search by name' end base.view 'app/views/shared/groups/_empty_state.html.haml' do @@ -27,7 +27,7 @@ module QA page.has_css?(element_selector_css(:groups_list_tree_container)) end - fill_in 'Filter by name...', with: name + fill_in 'Search by name', with: name end end end diff --git a/qa/qa/page/dashboard/groups.rb b/qa/qa/page/dashboard/groups.rb index 5654cc01e09..70c5f996ff8 100644 --- a/qa/qa/page/dashboard/groups.rb +++ b/qa/qa/page/dashboard/groups.rb @@ -4,6 +4,11 @@ module QA class Groups < Page::Base include Page::Component::GroupsFilter + view 'app/views/shared/groups/_search_form.html.haml' do + element :groups_filter, 'search_field_tag :filter' + element :groups_filter_placeholder, 'Search by name' + end + view 'app/views/dashboard/_groups_head.html.haml' do element :new_group_button, 'link_to _("New group")' end diff --git a/qa/qa/page/group/show.rb b/qa/qa/page/group/show.rb index ac85f16d8af..6747f7f10b6 100644 --- a/qa/qa/page/group/show.rb +++ b/qa/qa/page/group/show.rb @@ -16,7 +16,7 @@ module QA end view 'app/assets/javascripts/groups/constants.js' do - element :no_result_text, 'Sorry, no groups or projects matched your search' + element :no_result_text, 'No groups or projects matched your search' end def go_to_subgroup(name) @@ -30,7 +30,7 @@ module QA def has_subgroup?(name) filter_by_name(name) - page.has_text?(/#{name}|Sorry, no groups or projects matched your search/, wait: 60) + page.has_text?(/#{name}|No groups or projects matched your search/, wait: 60) page.has_text?(name, wait: 0) end diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb index afc8b66d878..08cf8da34fd 100644 --- a/qa/qa/page/main/login.rb +++ b/qa/qa/page/main/login.rb @@ -59,10 +59,31 @@ module QA Page::Menu::Main.act { has_personal_area? } end + def sign_in_using_admin_credentials + admin = QA::Factory::Resource::User.new.tap do |user| + user.username = QA::Runtime::User.admin_username + user.password = QA::Runtime::User.admin_password + end + + using_wait_time 0 do + sign_in_using_gitlab_credentials(admin) + end + + Page::Menu::Main.act { has_personal_area? } + end + def self.path '/users/sign_in' end + def sign_in_tab? + page.has_button?('Sign in') + end + + def ldap_tab? + page.has_link?('LDAP') + end + def switch_to_sign_in_tab click_on 'Sign in' end @@ -90,8 +111,8 @@ module QA end def sign_in_using_gitlab_credentials(user) - switch_to_sign_in_tab unless page.has_button?('Sign in') - switch_to_standard_tab if page.has_content?('LDAP') + switch_to_sign_in_tab unless sign_in_tab? + switch_to_standard_tab if ldap_tab? fill_in :user_login, with: user.username fill_in :user_password, with: user.password diff --git a/qa/qa/page/project/new.rb b/qa/qa/page/project/new.rb index 1fb569b0f29..0766c98da6f 100644 --- a/qa/qa/page/project/new.rb +++ b/qa/qa/page/project/new.rb @@ -11,6 +11,7 @@ module QA view 'app/views/projects/_new_project_fields.html.haml' do element :project_namespace_select element :project_namespace_field, 'namespaces_options' + element :project_name, 'text_field :name' element :project_path, 'text_field :path' element :project_description, 'text_area :description' element :project_create_button, "submit 'Create project'" @@ -32,7 +33,7 @@ module QA end def choose_name(name) - fill_in 'project_path', with: name + fill_in 'project_name', with: name end def add_description(description) diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index 841c959045f..27ba915961d 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -3,8 +3,6 @@ module QA module Env extend self - attr_writer :user_type - # set to 'false' to have Chrome run visibly instead of headless def chrome_headless? (ENV['CHROME_HEADLESS'] =~ /^(false|no|0)$/i) != 0 @@ -19,18 +17,6 @@ module QA ENV['PERSONAL_ACCESS_TOKEN'] end - # By default, "standard" denotes a standard GitLab user login. - # Set this to "ldap" if the user should be logged in via LDAP. - def user_type - return @user_type if defined?(@user_type) # rubocop:disable Gitlab/ModuleWithInstanceVariables - - ENV.fetch('GITLAB_USER_TYPE', 'standard').tap do |type| - unless %w(ldap standard).include?(type) - raise ArgumentError.new("Invalid user type '#{type}': must be 'ldap' or 'standard'") - end - end - end - def user_username ENV['GITLAB_USERNAME'] end @@ -39,6 +25,14 @@ module QA ENV['GITLAB_PASSWORD'] end + def admin_username + ENV['GITLAB_ADMIN_USERNAME'] + end + + def admin_password + ENV['GITLAB_ADMIN_PASSWORD'] + end + def forker? forker_username && forker_password end diff --git a/qa/qa/runtime/user.rb b/qa/qa/runtime/user.rb index b016777c987..5eb7a210fce 100644 --- a/qa/qa/runtime/user.rb +++ b/qa/qa/runtime/user.rb @@ -7,25 +7,37 @@ module QA 'root' end + def default_password + '5iveL!fe' + end + def username Runtime::Env.user_username || default_username end def password - Runtime::Env.user_password || '5iveL!fe' + Runtime::Env.user_password || default_password end def ldap_user? - Runtime::Env.user_type == 'ldap' + Runtime::Env.ldap_username && Runtime::Env.ldap_password end def ldap_username - Runtime::Env.ldap_username || name + Runtime::Env.ldap_username || username end def ldap_password Runtime::Env.ldap_password || password end + + def admin_username + Runtime::Env.admin_username || default_username + end + + def admin_password + Runtime::Env.admin_password || default_password + end end end end diff --git a/qa/qa/scenario/test/sanity/failing.rb b/qa/qa/scenario/test/sanity/framework.rb index 03452f6693d..7835d2564f0 100644 --- a/qa/qa/scenario/test/sanity/failing.rb +++ b/qa/qa/scenario/test/sanity/framework.rb @@ -5,12 +5,13 @@ module QA module Test module Sanity ## - # This scenario exits with a 1 exit code. + # This scenario runs 1 passing example, and 1 failing example, and exits + # with a 1 exit code. # - class Failing < Template + class Framework < Template include Bootable - tags :failing + tags :framework end end end diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb index c9958917be9..c296296def6 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb @@ -3,10 +3,6 @@ module QA context :manage, :orchestrated, :ldap do describe 'LDAP login' do - before do - Runtime::Env.user_type = 'ldap' - end - it 'user logs into GitLab using LDAP credentials' do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } diff --git a/qa/qa/specs/features/sanity/failing_spec.rb b/qa/qa/specs/features/sanity/failing_spec.rb deleted file mode 100644 index 7e0480e9067..00000000000 --- a/qa/qa/specs/features/sanity/failing_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module QA - context 'Sanity checks', :orchestrated, :failing do - describe 'Failing orchestrated example' do - it 'always fails' do - Runtime::Browser.visit(:gitlab, Page::Main::Login) - - expect(page).to have_text("These Aren't the Texts You're Looking For", wait: 1) - end - end - end -end diff --git a/qa/qa/specs/features/sanity/framework_spec.rb b/qa/qa/specs/features/sanity/framework_spec.rb new file mode 100644 index 00000000000..ee9d068eb3a --- /dev/null +++ b/qa/qa/specs/features/sanity/framework_spec.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module QA + context 'Framework sanity checks', :orchestrated, :framework do + describe 'Passing orchestrated example' do + it 'succeeds' do + Runtime::Browser.visit(:gitlab, Page::Main::Login) + + Page::Main::Login.perform do |main_login| + expect(main_login.sign_in_tab?).to be(true) + end + end + end + + describe 'Failing orchestrated example' do + it 'fails' do + Runtime::Browser.visit(:gitlab, Page::Main::Login) + + expect(page).to have_text("These Aren't the Texts You're Looking For", wait: 1) + end + end + end +end diff --git a/qa/qa/specs/runner.rb b/qa/qa/specs/runner.rb index 5b5699d8a93..fea0ef94df3 100644 --- a/qa/qa/specs/runner.rb +++ b/qa/qa/specs/runner.rb @@ -5,10 +5,12 @@ module QA class Runner < Scenario::Template attr_accessor :tty, :tags, :options + DEFAULT_TEST_PATH_ARGS = ['--', File.expand_path('./features', __dir__)].freeze + def initialize @tty = false @tags = [] - @options = [File.expand_path('./features', __dir__)] + @options = [] end def perform @@ -18,10 +20,11 @@ module QA if tags.any? tags.each { |tag| args.push(['--tag', tag.to_s]) } else - args.push(%w[--tag ~orchestrated]) + args.push(%w[--tag ~orchestrated]) unless (%w[-t --tag] & options).any? end args.push(options) + args.push(DEFAULT_TEST_PATH_ARGS) unless options.any? { |opt| opt =~ %r{/features/} } Runtime::Browser.configure! |