diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-30 09:06:31 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-30 09:06:31 +0000 |
commit | 94611567bd03083e0ecef7a582a174aa34844482 (patch) | |
tree | 5c720fd3bc8b244491a4c4d1303348ba2b6128f9 /qa | |
parent | 42572f63eab5db8dc39279e0deeeadef86180a71 (diff) | |
download | gitlab-ce-94611567bd03083e0ecef7a582a174aa34844482.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa.rb | 4 | ||||
-rw-r--r-- | qa/qa/page/base.rb | 5 | ||||
-rw-r--r-- | qa/qa/page/component/note.rb | 11 | ||||
-rw-r--r-- | qa/qa/resource/repository/commit.rb | 29 | ||||
-rw-r--r-- | qa/qa/runtime/env.rb | 16 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb | 3 | ||||
-rw-r--r-- | qa/qa/vendor/github/page/login.rb | 6 | ||||
-rw-r--r-- | qa/qa/vendor/one_password/cli.rb | 34 | ||||
-rwxr-xr-x | qa/qa/vendor/one_password/darwin/op | bin | 0 -> 10616336 bytes | |||
-rwxr-xr-x | qa/qa/vendor/one_password/linux/op | bin | 0 -> 9003392 bytes |
10 files changed, 97 insertions, 11 deletions
@@ -435,6 +435,10 @@ module QA autoload :Login, 'qa/vendor/github/page/login' end end + + module OnePassword + autoload :CLI, 'qa/vendor/one_password/cli' + end end # Classes that provide support to other parts of the framework. diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index 94e046fd3bf..a6ae0767cb4 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -151,6 +151,11 @@ module QA end def within_element_by_index(name, index) + # Finding all elements can be flaky if the elements don't all load + # immediately. So we wait for any to appear before trying to find a + # specific one. + has_element?(name) + page.within all_elements(name)[index] do yield end diff --git a/qa/qa/page/component/note.rb b/qa/qa/page/component/note.rb index 34fde045091..c85fa690d6c 100644 --- a/qa/qa/page/component/note.rb +++ b/qa/qa/page/component/note.rb @@ -10,6 +10,10 @@ module QA element :discussion_option end + base.view 'app/assets/javascripts/notes/components/noteable_discussion.vue' do + element :discussion_content + end + base.view 'app/assets/javascripts/notes/components/note_actions.vue' do element :note_edit_button end @@ -21,6 +25,7 @@ module QA base.view 'app/assets/javascripts/notes/components/discussion_actions.vue' do element :discussion_reply_tab + element :resolve_discussion_button end base.view 'app/assets/javascripts/notes/components/toggle_replies_widget.vue' do @@ -54,6 +59,12 @@ module QA click_element :reply_comment_button end + def resolve_discussion_at_index(index) + within_element_by_index(:discussion_content, index) do + click_element :resolve_discussion_button + end + end + def collapse_replies click_element :collapse_replies end diff --git a/qa/qa/resource/repository/commit.rb b/qa/qa/resource/repository/commit.rb index 61c2ad6bfc0..4b4c64d589d 100644 --- a/qa/qa/resource/repository/commit.rb +++ b/qa/qa/resource/repository/commit.rb @@ -21,14 +21,16 @@ module QA @commit_message = 'QA Test - Commit message' end - def files=(files) - if !files.is_a?(Array) || - files.empty? || - files.any? { |file| !file.has_key?(:file_path) || !file.has_key?(:content) } - raise ArgumentError, "Please provide an array of hashes e.g.: [{file_path: 'file1', content: 'foo'}]" - end + def add_files(files) + validate_files!(files) + + @add_files = files + end + + def update_files(files) + validate_files!(files) - @files = files + @update_files = files end def resource_web_url(resource) @@ -56,8 +58,17 @@ module QA end def actions - @files.map do |file| - file.merge({ action: "create" }) + @add_files.map { |file| file.merge({ action: "create" }) } if @add_files + @update_files.map { |file| file.merge({ action: "update" }) } if @update_files + end + + private + + def validate_files!(files) + if !files.is_a?(Array) || + files.empty? || + files.any? { |file| !file.has_key?(:file_path) || !file.has_key?(:content) } + raise ArgumentError, "Please provide an array of hashes e.g.: [{file_path: 'file1', content: 'foo'}]" end end end diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index a437c83100a..b4047ef5088 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -177,6 +177,22 @@ module QA ENV['GITLAB_QA_PASSWORD_6'] end + def gitlab_qa_1p_email + ENV['GITLAB_QA_1P_EMAIL'] + end + + def gitlab_qa_1p_password + ENV['GITLAB_QA_1P_PASSWORD'] + end + + def gitlab_qa_1p_secret + ENV['GITLAB_QA_1P_SECRET'] + end + + def gitlab_qa_1p_github_uuid + ENV['GITLAB_QA_1P_GITHUB_UUID'] + end + def knapsack? !!(ENV['KNAPSACK_GENERATE_REPORT'] || ENV['KNAPSACK_REPORT_PATH'] || ENV['KNAPSACK_TEST_FILE_PATTERN']) end diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb index db99488160b..a118176eb8a 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true module QA - # Failure issue: https://gitlab.com/gitlab-org/quality/nightly/issues/121 - context 'Manage', :orchestrated, :oauth, :quarantine do + context 'Manage', :orchestrated, :oauth do describe 'OAuth login' do it 'User logs in to GitLab with GitHub OAuth' do Runtime::Browser.visit(:gitlab, Page::Main::Login) diff --git a/qa/qa/vendor/github/page/login.rb b/qa/qa/vendor/github/page/login.rb index 120ba6e6c06..f6e72bb01f9 100644 --- a/qa/qa/vendor/github/page/login.rb +++ b/qa/qa/vendor/github/page/login.rb @@ -12,6 +12,12 @@ module QA fill_in 'password', with: QA::Runtime::Env.github_password click_on 'Sign in' + otp = OnePassword::CLI.new.otp + + fill_in 'otp', with: otp + + click_on 'Verify' + click_on 'Authorize gitlab-qa' if has_button?('Authorize gitlab-qa') end end diff --git a/qa/qa/vendor/one_password/cli.rb b/qa/qa/vendor/one_password/cli.rb new file mode 100644 index 00000000000..3cb69391783 --- /dev/null +++ b/qa/qa/vendor/one_password/cli.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module QA + module Vendor + module OnePassword + class CLI + def initialize + @email = QA::Runtime::Env.gitlab_qa_1p_email + @password = QA::Runtime::Env.gitlab_qa_1p_password + @secret = QA::Runtime::Env.gitlab_qa_1p_secret + @github_uuid = QA::Runtime::Env.gitlab_qa_1p_github_uuid + end + + def otp + `#{op_path} get totp #{@github_uuid} --session=#{session_token}`.to_i + end + + private + + def session_token + `echo '#{@password}' | #{op_path} signin gitlab.1password.com #{@email} #{@secret} --output=raw --shorthand=gitlab_qa` + end + + def op_path + File.expand_path(File.join(%W[qa vendor one_password #{os} op])) + end + + def os + RUBY_PLATFORM.include?("darwin") ? "darwin" : "linux" + end + end + end + end +end diff --git a/qa/qa/vendor/one_password/darwin/op b/qa/qa/vendor/one_password/darwin/op Binary files differnew file mode 100755 index 00000000000..0f646522834 --- /dev/null +++ b/qa/qa/vendor/one_password/darwin/op diff --git a/qa/qa/vendor/one_password/linux/op b/qa/qa/vendor/one_password/linux/op Binary files differnew file mode 100755 index 00000000000..47ce87731be --- /dev/null +++ b/qa/qa/vendor/one_password/linux/op |