Commit bf1ae705 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'sh-remove-junit-pipeline-screenshots-view-feature-flag' into 'master'

Remove the junit_pipeline_screenshots_view flag [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!61075
parents 37140d73 ec7020a0
...@@ -20,6 +20,6 @@ class TestCaseEntity < Grape::Entity ...@@ -20,6 +20,6 @@ class TestCaseEntity < Grape::Entity
alias_method :test_case, :object alias_method :test_case, :object
def can_read_screenshots? def can_read_screenshots?
Feature.enabled?(:junit_pipeline_screenshots_view, options[:project]) && test_case.has_attachment? test_case.has_attachment?
end end
end end
---
title: Show unit report attachments in the pipeline test report
merge_request: 61075
author:
type: added
---
name: junit_pipeline_screenshots_view
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/31029
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/202114
milestone: '13.0'
type: development
group: group::verify testing
default_enabled: false
...@@ -333,32 +333,17 @@ If parsing JUnit report XML results in an error, an indicator is shown next to t ...@@ -333,32 +333,17 @@ If parsing JUnit report XML results in an error, an indicator is shown next to t
## Viewing JUnit screenshots on GitLab ## Viewing JUnit screenshots on GitLab
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/202114) in GitLab 13.0. > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/202114) in GitLab 13.0 behind the `:junit_pipeline_screenshots_view` feature flag, disabled by default.
> - It's deployed behind a feature flag, disabled by default. > - The feature flag was removed and was [made generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/216979) in GitLab 13.12.
> - To use it in GitLab self-managed instances, ask a GitLab administrator to [enable it](#enabling-the-junit-screenshots-feature). **(FREE SELF)**
WARNING:
This feature might not be available to you. Check the **version history** note above for details.
When [this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/6061) is complete, the attached file is visible on the pipeline details page.
If JUnit report format XML files contain an `attachment` tag, GitLab parses the attachment. If JUnit report format XML files contain an `attachment` tag, GitLab parses the attachment.
Upload your screenshots as [artifacts](yaml/README.md#artifactsreportsjunit) to GitLab. The `attachment` tag **must** contain the absolute path to the screenshots you uploaded.
```xml ```xml
<testcase time="1.00" name="Test"> <testcase time="1.00" name="Test">
<system-out>[[ATTACHMENT|/absolute/path/to/some/file]]</system-out> <system-out>[[ATTACHMENT|/absolute/path/to/some/file]]</system-out>
</testcase> </testcase>
``` ```
### Enabling the JUnit screenshots feature **(FREE SELF)** Upload your screenshots as [artifacts](yaml/README.md#artifactsreportsjunit) to GitLab. The `attachment` tag **must** contain the absolute path to the screenshots you uploaded.
This feature comes with the `:junit_pipeline_screenshots_view` feature flag disabled by default.
To enable this feature, ask a GitLab administrator with [Rails console access](../administration/feature_flags.md#how-to-enable-and-disable-features-behind-flags) to run the
following command:
```ruby A link to the test case attachment will appear in the test case details in [the pipeline test report](#viewing-unit-test-reports-on-gitlab).
Feature.enable(:junit_pipeline_screenshots_view)
```
...@@ -976,49 +976,26 @@ RSpec.describe Projects::PipelinesController do ...@@ -976,49 +976,26 @@ RSpec.describe Projects::PipelinesController do
end end
end end
context 'when junit_pipeline_screenshots_view is enabled' do context 'when test_report contains attachment and scope is with_attachment as a URL param' do
before do let(:pipeline) { create(:ci_pipeline, :with_test_reports_attachment, project: project) }
stub_feature_flags(junit_pipeline_screenshots_view: project)
end
context 'when test_report contains attachment and scope is with_attachment as a URL param' do
let(:pipeline) { create(:ci_pipeline, :with_test_reports_attachment, project: project) }
it 'returns a test reports with attachment' do
get_test_report_json(scope: 'with_attachment')
expect(response).to have_gitlab_http_status(:ok)
expect(json_response["test_suites"]).to be_present
expect(json_response["test_suites"].first["test_cases"].first).to include("attachment_url")
end
end
context 'when test_report does not contain attachment and scope is with_attachment as a URL param' do
let(:pipeline) { create(:ci_pipeline, :with_test_reports, project: project) }
it 'returns a test reports with empty values' do it 'returns a test reports with attachment' do
get_test_report_json(scope: 'with_attachment') get_test_report_json(scope: 'with_attachment')
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(json_response["test_suites"]).to be_empty expect(json_response["test_suites"]).to be_present
end expect(json_response["test_suites"].first["test_cases"].first).to include("attachment_url")
end end
end end
context 'when junit_pipeline_screenshots_view is disabled' do context 'when test_report does not contain attachment and scope is with_attachment as a URL param' do
before do let(:pipeline) { create(:ci_pipeline, :with_test_reports, project: project) }
stub_feature_flags(junit_pipeline_screenshots_view: false)
end
context 'when test_report contains attachment and scope is with_attachment as a URL param' do it 'returns a test reports with empty values' do
let(:pipeline) { create(:ci_pipeline, :with_test_reports_attachment, project: project) } get_test_report_json(scope: 'with_attachment')
it 'returns a test reports without attachment_url' do expect(response).to have_gitlab_http_status(:ok)
get_test_report_json(scope: 'with_attachment') expect(json_response["test_suites"]).to be_empty
expect(response).to have_gitlab_http_status(:ok)
expect(json_response["test_suites"].first["test_cases"].first).not_to include("attachment_url")
end
end end
end end
......
...@@ -41,47 +41,19 @@ RSpec.describe TestCaseEntity do ...@@ -41,47 +41,19 @@ RSpec.describe TestCaseEntity do
end end
end end
context 'when feature is enabled' do context 'when attachment is present' do
before do let(:test_case) { build(:report_test_case, :failed_with_attachment, job: job) }
stub_feature_flags(junit_pipeline_screenshots_view: true)
end
context 'when attachment is present' do
let(:test_case) { build(:report_test_case, :failed_with_attachment, job: job) }
it 'returns the attachment_url' do
expect(subject).to include(:attachment_url)
end
end
context 'when attachment is not present' do
let(:test_case) { build(:report_test_case, job: job) }
it 'returns a nil attachment_url' do it 'returns the attachment_url' do
expect(subject[:attachment_url]).to be_nil expect(subject).to include(:attachment_url)
end
end end
end end
context 'when feature is disabled' do context 'when attachment is not present' do
before do let(:test_case) { build(:report_test_case, job: job) }
stub_feature_flags(junit_pipeline_screenshots_view: false)
end
context 'when attachment is present' do
let(:test_case) { build(:report_test_case, :failed_with_attachment, job: job) }
it 'returns no attachment_url' do
expect(subject).not_to include(:attachment_url)
end
end
context 'when attachment is not present' do
let(:test_case) { build(:report_test_case, job: job) }
it 'returns no attachment_url' do it 'returns a nil attachment_url' do
expect(subject).not_to include(:attachment_url) expect(subject[:attachment_url]).to be_nil
end
end end
end end
end end
......
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