Skip to content

Commit a3c8db9

Browse files
author
rocketraccoon
committed
feat(new-ui): review fixes
1 parent 160cea9 commit a3c8db9

File tree

4 files changed

+41
-22
lines changed

4 files changed

+41
-22
lines changed

lib/adapters/test-result/testplane/index.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,24 @@ export const getStatus = (eventName: ValueOf<Testplane['events']>, events: Testp
4949
return TestStatus.IDLE;
5050
};
5151

52+
const extractTags = (testResult: TestplaneTest | TestplaneTestResult): TestTag[] => {
53+
const list: TestTag[] = [];
54+
55+
let current: Test | Suite | TestplaneTestResult | null = testResult;
56+
57+
while (current && typeof current.getTags === 'function') {
58+
const tags = current?.getTags();
59+
60+
if (tags && tags.length > 0) {
61+
list.unshift(...tags);
62+
}
63+
64+
current = current.parent;
65+
}
66+
67+
return list;
68+
};
69+
5270
export interface TestplaneTestResultAdapterOptions {
5371
attempt: number;
5472
status: TestStatus;
@@ -254,26 +272,8 @@ export class TestplaneTestResultAdapter implements ReporterTestResult {
254272
return this._duration;
255273
}
256274

257-
get tags(): TestTag[] {
258-
const list: TestTag[] = [];
259-
260-
let current: Test | Suite | TestplaneTestResult | null = this._testResult;
261-
262-
while (current && typeof current.getTags === 'function') {
263-
const tags = current?.getTags();
264-
265-
if (tags && tags.length > 0) {
266-
list.unshift(...tags);
267-
}
268-
269-
current = current.parent;
270-
}
271-
272-
return list;
273-
}
274-
275275
get attachments(): Attachment[] {
276-
const tagsList = this.tags;
276+
const tagsList = extractTags(this._testResult);
277277

278278
if (tagsList.length > 0) {
279279
return [

lib/static/new-ui/features/suites/components/TestTags/index.module.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,19 @@
1111
line-height: 28px;
1212
font-weight: 450;
1313
}
14+
15+
.test-tags__hint {
16+
padding: 0;
17+
margin: 0;
18+
display: flex;
19+
gap: 4px;
20+
flex-direction: column;
21+
}
22+
23+
.test-tags__hint code {
24+
font-size: 12px;
25+
background: var(--g-color-base-generic);
26+
color: var(--g-color-private-black-400);
27+
padding: 2px 2px;
28+
border-radius: 4px;
29+
}

lib/static/new-ui/features/suites/components/TestTags/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ export const TestTags = (): ReactNode => {
4949
tags.list.map((tag: TestTag) => (
5050
<Tooltip
5151
key={tag.title}
52-
content={tag.dynamic && 'Dynamic tag'}
52+
content={tag.dynamic && (
53+
<p className={styles['test-tags__hint']}>
54+
<span>Tag was added via <code>browser.addTag()</code> command.</span>
55+
<span>Such tags can&apos;t be used with <code>--tag</code> filtering in CLI.</span>
56+
</p>
57+
)}
5358
>
5459
<Label
5560
size="xs"

test/unit/lib/tests-tree-builder/base.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ describe('ResultsTreeBuilder', () => {
8282
builder.tree.suites.byId['s1'],
8383
{
8484
id: 's1',
85-
hash: '8ddf878',
8685
name: 's1',
8786
parentId: null,
8887
root: true,
@@ -101,7 +100,6 @@ describe('ResultsTreeBuilder', () => {
101100
builder.tree.suites.byId['s1 s2'],
102101
{
103102
id: 's1 s2',
104-
hash: 'c8304d9',
105103
name: 's2',
106104
parentId: 's1',
107105
root: false,

0 commit comments

Comments
 (0)