summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-05 09:12:23 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-05 09:12:23 +0000
commite0c90aab261896abcf93f3806d965790dbd03408 (patch)
tree72524feb8405807c5122cf788976fa6fd09fae3f /qa
parent7e254c1556243adc62436a0b929fbeff7e8daf52 (diff)
downloadgitlab-ce-e0c90aab261896abcf93f3806d965790dbd03408.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/Gemfile2
-rw-r--r--qa/Gemfile.lock10
-rw-r--r--qa/qa/page/component/snippet.rb11
-rw-r--r--qa/qa/resource/project_snippet.rb2
-rw-r--r--qa/qa/resource/snippet.rb6
-rw-r--r--qa/qa/runtime/allure_report.rb32
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb20
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb24
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb16
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb16
-rw-r--r--qa/spec/specs/allure_report_spec.rb6
11 files changed, 98 insertions, 47 deletions
diff --git a/qa/Gemfile b/qa/Gemfile
index aae3c81bd83..493e7de1e76 100644
--- a/qa/Gemfile
+++ b/qa/Gemfile
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
gem 'gitlab-qa', require: 'gitlab/qa'
gem 'activesupport', '~> 6.1.3.2' # This should stay in sync with the root's Gemfile
-gem 'allure-rspec', '~> 2.14.5'
+gem 'allure-rspec', '~> 2.15.0'
gem 'capybara', '~> 3.35.0'
gem 'capybara-screenshot', '~> 1.0.23'
gem 'rake', '~> 12.3.3'
diff --git a/qa/Gemfile.lock b/qa/Gemfile.lock
index f105274b3ac..ede0fbe00de 100644
--- a/qa/Gemfile.lock
+++ b/qa/Gemfile.lock
@@ -19,10 +19,10 @@ GEM
rack-test (>= 1.1.0, < 2.0)
rest-client (>= 2.0.2, < 3.0)
rspec (~> 3.8)
- allure-rspec (2.14.5)
- allure-ruby-commons (= 2.14.5)
+ allure-rspec (2.15.0)
+ allure-ruby-commons (= 2.15.0)
rspec-core (>= 3.8, < 4)
- allure-ruby-commons (2.14.5)
+ allure-ruby-commons (2.15.0)
mime-types (>= 3.3, < 4)
oj (>= 3.10, < 4)
require_all (>= 2, < 4)
@@ -136,7 +136,7 @@ GEM
octokit (4.21.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
- oj (3.13.2)
+ oj (3.13.8)
parallel (1.19.2)
parallel_tests (2.29.0)
parallel
@@ -241,7 +241,7 @@ PLATFORMS
DEPENDENCIES
activesupport (~> 6.1.3.2)
airborne (~> 0.3.4)
- allure-rspec (~> 2.14.5)
+ allure-rspec (~> 2.15.0)
capybara (~> 3.35.0)
capybara-screenshot (~> 1.0.23)
chemlab (~> 0.9)
diff --git a/qa/qa/page/component/snippet.rb b/qa/qa/page/component/snippet.rb
index 73f41e0aa51..ad264bd6d56 100644
--- a/qa/qa/page/component/snippet.rb
+++ b/qa/qa/page/component/snippet.rb
@@ -79,6 +79,11 @@ module QA
element :default_actions_container
element :copy_contents_button
end
+
+ base.view 'app/views/layouts/nav/_breadcrumbs.html.haml' do
+ element :breadcrumb_links_content
+ element :breadcrumb_sub_title_content
+ end
end
def has_snippet_title?(snippet_title)
@@ -249,6 +254,12 @@ module QA
raise ElementNotFound, "Comment did not appear as expected"
end
end
+
+ def snippet_id
+ within_element(:breadcrumb_links_content) do
+ find_element(:breadcrumb_sub_title_content).text.delete_prefix('$')
+ end
+ end
end
end
end
diff --git a/qa/qa/resource/project_snippet.rb b/qa/qa/resource/project_snippet.rb
index 9ab4612d117..9a22966efdb 100644
--- a/qa/qa/resource/project_snippet.rb
+++ b/qa/qa/resource/project_snippet.rb
@@ -30,6 +30,8 @@ module QA
new_snippet.click_create_snippet_button
end
+
+ @id = Page::Project::Snippet::Show.perform(&:snippet_id)
end
def api_get_path
diff --git a/qa/qa/resource/snippet.rb b/qa/qa/resource/snippet.rb
index a94ae02b8fd..a79e8c7de6b 100644
--- a/qa/qa/resource/snippet.rb
+++ b/qa/qa/resource/snippet.rb
@@ -22,6 +22,10 @@ module QA
end
def fabricate!
+ Page::Main::Menu.perform do |menu|
+ menu.go_to_menu_dropdown_option(:snippets_link)
+ end
+
Page::Dashboard::Snippet::Index.perform(&:go_to_new_snippet_page)
Page::Dashboard::Snippet::New.perform do |new_page|
@@ -38,6 +42,8 @@ module QA
end
new_page.click_create_snippet_button
end
+
+ @id = Page::Dashboard::Snippet::Show.perform(&:snippet_id)
end
def fabricate_via_api!
diff --git a/qa/qa/runtime/allure_report.rb b/qa/qa/runtime/allure_report.rb
index 5b0456dc607..5f628050f3b 100644
--- a/qa/qa/runtime/allure_report.rb
+++ b/qa/qa/runtime/allure_report.rb
@@ -5,6 +5,8 @@ require 'active_support/core_ext/enumerable'
module QA
module Runtime
class AllureReport
+ extend QA::Support::API
+
class << self
# Configure allure reports
#
@@ -77,27 +79,21 @@ module QA
end
end
- # Custom environment info hash
+ # Gitlab version and revision information
#
# @return [Hash]
def environment_info
- %w[
- CI_COMMIT_SHA
- CI_MERGE_REQUEST_SOURCE_BRANCH_SHA
- CI_MERGE_REQUEST_IID
- TOP_UPSTREAM_SOURCE_SHA
- TOP_UPSTREAM_MERGE_REQUEST_IID
- DEPLOY_VERSION
- GITLAB_VERSION
- GITLAB_SHELL_VERSION
- GITLAB_ELASTICSEARCH_INDEXER_VERSION
- GITLAB_KAS_VERSION
- GITLAB_WORKHORSE_VERSION
- GITLAB_PAGES_VERSION
- GITALY_SERVER_VERSION
- QA_IMAGE
- QA_BROWSER
- ].index_with { |val| ENV[val] }.compact_blank
+ lambda do
+ return {} unless Env.admin_personal_access_token || Env.personal_access_token
+
+ client = Env.admin_personal_access_token ? API::Client.as_admin : API::Client.new
+ response = get(API::Request.new(client, '/version').url)
+
+ JSON.parse(response.body, symbolize_names: true)
+ rescue StandardError, ArgumentError => e
+ Logger.error("Failed to attach version info to allure report: #{e}")
+ {}
+ end
end
end
end
diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb
index 1080d8ab849..300fd6a1be2 100644
--- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb
+++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb
@@ -3,13 +3,7 @@
module QA
RSpec.describe 'Create' do # convert back to a smoke test once proved to be stable
describe 'Personal snippet creation' do
- it 'user creates a personal snippet', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1357' do
- Flow::Login.sign_in
-
- Page::Main::Menu.perform do |menu|
- menu.go_to_menu_dropdown_option(:snippets_link)
- end
-
+ let(:snippet) do
Resource::Snippet.fabricate_via_browser_ui! do |snippet|
snippet.title = 'Snippet title'
snippet.description = 'Snippet description'
@@ -17,6 +11,18 @@ module QA
snippet.file_name = 'ruby_file.rb'
snippet.file_content = 'File.read("test.txt").split(/\n/)'
end
+ end
+
+ before do
+ Flow::Login.sign_in
+ end
+
+ after do
+ snippet.remove_via_api!
+ end
+
+ it 'user creates a personal snippet', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1357' do
+ snippet.visit!
Page::Dashboard::Snippet::Show.perform do |snippet|
expect(snippet).to have_snippet_title('Snippet title')
diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb
index 525fc5799a9..a32ee472150 100644
--- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb
+++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb
@@ -3,17 +3,11 @@
module QA
RSpec.describe 'Create' do
describe 'Multiple file snippet' do
- it 'creates a personal snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1654' do
- Flow::Login.sign_in
-
- Page::Main::Menu.perform do |menu|
- menu.go_to_menu_dropdown_option(:snippets_link)
- end
-
+ let(:snippet) do
Resource::Snippet.fabricate_via_browser_ui! do |snippet|
snippet.title = 'Personal snippet with multiple files'
snippet.description = 'Snippet description'
- snippet.visibility = 'Public'
+ snippet.visibility = 'Private'
snippet.file_name = 'First file name'
snippet.file_content = 'First file content'
@@ -22,11 +16,23 @@ module QA
files.append(name: 'Third file name', content: 'Third file content')
end
end
+ end
+
+ before do
+ Flow::Login.sign_in
+ end
+
+ after do
+ snippet.remove_via_api!
+ end
+
+ it 'creates a personal snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1654' do
+ snippet.visit!
Page::Dashboard::Snippet::Show.perform do |snippet|
expect(snippet).to have_snippet_title('Personal snippet with multiple files')
expect(snippet).to have_snippet_description('Snippet description')
- expect(snippet).to have_visibility_type(/public/i)
+ expect(snippet).to have_visibility_type(/private/i)
expect(snippet).to have_file_name('First file name', 1)
expect(snippet).to have_file_content('First file content', 1)
expect(snippet).to have_file_name('Second file name', 2)
diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb
index e4c2488e8df..1967273ca17 100644
--- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb
+++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb
@@ -3,9 +3,7 @@
module QA
RSpec.describe 'Create' do # to be converted to a smoke test once proved to be stable
describe 'Project snippet creation' do
- it 'user creates a project snippet', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1358' do
- Flow::Login.sign_in
-
+ let(:snippet) do
Resource::ProjectSnippet.fabricate_via_browser_ui! do |snippet|
snippet.title = 'Project snippet'
snippet.description = ' '
@@ -13,6 +11,18 @@ module QA
snippet.file_name = 'markdown_file.md'
snippet.file_content = "### Snippet heading\n\n[Gitlab link](https://gitlab.com/)"
end
+ end
+
+ before do
+ Flow::Login.sign_in
+ end
+
+ after do
+ snippet.remove_via_api!
+ end
+
+ it 'user creates a project snippet', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1358' do
+ snippet.visit!
Page::Dashboard::Snippet::Show.perform do |snippet|
expect(snippet).to have_snippet_title('Project snippet')
diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb
index 3298989cc12..ae71be26a38 100644
--- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb
+++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb
@@ -3,9 +3,7 @@
module QA
RSpec.describe 'Create' do
describe 'Multiple file snippet' do
- it 'creates a project snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1648' do
- Flow::Login.sign_in
-
+ let(:snippet) do
Resource::ProjectSnippet.fabricate_via_browser_ui! do |snippet|
snippet.title = 'Project snippet with multiple files'
snippet.description = 'Snippet description'
@@ -20,6 +18,18 @@ module QA
end
end
end
+ end
+
+ before do
+ Flow::Login.sign_in
+ end
+
+ after do
+ snippet.remove_via_api!
+ end
+
+ it 'creates a project snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1648' do
+ snippet.visit!
Page::Dashboard::Snippet::Show.perform do |snippet|
aggregate_failures 'file content verification' do
diff --git a/qa/spec/specs/allure_report_spec.rb b/qa/spec/specs/allure_report_spec.rb
index 34116ca6cbd..03bf77039cc 100644
--- a/qa/spec/specs/allure_report_spec.rb
+++ b/qa/spec/specs/allure_report_spec.rb
@@ -45,14 +45,18 @@ describe QA::Runtime::AllureReport do
let(:png_file) { 'png-file' }
let(:html_file) { 'html-file' }
let(:ci_job) { 'ee:relative 5' }
+ let(:versions) { { version: '14', revision: '6ced31db947' } }
before do
stub_env('CI', 'true')
stub_env('CI_JOB_NAME', ci_job)
+ stub_env('GITLAB_QA_ADMIN_ACCESS_TOKEN', 'token')
allow(Allure).to receive(:add_attachment)
allow(File).to receive(:open).with(png_path) { png_file }
allow(File).to receive(:open).with(html_path) { html_file }
+ allow(RestClient::Request).to receive(:execute) { double('response', code: 200, body: versions.to_json) }
+ allow(QA::Runtime::Scenario).to receive(:method_missing).with(:gitlab_address).and_return('gitlab.com')
described_class.configure!
end
@@ -61,7 +65,7 @@ describe QA::Runtime::AllureReport do
aggregate_failures do
expect(allure_config.results_directory).to eq('tmp/allure-results')
expect(allure_config.clean_results_directory).to eq(true)
- expect(allure_config.environment_properties).to be_a_kind_of(Hash)
+ expect(allure_config.environment_properties.call).to eq(versions)
expect(allure_config.environment).to eq('ee:relative')
end
end