Commit 932931f3 authored by Andrejs Cunskis's avatar Andrejs Cunskis Committed by Dan Davison

E2E: Automatically attach testcases and issues to allure report

parent caa25bd0
...@@ -44,3 +44,4 @@ This is a partial list of the [RSpec metadata](https://relishapp.com/rspec/rspec ...@@ -44,3 +44,4 @@ This is a partial list of the [RSpec metadata](https://relishapp.com/rspec/rspec
| `:smtp` | The test requires a GitLab instance to be configured to use an SMTP server. Tests SMTP notification email delivery from GitLab by using MailHog. | | `:smtp` | The test requires a GitLab instance to be configured to use an SMTP server. Tests SMTP notification email delivery from GitLab by using MailHog. |
| `:testcase` | The link to the test case issue in the [Quality Test Cases project](https://gitlab.com/gitlab-org/quality/testcases/). | | `:testcase` | The link to the test case issue in the [Quality Test Cases project](https://gitlab.com/gitlab-org/quality/testcases/). |
| `:transient` | The test tests transient bugs. It is excluded by default. | | `:transient` | The test tests transient bugs. It is excluded by default. |
| `:issue`, `:issue_${num}` | Optional links to issues which might be related to the spec. Helps keeping track of related issues and can also be used by tools that create test reports. Currently added automatically to `Allure` test report. Multiple tags can be used by adding optional number postfix like `issue_1`, `issue_2` etc. |
...@@ -4,7 +4,7 @@ source 'https://rubygems.org' ...@@ -4,7 +4,7 @@ source 'https://rubygems.org'
gem 'gitlab-qa', require: 'gitlab/qa' gem 'gitlab-qa', require: 'gitlab/qa'
gem 'activesupport', '~> 6.1.3.2' # This should stay in sync with the root's Gemfile gem 'activesupport', '~> 6.1.3.2' # This should stay in sync with the root's Gemfile
gem 'allure-rspec', '~> 2.14.1' gem 'allure-rspec', '~> 2.14.5'
gem 'capybara', '~> 3.35.0' gem 'capybara', '~> 3.35.0'
gem 'capybara-screenshot', '~> 1.0.23' gem 'capybara-screenshot', '~> 1.0.23'
gem 'rake', '~> 12.3.3' gem 'rake', '~> 12.3.3'
......
...@@ -19,10 +19,10 @@ GEM ...@@ -19,10 +19,10 @@ GEM
rack-test (>= 1.1.0, < 2.0) rack-test (>= 1.1.0, < 2.0)
rest-client (>= 2.0.2, < 3.0) rest-client (>= 2.0.2, < 3.0)
rspec (~> 3.8) rspec (~> 3.8)
allure-rspec (2.14.2) allure-rspec (2.14.5)
allure-ruby-commons (= 2.14.2) allure-ruby-commons (= 2.14.5)
rspec-core (>= 3.8, < 4) rspec-core (>= 3.8, < 4)
allure-ruby-commons (2.14.2) allure-ruby-commons (2.14.5)
mime-types (>= 3.3, < 4) mime-types (>= 3.3, < 4)
oj (>= 3.10, < 4) oj (>= 3.10, < 4)
require_all (>= 2, < 4) require_all (>= 2, < 4)
...@@ -111,7 +111,7 @@ GEM ...@@ -111,7 +111,7 @@ GEM
octokit (4.21.0) octokit (4.21.0)
faraday (>= 0.9) faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3) sawyer (~> 0.8.0, >= 0.5.3)
oj (3.12.1) oj (3.13.2)
parallel (1.19.2) parallel (1.19.2)
parallel_tests (2.29.0) parallel_tests (2.29.0)
parallel parallel
...@@ -212,7 +212,7 @@ PLATFORMS ...@@ -212,7 +212,7 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
activesupport (~> 6.1.3.2) activesupport (~> 6.1.3.2)
airborne (~> 0.3.4) airborne (~> 0.3.4)
allure-rspec (~> 2.14.1) allure-rspec (~> 2.14.5)
capybara (~> 3.35.0) capybara (~> 3.35.0)
capybara-screenshot (~> 1.0.23) capybara-screenshot (~> 1.0.23)
chemlab (~> 0.7) chemlab (~> 0.7)
......
...@@ -29,6 +29,13 @@ module QA ...@@ -29,6 +29,13 @@ module QA
AllureRspec.configure do |config| AllureRspec.configure do |config|
config.results_directory = 'tmp/allure-results' config.results_directory = 'tmp/allure-results'
config.clean_results_directory = true config.clean_results_directory = true
# automatically attach links to testcases and issues
config.tms_tag = :testcase
config.link_tms_pattern = '{}'
config.issue_tag = :issue
config.link_issue_pattern = '{}'
config.environment_properties = environment_info if Env.running_in_ci? config.environment_properties = environment_info if Env.running_in_ci?
# Set custom environment name to separate same specs executed on different environments # Set custom environment name to separate same specs executed on different environments
......
...@@ -71,9 +71,6 @@ module QA ...@@ -71,9 +71,6 @@ module QA
end end
end end
# Non blocking issues:
# https://gitlab.com/gitlab-org/gitlab/-/issues/331252
# https://gitlab.com/gitlab-org/gitlab/-/issues/333678 <- can cause 500 when creating user and group back to back
it( it(
'imports group with subgroups and labels', 'imports group with subgroups and labels',
testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1871' testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1871'
......
...@@ -54,10 +54,14 @@ module QA ...@@ -54,10 +54,14 @@ module QA
end end
end end
# Non blocking issues: it(
# https://gitlab.com/gitlab-org/gitlab/-/issues/331252 'imports group from UI',
# https://gitlab.com/gitlab-org/gitlab/-/issues/333678 <- can cause 500 when creating user and group back to back testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1785',
it 'imports group from UI', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1785' do issue_1: 'https://gitlab.com/gitlab-org/gitlab/-/issues/331252',
issue_2: 'https://gitlab.com/gitlab-org/gitlab/-/issues/333678',
# mostly impacts testing as it makes small groups import slower
issue_3: 'https://gitlab.com/gitlab-org/gitlab/-/issues/332351'
) do
Page::Group::BulkImport.perform do |import_page| Page::Group::BulkImport.perform do |import_page|
import_page.import_group(imported_group.path, imported_group.sandbox.path) import_page.import_group(imported_group.path, imported_group.sandbox.path)
......
...@@ -17,9 +17,6 @@ module QA ...@@ -17,9 +17,6 @@ module QA
def example_started(example_notification) def example_started(example_notification)
example = example_notification.example example = example_notification.example
testcase = example.metadata[:testcase]
example.tms('Testcase', testcase) if testcase
quarantine_issue = example.metadata.dig(:quarantine, :issue) quarantine_issue = example.metadata.dig(:quarantine, :issue)
example.issue('Quarantine issue', quarantine_issue) if quarantine_issue example.issue('Quarantine issue', quarantine_issue) if quarantine_issue
......
...@@ -34,7 +34,6 @@ describe QA::Support::AllureMetadataFormatter do ...@@ -34,7 +34,6 @@ describe QA::Support::AllureMetadataFormatter do
formatter.example_started(rspec_example_notification) formatter.example_started(rspec_example_notification)
aggregate_failures do aggregate_failures do
expect(rspec_example).to have_received(:tms).with('Testcase', 'testcase')
expect(rspec_example).to have_received(:issue).with('Quarantine issue', 'issue') expect(rspec_example).to have_received(:issue).with('Quarantine issue', 'issue')
expect(rspec_example).to have_received(:add_link).with(name: "Job(#{ci_job})", url: ci_job_url) expect(rspec_example).to have_received(:add_link).with(name: "Job(#{ci_job})", url: ci_job_url)
expect(rspec_example).to have_received(:issue).with( expect(rspec_example).to have_received(:issue).with(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment