Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/jobs/components')
-rw-r--r--spec/frontend/jobs/components/job/artifacts_block_spec.js36
-rw-r--r--spec/frontend/jobs/components/job/job_app_spec.js1
-rw-r--r--spec/frontend/jobs/components/job/job_log_controllers_spec.js1
-rw-r--r--spec/frontend/jobs/components/job/sidebar_detail_row_spec.js3
-rw-r--r--spec/frontend/jobs/components/log/line_header_spec.js29
-rw-r--r--spec/frontend/jobs/components/log/line_spec.js47
-rw-r--r--spec/frontend/jobs/components/log/log_spec.js1
7 files changed, 106 insertions, 12 deletions
diff --git a/spec/frontend/jobs/components/job/artifacts_block_spec.js b/spec/frontend/jobs/components/job/artifacts_block_spec.js
index ea5d727bd08..f9e52a5ae43 100644
--- a/spec/frontend/jobs/components/job/artifacts_block_spec.js
+++ b/spec/frontend/jobs/components/job/artifacts_block_spec.js
@@ -1,4 +1,5 @@
-import { mount } from '@vue/test-utils';
+import { GlPopover } from '@gitlab/ui';
+import { mountExtended } from 'helpers/vue_test_utils_helper';
import { trimText } from 'helpers/text_helper';
import ArtifactsBlock from '~/jobs/components/job/sidebar/artifacts_block.vue';
import { getTimeago } from '~/lib/utils/datetime_utility';
@@ -7,18 +8,20 @@ describe('Artifacts block', () => {
let wrapper;
const createWrapper = (propsData) =>
- mount(ArtifactsBlock, {
+ mountExtended(ArtifactsBlock, {
propsData: {
helpUrl: 'help-url',
...propsData,
},
});
- const findArtifactRemoveElt = () => wrapper.find('[data-testid="artifacts-remove-timeline"]');
- const findJobLockedElt = () => wrapper.find('[data-testid="job-locked-message"]');
- const findKeepBtn = () => wrapper.find('[data-testid="keep-artifacts"]');
- const findDownloadBtn = () => wrapper.find('[data-testid="download-artifacts"]');
- const findBrowseBtn = () => wrapper.find('[data-testid="browse-artifacts"]');
+ const findArtifactRemoveElt = () => wrapper.findByTestId('artifacts-remove-timeline');
+ const findJobLockedElt = () => wrapper.findByTestId('job-locked-message');
+ const findKeepBtn = () => wrapper.findByTestId('keep-artifacts');
+ const findDownloadBtn = () => wrapper.findByTestId('download-artifacts');
+ const findBrowseBtn = () => wrapper.findByTestId('browse-artifacts');
+ const findArtifactsHelpLink = () => wrapper.findByTestId('artifacts-help-link');
+ const findPopover = () => wrapper.findComponent(GlPopover);
const expireAt = '2018-08-14T09:38:49.157Z';
const timeago = getTimeago();
@@ -168,4 +171,23 @@ describe('Artifacts block', () => {
expect(findBrowseBtn().exists()).toBe(true);
});
});
+
+ describe('artifacts help text', () => {
+ beforeEach(() => {
+ wrapper = createWrapper({
+ artifact: lockedNonExpiredArtifact,
+ });
+ });
+
+ it('displays help text', () => {
+ const expectedHelpText =
+ 'Job artifacts are files that are configured to be uploaded when a job finishes execution. Artifacts could be compiled files, unit tests or scanning reports, or any other files generated by a job.';
+
+ expect(findPopover().text()).toBe(expectedHelpText);
+ });
+
+ it('links to artifacts help page', () => {
+ expect(findArtifactsHelpLink().attributes('href')).toBe('/help/ci/jobs/job_artifacts');
+ });
+ });
});
diff --git a/spec/frontend/jobs/components/job/job_app_spec.js b/spec/frontend/jobs/components/job/job_app_spec.js
index c925131dd9c..8f5700ee22d 100644
--- a/spec/frontend/jobs/components/job/job_app_spec.js
+++ b/spec/frontend/jobs/components/job/job_app_spec.js
@@ -1,4 +1,5 @@
import Vue, { nextTick } from 'vue';
+// eslint-disable-next-line no-restricted-imports
import Vuex from 'vuex';
import { GlLoadingIcon } from '@gitlab/ui';
import MockAdapter from 'axios-mock-adapter';
diff --git a/spec/frontend/jobs/components/job/job_log_controllers_spec.js b/spec/frontend/jobs/components/job/job_log_controllers_spec.js
index 218096b9745..7b6d58f63d1 100644
--- a/spec/frontend/jobs/components/job/job_log_controllers_spec.js
+++ b/spec/frontend/jobs/components/job/job_log_controllers_spec.js
@@ -21,7 +21,6 @@ describe('Job log controllers', () => {
const defaultProps = {
rawPath: '/raw',
- erasePath: '/erase',
size: 511952,
isScrollTopDisabled: false,
isScrollBottomDisabled: false,
diff --git a/spec/frontend/jobs/components/job/sidebar_detail_row_spec.js b/spec/frontend/jobs/components/job/sidebar_detail_row_spec.js
index fd27004816a..546f5392caf 100644
--- a/spec/frontend/jobs/components/job/sidebar_detail_row_spec.js
+++ b/spec/frontend/jobs/components/job/sidebar_detail_row_spec.js
@@ -1,12 +1,13 @@
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import SidebarDetailRow from '~/jobs/components/job/sidebar/sidebar_detail_row.vue';
+import { DOCS_URL } from 'jh_else_ce/lib/utils/url_utility';
describe('Sidebar detail row', () => {
let wrapper;
const title = 'this is the title';
const value = 'this is the value';
- const helpUrl = 'https://docs.gitlab.com/runner/register/index.html';
+ const helpUrl = `${DOCS_URL}/runner/register/index.html`;
const path = 'path/to/value';
const findHelpLink = () => wrapper.findByTestId('job-sidebar-help-link');
diff --git a/spec/frontend/jobs/components/log/line_header_spec.js b/spec/frontend/jobs/components/log/line_header_spec.js
index 16fe753e08a..c02d8c22655 100644
--- a/spec/frontend/jobs/components/log/line_header_spec.js
+++ b/spec/frontend/jobs/components/log/line_header_spec.js
@@ -1,5 +1,6 @@
import { mount } from '@vue/test-utils';
import { nextTick } from 'vue';
+import setWindowLocation from 'helpers/set_window_location_helper';
import DurationBadge from '~/jobs/components/log/duration_badge.vue';
import LineHeader from '~/jobs/components/log/line_header.vue';
import LineNumber from '~/jobs/components/log/line_number.vue';
@@ -15,7 +16,7 @@ describe('Job Log Header Line', () => {
style: 'term-fg-l-green',
},
],
- lineNumber: 0,
+ lineNumber: 76,
},
isClosed: true,
path: '/jashkenas/underscore/-/jobs/335',
@@ -89,4 +90,30 @@ describe('Job Log Header Line', () => {
expect(wrapper.findComponent(DurationBadge).exists()).toBe(true);
});
});
+
+ describe('line highlighting', () => {
+ describe('with hash', () => {
+ beforeEach(() => {
+ setWindowLocation(`http://foo.com/root/ci-project/-/jobs/6353#L77`);
+
+ createComponent(data);
+ });
+
+ it('highlights line', () => {
+ expect(wrapper.classes()).toContain('gl-bg-gray-700');
+ });
+ });
+
+ describe('without hash', () => {
+ beforeEach(() => {
+ setWindowLocation(`http://foo.com/root/ci-project/-/jobs/6353`);
+
+ createComponent(data);
+ });
+
+ it('does not highlight line', () => {
+ expect(wrapper.classes()).not.toContain('gl-bg-gray-700');
+ });
+ });
+ });
});
diff --git a/spec/frontend/jobs/components/log/line_spec.js b/spec/frontend/jobs/components/log/line_spec.js
index 50ebd1610d2..fad7a03beef 100644
--- a/spec/frontend/jobs/components/log/line_spec.js
+++ b/spec/frontend/jobs/components/log/line_spec.js
@@ -1,6 +1,7 @@
import { shallowMount } from '@vue/test-utils';
import Line from '~/jobs/components/log/line.vue';
import LineNumber from '~/jobs/components/log/line_number.vue';
+import setWindowLocation from 'helpers/set_window_location_helper';
const httpUrl = 'http://example.com';
const httpsUrl = 'https://example.com';
@@ -203,7 +204,7 @@ describe('Job Log Line', () => {
searchResults: mockSearchResults,
});
- expect(wrapper.classes()).toContain('gl-bg-gray-500');
+ expect(wrapper.classes()).toContain('gl-bg-gray-700');
});
it('does not apply highlight class to search result elements', () => {
@@ -218,7 +219,49 @@ describe('Job Log Line', () => {
searchResults: mockSearchResults,
});
- expect(wrapper.classes()).not.toContain('gl-bg-gray-500');
+ expect(wrapper.classes()).not.toContain('gl-bg-gray-700');
+ });
+ });
+
+ describe('job log hash highlighting', () => {
+ describe('with hash', () => {
+ beforeEach(() => {
+ setWindowLocation(`http://foo.com/root/ci-project/-/jobs/6353#L77`);
+ });
+
+ it('applies highlight class to job log line', () => {
+ createComponent({
+ line: {
+ offset: 24526,
+ content: [{ text: 'job log content' }],
+ section: 'custom-section',
+ lineNumber: 76,
+ },
+ path: '/root/ci-project/-/jobs/6353',
+ });
+
+ expect(wrapper.classes()).toContain('gl-bg-gray-700');
+ });
+ });
+
+ describe('without hash', () => {
+ beforeEach(() => {
+ setWindowLocation(`http://foo.com/root/ci-project/-/jobs/6353`);
+ });
+
+ it('does not apply highlight class to job log line', () => {
+ createComponent({
+ line: {
+ offset: 24500,
+ content: [{ text: 'line' }],
+ section: 'custom-section',
+ lineNumber: 10,
+ },
+ path: '/root/ci-project/-/jobs/6353',
+ });
+
+ expect(wrapper.classes()).not.toContain('gl-bg-gray-700');
+ });
});
});
});
diff --git a/spec/frontend/jobs/components/log/log_spec.js b/spec/frontend/jobs/components/log/log_spec.js
index 20638b13169..9407b340950 100644
--- a/spec/frontend/jobs/components/log/log_spec.js
+++ b/spec/frontend/jobs/components/log/log_spec.js
@@ -1,5 +1,6 @@
import { mount } from '@vue/test-utils';
import Vue from 'vue';
+// eslint-disable-next-line no-restricted-imports
import Vuex from 'vuex';
import waitForPromises from 'helpers/wait_for_promises';
import { scrollToElement } from '~/lib/utils/common_utils';