1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
<script>
import {
GlModalDirective,
GlTooltipDirective,
GlFriendlyWrap,
GlIcon,
GlLink,
GlButton,
GlPagination,
GlEmptyState,
GlSprintf,
} from '@gitlab/ui';
import { mapState, mapGetters, mapActions } from 'vuex';
import { __, s__ } from '~/locale';
import { helpPagePath } from '~/helpers/help_page_helper';
import TestCaseDetails from './test_case_details.vue';
export const i18n = {
expiredArtifactsTitle: s__('TestReports|Job artifacts are expired'),
expiredArtifactsDescription: s__(
'TestReports|Test reports require job artifacts but all artifacts are expired. %{linkStart}Learn more%{linkEnd}',
),
};
export default {
name: 'TestsSuiteTable',
components: {
GlIcon,
GlFriendlyWrap,
GlLink,
GlButton,
GlPagination,
GlEmptyState,
GlSprintf,
TestCaseDetails,
},
directives: {
GlTooltip: GlTooltipDirective,
GlModalDirective,
},
inject: {
artifactsExpiredImagePath: {
default: '',
},
},
props: {
heading: {
type: String,
required: false,
default: __('Tests'),
},
},
computed: {
...mapState(['pageInfo']),
...mapGetters(['getSuiteTests', 'getSuiteTestCount', 'getSuiteArtifactsExpired']),
hasSuites() {
return this.getSuiteTests.length > 0;
},
},
methods: {
...mapActions(['setPage']),
},
wrapSymbols: ['::', '#', '.', '_', '-', '/', '\\'],
i18n,
learnMorePath: helpPagePath('ci/unit_test_reports', {
anchor: 'viewing-unit-test-reports-on-gitlab',
}),
};
</script>
<template>
<div>
<div v-if="hasSuites" class="test-reports-table gl-mb-3 js-test-cases-table">
<div class="row gl-mt-3">
<div class="col-12">
<h4>{{ heading }}</h4>
</div>
</div>
<div role="row" class="gl-responsive-table-row table-row-header font-weight-bold fgray">
<div role="rowheader" class="table-section section-20">
{{ __('Suite') }}
</div>
<div role="rowheader" class="table-section section-40">
{{ __('Name') }}
</div>
<div role="rowheader" class="table-section section-10">
{{ __('Filename') }}
</div>
<div role="rowheader" class="table-section section-10 text-center">
{{ __('Status') }}
</div>
<div role="rowheader" class="table-section section-10">
{{ __('Duration') }}
</div>
<div role="rowheader" class="table-section section-10">
{{ __('Details'), }}
</div>
</div>
<div
v-for="(testCase, index) in getSuiteTests"
:key="index"
class="gl-responsive-table-row rounded align-items-md-start"
data-testid="test-case-row"
>
<div class="table-section section-20 section-wrap">
<div role="rowheader" class="table-mobile-header">{{ __('Suite') }}</div>
<div class="table-mobile-content gl-md-pr-2 gl-overflow-wrap-break">
<gl-friendly-wrap :symbols="$options.wrapSymbols" :text="testCase.classname" />
</div>
</div>
<div class="table-section section-40 section-wrap">
<div role="rowheader" class="table-mobile-header">{{ __('Name') }}</div>
<div class="table-mobile-content gl-md-pr-2 gl-overflow-wrap-break">
<gl-friendly-wrap :symbols="$options.wrapSymbols" :text="testCase.name" />
</div>
</div>
<div class="table-section section-10 section-wrap">
<div role="rowheader" class="table-mobile-header">{{ __('Filename') }}</div>
<div class="table-mobile-content gl-md-pr-2 gl-overflow-wrap-break">
<gl-link v-if="testCase.file" :href="testCase.filePath" target="_blank">
<gl-friendly-wrap :symbols="$options.wrapSymbols" :text="testCase.file" />
</gl-link>
<gl-button
v-if="testCase.file"
v-gl-tooltip
size="small"
category="tertiary"
icon="copy-to-clipboard"
:title="__('Copy to clipboard')"
:data-clipboard-text="testCase.file"
:aria-label="__('Copy to clipboard')"
/>
</div>
</div>
<div class="table-section section-10 section-wrap">
<div role="rowheader" class="table-mobile-header">{{ __('Status') }}</div>
<div class="table-mobile-content text-center">
<div
class="ci-status-icon d-flex align-items-center justify-content-end justify-content-md-center"
:class="`ci-status-icon-${testCase.status}`"
>
<gl-icon :size="24" :name="testCase.icon" />
</div>
</div>
</div>
<div class="table-section section-10 section-wrap">
<div role="rowheader" class="table-mobile-header">
{{ __('Duration') }}
</div>
<div class="table-mobile-content pr-sm-1">
{{ testCase.formattedTime }}
</div>
</div>
<div class="table-section section-10 section-wrap">
<div role="rowheader" class="table-mobile-header">{{ __('Details'), }}</div>
<div class="table-mobile-content">
<gl-button v-gl-modal-directive="`test-case-details-${index}`">{{
__('View details')
}}</gl-button>
<test-case-details :modal-id="`test-case-details-${index}`" :test-case="testCase" />
</div>
</div>
</div>
<gl-pagination
v-model="pageInfo.page"
class="gl-display-flex gl-justify-content-center"
:per-page="pageInfo.perPage"
:total-items="getSuiteTestCount"
@input="setPage"
/>
</div>
<div v-else>
<gl-empty-state
v-if="getSuiteArtifactsExpired"
:title="$options.i18n.expiredArtifactsTitle"
:svg-path="artifactsExpiredImagePath"
:svg-height="100"
data-testid="artifacts-expired"
>
<template #description>
<gl-sprintf :message="$options.i18n.expiredArtifactsDescription">
<template #link="{ content }">
<gl-link :href="$options.learnMorePath">{{ content }}</gl-link>
</template>
</gl-sprintf>
</template>
</gl-empty-state>
<p v-else data-testid="no-test-cases">
{{ s__('TestReports|There are no test cases to display.') }}
</p>
</div>
</div>
</template>
|