diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-27 12:07:43 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-27 12:07:43 +0000 |
commit | 39fa7d1eeb2dba52f0601128f3ac91f57d19866e (patch) | |
tree | da042d34ff762dd1957e51666a34202295a081b9 /qa | |
parent | 6ac4a6713ed3196af899011f7e18658e16ebaac0 (diff) | |
download | gitlab-ce-39fa7d1eeb2dba52f0601128f3ac91f57d19866e.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa.rb | 12 | ||||
-rw-r--r-- | qa/qa/page/main/login.rb | 6 | ||||
-rw-r--r-- | qa/qa/scenario/test/integration/oauth.rb | 13 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb | 19 | ||||
-rw-r--r-- | qa/qa/vendor/github/page/base.rb | 14 | ||||
-rw-r--r-- | qa/qa/vendor/github/page/login.rb | 38 | ||||
-rw-r--r-- | qa/qa/vendor/one_password/cli.rb | 63 | ||||
-rwxr-xr-x | qa/qa/vendor/one_password/darwin/op | bin | 11185296 -> 0 bytes | |||
-rwxr-xr-x | qa/qa/vendor/one_password/linux/op | bin | 7712832 -> 0 bytes | |||
-rw-r--r-- | qa/spec/page/base_spec.rb | 4 | ||||
-rw-r--r-- | qa/spec/scenario/test/integration/oauth_spec.rb | 9 |
11 files changed, 2 insertions, 176 deletions
@@ -134,7 +134,6 @@ module QA autoload :LDAPNoServer, 'qa/scenario/test/integration/ldap_no_server' autoload :LDAPTLS, 'qa/scenario/test/integration/ldap_tls' autoload :InstanceSAML, 'qa/scenario/test/integration/instance_saml' - autoload :OAuth, 'qa/scenario/test/integration/oauth' autoload :Kubernetes, 'qa/scenario/test/integration/kubernetes' autoload :Mattermost, 'qa/scenario/test/integration/mattermost' autoload :ObjectStorage, 'qa/scenario/test/integration/object_storage' @@ -483,17 +482,6 @@ module QA autoload :ConfigureJob, 'qa/vendor/jenkins/page/configure_job' end end - - module Github - module Page - autoload :Base, 'qa/vendor/github/page/base' - 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/main/login.rb b/qa/qa/page/main/login.rb index cb3421f93c2..72884e97185 100644 --- a/qa/qa/page/main/login.rb +++ b/qa/qa/page/main/login.rb @@ -35,7 +35,6 @@ module QA view 'app/helpers/auth_helper.rb' do element :saml_login_button - element :github_login_button end view 'app/views/layouts/devise.html.haml' do @@ -139,11 +138,6 @@ module QA click_element :standard_tab end - def sign_in_with_github - set_initial_password_if_present - click_element :github_login_button - end - def sign_in_with_saml set_initial_password_if_present click_element :saml_login_button diff --git a/qa/qa/scenario/test/integration/oauth.rb b/qa/qa/scenario/test/integration/oauth.rb deleted file mode 100644 index 912156fbc29..00000000000 --- a/qa/qa/scenario/test/integration/oauth.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module QA - module Scenario - module Test - module Integration - class OAuth < Test::Instance::All - tags :oauth - end - end - end - end -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 deleted file mode 100644 index dea85f68be2..00000000000 --- a/qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -module QA - # This test is skipped instead of quarantine because continuously running - # this test may cause the user to hit GitHub's rate limits thus blocking the user. - # Related issue: https://gitlab.com/gitlab-org/gitlab/issues/196517 - context 'Manage', :orchestrated, :oauth, :skip do - describe 'OAuth login' do - it 'User logs in to GitLab with GitHub OAuth' do - Runtime::Browser.visit(:gitlab, Page::Main::Login) - - Page::Main::Login.perform(&:sign_in_with_github) - Vendor::Github::Page::Login.perform(&:login) - - expect(page).to have_content('Welcome to GitLab') - end - end - end -end diff --git a/qa/qa/vendor/github/page/base.rb b/qa/qa/vendor/github/page/base.rb deleted file mode 100644 index 3b96180afe9..00000000000 --- a/qa/qa/vendor/github/page/base.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -module QA - module Vendor - module Github - module Page - class Base - include Capybara::DSL - include Scenario::Actable - end - end - end - end -end diff --git a/qa/qa/vendor/github/page/login.rb b/qa/qa/vendor/github/page/login.rb deleted file mode 100644 index 4675e33b514..00000000000 --- a/qa/qa/vendor/github/page/login.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -require 'capybara/dsl' -require 'benchmark' - -module QA - module Vendor - module Github - module Page - class Login < Page::Base - def login - fill_in 'login', with: QA::Runtime::Env.github_username - fill_in 'password', with: QA::Runtime::Env.github_password - click_on 'Sign in' - - Support::Retrier.retry_until(raise_on_failure: true, sleep_interval: 35) do - fresh_otp = nil - - time = Benchmark.realtime do - fresh_otp = OnePassword::CLI.instance.fresh_otp - end - - QA::Runtime::Logger.info("Returned fresh_otp: #{fresh_otp} in #{time} seconds") - - fill_in 'otp', with: fresh_otp - - click_on 'Verify' - - !has_text?('Two-factor authentication failed', wait: 1.0) - end - - click_on 'Authorize gitlab-qa' if has_button?('Authorize gitlab-qa') - end - end - end - end - end -end diff --git a/qa/qa/vendor/one_password/cli.rb b/qa/qa/vendor/one_password/cli.rb deleted file mode 100644 index cf8b7f8a4f9..00000000000 --- a/qa/qa/vendor/one_password/cli.rb +++ /dev/null @@ -1,63 +0,0 @@ -# frozen_string_literal: true - -require 'benchmark' - -module QA - module Vendor - module OnePassword - class CLI - include Singleton - - 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 fresh_otp - otps = [] - - # Fetches a fresh OTP and returns it only after op provides the same OTP twice - # An OTP is valid for 30 seconds so 70 attempts with 0.5 interval would ensure we complete 1 cycle - Support::Retrier.retry_until(max_attempts: 70, sleep_interval: 0.5) do - otps << fetch_otp - otps.size >= 3 && otps[-1] == otps[-2] && otps[-1] != otps[-3] - end - - otps.last - end - - private - - def fetch_otp - result = nil - - time = Benchmark.realtime do - result = `#{op_path} get totp #{@github_uuid} --session=#{session_token}`.to_i - end - - QA::Runtime::Logger.info("Fetched OTP: #{result} in: #{time} seconds") - - result - end - - # OP session tokens are valid for 30 minutes. We are caching the session token here and this is fine currently - # as we just have one test that is not expected to go over 30 minutes. - # But note that if we add more tests that use this class, we might need to add a mechanism to invalidate - # the cache after 30 minutes or if the session_token is rejected by op CLI. - def session_token - @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 differdeleted file mode 100755 index be7a3721b14..00000000000 --- a/qa/qa/vendor/one_password/darwin/op +++ /dev/null diff --git a/qa/qa/vendor/one_password/linux/op b/qa/qa/vendor/one_password/linux/op Binary files differdeleted file mode 100755 index 47e79d7c599..00000000000 --- a/qa/qa/vendor/one_password/linux/op +++ /dev/null diff --git a/qa/spec/page/base_spec.rb b/qa/spec/page/base_spec.rb index 2d13889d26d..f6080bcad49 100644 --- a/qa/spec/page/base_spec.rb +++ b/qa/spec/page/base_spec.rb @@ -23,12 +23,12 @@ describe QA::Page::Base do it 'makes it possible to define page views' do expect(subject.views.size).to eq 2 - expect(subject.views).to all(be_an_instance_of QA::Page::View) + expect(subject.views).to all(be_an_instance_of(QA::Page::View)) end it 'populates views objects with data about elements' do expect(subject.elements.size).to eq 3 - expect(subject.elements).to all(be_an_instance_of QA::Page::Element) + expect(subject.elements).to all(be_an_instance_of(QA::Page::Element)) expect(subject.elements.map(&:name)) .to eq [:something, :something_else, :another_element] end diff --git a/qa/spec/scenario/test/integration/oauth_spec.rb b/qa/spec/scenario/test/integration/oauth_spec.rb deleted file mode 100644 index ab7ea905a29..00000000000 --- a/qa/spec/scenario/test/integration/oauth_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -describe QA::Scenario::Test::Integration::OAuth do - describe '#perform' do - it_behaves_like 'a QA scenario class' do - let(:tags) { [:oauth] } - end - end -end |