|
1 | 1 | import AxeBuilder from '@axe-core/playwright'; |
2 | 2 | import { voiceOverTest as voiceOverBase, nvdaTest as nvdaBase } from '@guidepup/playwright'; |
3 | 3 | import { test as base } from '@playwright/test'; |
4 | | -import { feature, story, suite } from 'allure-js-commons'; |
| 4 | +import { feature, label, story, suite } from 'allure-js-commons'; |
5 | 5 | import type axe from 'axe-core'; |
6 | 6 | import type { Page } from 'playwright'; |
7 | 7 | import type { TestInfo } from 'playwright/types/test'; |
@@ -36,11 +36,19 @@ export const skipButtonComboboxDiscernibleErrors = (v: axe.Result) => { |
36 | 36 | const beforeEachTests = async ({}, use: () => Promise<void>, testInfo: TestInfo) => { |
37 | 37 | const filePathParts = testInfo.file.split('/'); |
38 | 38 |
|
39 | | - const testsIndex = filePathParts.findIndex((part) => part === '__tests__'); |
| 39 | + let component = 'unknown-component'; |
40 | 40 |
|
41 | | - const component = testsIndex > 0 ? filePathParts[testsIndex - 1] : 'unknown-component'; |
| 41 | + const semcoreIndex = filePathParts.findLastIndex((part) => part === 'semcore'); |
| 42 | + if (semcoreIndex >= 0 && semcoreIndex + 2 < filePathParts.length) { |
| 43 | + const potentialComponent = filePathParts[semcoreIndex + 1]; |
| 44 | + const potentialTests = filePathParts[semcoreIndex + 2]; |
| 45 | + if (potentialTests === '__tests__') { |
| 46 | + component = potentialComponent; |
| 47 | + } |
| 48 | + } |
42 | 49 |
|
43 | 50 | feature(component); |
| 51 | + label('Component', component); |
44 | 52 |
|
45 | 53 | if (testInfo.titlePath.length > 2) { |
46 | 54 | story(testInfo.titlePath[1]); |
|
0 commit comments