diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /qa/qa/resource | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) | |
download | gitlab-ce-85dc423f7090da0a52c73eb66faf22ddb20efff9.tar.gz |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'qa/qa/resource')
-rw-r--r-- | qa/qa/resource/api_fabricator.rb | 4 | ||||
-rw-r--r-- | qa/qa/resource/fork.rb | 4 | ||||
-rw-r--r-- | qa/qa/resource/group.rb | 1 | ||||
-rw-r--r-- | qa/qa/resource/project.rb | 7 | ||||
-rw-r--r-- | qa/qa/resource/project_imported_from_github.rb | 21 | ||||
-rw-r--r-- | qa/qa/resource/settings/hashed_storage.rb | 26 | ||||
-rw-r--r-- | qa/qa/resource/user.rb | 2 |
7 files changed, 22 insertions, 43 deletions
diff --git a/qa/qa/resource/api_fabricator.rb b/qa/qa/resource/api_fabricator.rb index babdfc96265..d0cbab70983 100644 --- a/qa/qa/resource/api_fabricator.rb +++ b/qa/qa/resource/api_fabricator.rb @@ -18,7 +18,7 @@ module QA attr_reader :api_resource, :api_response attr_writer :api_client - attr_accessor :user + attr_accessor :api_user def api_support? respond_to?(:api_get_path) && @@ -120,7 +120,7 @@ module QA def api_client @api_client ||= begin - Runtime::API::Client.new(:gitlab, is_new_session: !current_url.start_with?('http'), user: user) + Runtime::API::Client.new(:gitlab, is_new_session: !current_url.start_with?('http'), user: api_user) end end diff --git a/qa/qa/resource/fork.rb b/qa/qa/resource/fork.rb index 854dd92e89c..d0aaaae6a11 100644 --- a/qa/qa/resource/fork.rb +++ b/qa/qa/resource/fork.rb @@ -56,6 +56,8 @@ module QA def fabricate_via_api! populate(:upstream, :user) + @api_client = Runtime::API::Client.new(:gitlab, is_new_session: false, user: user) + Runtime::Logger.debug("Forking project #{upstream.name} to namespace #{user.username}...") super wait_until_forked @@ -73,7 +75,7 @@ module QA def api_post_body { - namespace: user.username, + namespace_path: user.username, name: name, path: name } diff --git a/qa/qa/resource/group.rb b/qa/qa/resource/group.rb index ed9acb6edb7..1cb33a7c71c 100644 --- a/qa/qa/resource/group.rb +++ b/qa/qa/resource/group.rb @@ -9,7 +9,6 @@ module QA attribute :sandbox do Sandbox.fabricate_via_api! do |sandbox| - sandbox.user = user sandbox.api_client = api_client end end diff --git a/qa/qa/resource/project.rb b/qa/qa/resource/project.rb index eba8ada50ab..0025ebb2fd5 100644 --- a/qa/qa/resource/project.rb +++ b/qa/qa/resource/project.rb @@ -12,7 +12,10 @@ module QA attr_accessor :repository_storage # requires admin access attr_writer :initialize_with_readme attr_writer :auto_devops_enabled + attr_writer :github_personal_access_token + attr_writer :github_repository_path + attribute :default_branch attribute :id attribute :name attribute :add_name_uuid @@ -21,6 +24,7 @@ module QA attribute :runners_token attribute :visibility attribute :template_name + attribute :import attribute :group do Group.fabricate! @@ -56,6 +60,7 @@ module QA @auto_devops_enabled = false @visibility = :public @template_name = nil + @import = false self.name = "the_awesome_project" end @@ -65,6 +70,8 @@ module QA end def fabricate! + return if @import + unless @standalone group.visit! Page::Group::Show.perform(&:go_to_new_project) diff --git a/qa/qa/resource/project_imported_from_github.rb b/qa/qa/resource/project_imported_from_github.rb index e5ecaeae139..df28d63b113 100644 --- a/qa/qa/resource/project_imported_from_github.rb +++ b/qa/qa/resource/project_imported_from_github.rb @@ -4,28 +4,25 @@ require 'securerandom' module QA module Resource - class ProjectImportedFromGithub < Base - attr_accessor :name - attr_writer :personal_access_token, :github_repository_path - - attribute :group do - Group.fabricate! - end - + class ProjectImportedFromGithub < Resource::Project def fabricate! + super + group.visit! Page::Group::Show.perform(&:go_to_new_project) - - Page::Project::New.perform(&:click_import_project) - + go_to_import_tab Page::Project::New.perform(&:click_github_link) Page::Project::Import::Github.perform do |import_page| - import_page.add_personal_access_token(@personal_access_token) + import_page.add_personal_access_token(@github_personal_access_token) import_page.import!(@github_repository_path, @name) end end + + def go_to_import_tab + Page::Project::New.perform(&:click_import_project) + end end end end diff --git a/qa/qa/resource/settings/hashed_storage.rb b/qa/qa/resource/settings/hashed_storage.rb deleted file mode 100644 index 40c06768ffe..00000000000 --- a/qa/qa/resource/settings/hashed_storage.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -module QA - module Resource - module Settings - class HashedStorage < Base - def fabricate!(*traits) - raise ArgumentError unless traits.include?(:enabled) - - Page::Main::Login.perform(&:sign_in_using_credentials) - Page::Main::Menu.perform(&:go_to_admin_area) - Page::Admin::Menu.perform(&:go_to_repository_settings) - - Page::Admin::Settings::Repository.perform do |setting| - setting.expand_repository_storage do |page| - page.enable_hashed_storage - page.save_settings - end - end - - QA::Page::Main::Menu.perform(&:sign_out) - end - end - end - end -end diff --git a/qa/qa/resource/user.rb b/qa/qa/resource/user.rb index 462da743318..9768fc154a7 100644 --- a/qa/qa/resource/user.rb +++ b/qa/qa/resource/user.rb @@ -148,7 +148,7 @@ module QA end def fetching_own_data? - user&.username == username || Runtime::User.username == username + api_user&.username == username || Runtime::User.username == username end end end |