diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-05 00:09:41 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-05 00:09:41 +0300 |
commit | b3cd77e90438a6c6e837dc27627d4c76f85ecd29 (patch) | |
tree | 52bbe45c9fd2aaceaca613bce04e7aab4a8aa07b /qa | |
parent | 9bbcab8301ed38576debcb6a7f07f99005ff805a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r-- | qa/Gemfile | 3 | ||||
-rw-r--r-- | qa/Gemfile.lock | 51 | ||||
-rw-r--r-- | qa/qa/page/profile/ssh_keys.rb | 18 | ||||
-rw-r--r-- | qa/qa/resource/ssh_key.rb | 10 | ||||
-rw-r--r-- | qa/qa/runtime/api/client.rb | 2 | ||||
-rw-r--r-- | qa/qa/specs/features/api/1_manage/rate_limits_spec.rb | 2 | ||||
-rw-r--r-- | qa/qa/specs/features/api/1_manage/users_spec.rb | 2 | ||||
-rw-r--r-- | qa/qa/specs/features/api/2_plan/closes_issue_via_pushing_a_commit_spec.rb | 2 | ||||
-rw-r--r-- | qa/qa/specs/features/api/3_create/repository/files_spec.rb | 1 | ||||
-rw-r--r-- | qa/qa/specs/features/api/3_create/repository/project_archive_compare_spec.rb | 1 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb | 2 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb | 2 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb | 10 | ||||
-rw-r--r-- | qa/qa/support/api.rb | 2 | ||||
-rw-r--r-- | qa/spec/resource/ssh_key_spec.rb | 21 | ||||
-rw-r--r-- | qa/spec/specs/helpers/quarantine_spec.rb | 8 |
16 files changed, 91 insertions, 46 deletions
diff --git a/qa/Gemfile b/qa/Gemfile index 458baffcd40..b11d5b1b682 100644 --- a/qa/Gemfile +++ b/qa/Gemfile @@ -7,7 +7,8 @@ gem 'capybara-screenshot', '~> 1.0.23' gem 'rake', '~> 12.3.0' gem 'rspec', '~> 3.7' gem 'selenium-webdriver', '~> 3.12' -gem 'airborne', '~> 0.2.13' +gem 'airborne', '~> 0.3.4' +gem 'rest-client', '~> 2.1.0' gem 'nokogiri', '~> 1.10.9' gem 'rspec-retry', '~> 0.6.1' gem 'rspec_junit_formatter', '~> 0.4.1' diff --git a/qa/Gemfile.lock b/qa/Gemfile.lock index 26c903599c9..6b996ca00f5 100644 --- a/qa/Gemfile.lock +++ b/qa/Gemfile.lock @@ -9,12 +9,12 @@ GEM zeitwerk (~> 2.2) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) - airborne (0.2.13) + airborne (0.3.4) activesupport rack - rack-test (~> 0.6, >= 0.6.2) - rest-client (>= 1.7.3, < 3.0) - rspec (~> 3.1) + rack-test (>= 1.1.0, < 2.0) + rest-client (>= 2.0.2, < 3.0) + rspec (~> 3.8) byebug (9.1.0) capybara (3.29.0) addressable @@ -34,11 +34,12 @@ GEM debase-ruby_core_source (>= 0.10.2) debase-ruby_core_source (0.10.6) diff-lcs (1.3) - domain_name (0.5.20170404) + domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) faker (1.9.3) i18n (>= 0.7) gitlab-qa (4.0.0) + http-accept (1.7.0) http-cookie (1.0.3) domain_name (~> 0.5) i18n (1.8.2) @@ -48,9 +49,9 @@ GEM launchy (2.4.3) addressable (~> 2.3) method_source (0.9.0) - mime-types (3.1) + mime-types (3.3.1) mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) + mime-types-data (3.2020.0425) mini_mime (1.0.2) mini_portile2 (2.4.0) minitest (5.14.0) @@ -67,30 +68,31 @@ GEM byebug (~> 9.1) pry (~> 0.10) public_suffix (4.0.1) - rack (2.0.7) - rack-test (0.8.3) + rack (2.2.2) + rack-test (1.1.0) rack (>= 1.0, < 3) rake (12.3.0) regexp_parser (1.6.0) - rest-client (2.0.2) + rest-client (2.1.0) + http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rspec (3.7.0) - rspec-core (~> 3.7.0) - rspec-expectations (~> 3.7.0) - rspec-mocks (~> 3.7.0) - rspec-core (3.7.1) - rspec-support (~> 3.7.0) - rspec-expectations (3.7.0) + rspec (3.9.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-core (3.9.2) + rspec-support (~> 3.9.3) + rspec-expectations (3.9.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) - rspec-mocks (3.7.0) + rspec-support (~> 3.9.0) + rspec-mocks (3.9.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) + rspec-support (~> 3.9.0) rspec-retry (0.6.1) rspec-core (> 3.3) - rspec-support (3.7.0) + rspec-support (3.9.3) rspec_junit_formatter (0.4.1) rspec-core (>= 2, < 4, != 2.12.0) ruby-debug-ide (0.7.2) @@ -101,11 +103,11 @@ GEM rubyzip (>= 1.2.2) thread_safe (0.3.6) timecop (0.9.1) - tzinfo (1.2.6) + tzinfo (1.2.7) thread_safe (~> 0.1) unf (0.1.4) unf_ext - unf_ext (0.0.7.4) + unf_ext (0.0.7.7) xpath (3.2.0) nokogiri (~> 1.8) zeitwerk (2.3.0) @@ -115,7 +117,7 @@ PLATFORMS DEPENDENCIES activesupport (~> 6.0.2.2) - airborne (~> 0.2.13) + airborne (~> 0.3.4) capybara (~> 3.29.0) capybara-screenshot (~> 1.0.23) debase (~> 0.2.4.1) @@ -126,6 +128,7 @@ DEPENDENCIES parallel_tests (~> 2.29) pry-byebug (~> 3.5.1) rake (~> 12.3.0) + rest-client (~> 2.1.0) rspec (~> 3.7) rspec-retry (~> 0.6.1) rspec_junit_formatter (~> 0.4.1) diff --git a/qa/qa/page/profile/ssh_keys.rb b/qa/qa/page/profile/ssh_keys.rb index 082202f91ca..810877e21ad 100644 --- a/qa/qa/page/profile/ssh_keys.rb +++ b/qa/qa/page/profile/ssh_keys.rb @@ -5,6 +5,7 @@ module QA module Profile class SSHKeys < Page::Base view 'app/views/profiles/keys/_form.html.haml' do + element :key_expiry_date_field element :key_title_field element :key_public_key_field element :add_key_button @@ -19,17 +20,26 @@ module QA end def add_key(public_key, title) - fill_element :key_public_key_field, public_key - fill_element :key_title_field, title + fill_element(:key_public_key_field, public_key) + fill_element(:key_title_field, title) + # Expire in 2 days just in case the key is created just before midnight + fill_expiry_date(Date.today + 2) - click_element :add_key_button + click_element(:add_key_button) + end + + def fill_expiry_date(date) + date = date.strftime('%m/%d/%Y') if date.is_a?(Date) + Date.strptime(date, '%m/%d/%Y') rescue ArgumentError raise "Expiry date must be in mm/dd/yyyy format" + + fill_element(:key_expiry_date_field, date) end def remove_key(title) click_link(title) accept_alert do - click_element :delete_key_button + click_element(:delete_key_button) end end diff --git a/qa/qa/resource/ssh_key.rb b/qa/qa/resource/ssh_key.rb index 3e130aef9e4..b948bf3969b 100644 --- a/qa/qa/resource/ssh_key.rb +++ b/qa/qa/resource/ssh_key.rb @@ -5,12 +5,16 @@ module QA class SSHKey < Base extend Forwardable - attr_accessor :title + attr_reader :title attribute :id def_delegators :key, :private_key, :public_key, :md5_fingerprint + def initialize + self.title = Time.now.to_f + end + def key @key ||= Runtime::Key::RSA.new end @@ -28,6 +32,10 @@ module QA api_post end + def title=(title) + @title = "E2E test key: #{title}" + end + def api_delete QA::Runtime::Logger.debug("Deleting SSH key with title '#{title}' and fingerprint '#{md5_fingerprint}'") diff --git a/qa/qa/runtime/api/client.rb b/qa/qa/runtime/api/client.rb index b9a3c9184aa..d29571df981 100644 --- a/qa/qa/runtime/api/client.rb +++ b/qa/qa/runtime/api/client.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'airborne' - module QA module Runtime module API diff --git a/qa/qa/specs/features/api/1_manage/rate_limits_spec.rb b/qa/qa/specs/features/api/1_manage/rate_limits_spec.rb index 819739ac535..1bf435014af 100644 --- a/qa/qa/specs/features/api/1_manage/rate_limits_spec.rb +++ b/qa/qa/specs/features/api/1_manage/rate_limits_spec.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'airborne' + module QA context 'Manage with IP rate limits', :requires_admin do describe 'Users API' do diff --git a/qa/qa/specs/features/api/1_manage/users_spec.rb b/qa/qa/specs/features/api/1_manage/users_spec.rb index ba1ba204d24..fbc26e81b69 100644 --- a/qa/qa/specs/features/api/1_manage/users_spec.rb +++ b/qa/qa/specs/features/api/1_manage/users_spec.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'airborne' + module QA context 'Manage' do describe 'Users API' do diff --git a/qa/qa/specs/features/api/2_plan/closes_issue_via_pushing_a_commit_spec.rb b/qa/qa/specs/features/api/2_plan/closes_issue_via_pushing_a_commit_spec.rb index f14fcc5afce..58d716f759e 100644 --- a/qa/qa/specs/features/api/2_plan/closes_issue_via_pushing_a_commit_spec.rb +++ b/qa/qa/specs/features/api/2_plan/closes_issue_via_pushing_a_commit_spec.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'airborne' + module QA context 'Plan' do include Support::Api diff --git a/qa/qa/specs/features/api/3_create/repository/files_spec.rb b/qa/qa/specs/features/api/3_create/repository/files_spec.rb index dc471128dae..92858ba4107 100644 --- a/qa/qa/specs/features/api/3_create/repository/files_spec.rb +++ b/qa/qa/specs/features/api/3_create/repository/files_spec.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require 'airborne' require 'securerandom' module QA diff --git a/qa/qa/specs/features/api/3_create/repository/project_archive_compare_spec.rb b/qa/qa/specs/features/api/3_create/repository/project_archive_compare_spec.rb index 5ba434a7781..3ad56e21ad4 100644 --- a/qa/qa/specs/features/api/3_create/repository/project_archive_compare_spec.rb +++ b/qa/qa/specs/features/api/3_create/repository/project_archive_compare_spec.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require 'airborne' require 'securerandom' require 'digest' diff --git a/qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb index 5f7a6981f23..0a577aa07f8 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb @@ -3,6 +3,8 @@ module QA context 'Plan', :orchestrated, :smtp do describe 'Email Notification' do + include Support::Api + let(:user) do Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb index 25866e12185..68bbc1719fc 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb @@ -12,7 +12,7 @@ module QA resource.title = key_title end - expect(page).to have_content("Title: #{key_title}") + expect(page).to have_content(key.title) expect(page).to have_content(key.md5_fingerprint) Page::Main::Menu.perform(&:click_settings_link) diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb index 9bc4dcbca2a..9b504ad76b4 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb @@ -3,6 +3,8 @@ module QA context 'Create', :requires_admin do describe 'push after setting the file size limit via admin/application_settings' do + include Support::Api + before(:context) do @project = Resource::Project.fabricate_via_api! do |p| p.name = 'project-test-push-limit' @@ -39,12 +41,10 @@ module QA def set_file_size_limit(limit) request = Runtime::API::Request.new(@api_client, '/application/settings') - put request.url, receive_max_input_size: limit + response = put request.url, receive_max_input_size: limit - expect_status(200) - expect(json_body).to match( - a_hash_including(receive_max_input_size: limit) - ) + expect(response.code).to eq(200) + expect(parse_body(response)[:receive_max_input_size]).to eq(limit) end def push_new_file(file_name, wait_for_push: true) diff --git a/qa/qa/support/api.rb b/qa/qa/support/api.rb index d39b4353191..f5e4d4e294b 100644 --- a/qa/qa/support/api.rb +++ b/qa/qa/support/api.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'rest-client' + module QA module Support module Api diff --git a/qa/spec/resource/ssh_key_spec.rb b/qa/spec/resource/ssh_key_spec.rb new file mode 100644 index 00000000000..b2b5ec070e1 --- /dev/null +++ b/qa/spec/resource/ssh_key_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +describe QA::Resource::SSHKey do + describe '#key' do + it 'generates a default key' do + expect(subject.key).to be_a(QA::Runtime::Key::RSA) + end + end + + describe '#title' do + it 'generates a default title' do + expect(subject.title).to match(/E2E test key: \d+/) + end + + it 'is possible to set the title' do + subject.title = 'I am in a title' + + expect(subject.title).to eq('E2E test key: I am in a title') + end + end +end diff --git a/qa/spec/specs/helpers/quarantine_spec.rb b/qa/spec/specs/helpers/quarantine_spec.rb index d5c6820f0a9..1f09c3f73ac 100644 --- a/qa/spec/specs/helpers/quarantine_spec.rb +++ b/qa/spec/specs/helpers/quarantine_spec.rb @@ -31,14 +31,6 @@ RSpec.configure do |c| config.color_mode = :off - # Load airborne again to avoid "undefined method `match_expected_default?'" errors - # that happen because a hook calls a method added via a custom RSpec setting - # that is removed when the RSpec configuration is sandboxed. - # If this needs to be changed (e.g., to load other libraries as well), see - # this discussion for alternative solutions: - # https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/25223#note_143392053 - load 'airborne.rb' - ex.run end end |