angular-uitest 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +336 -0
- package/bin/samaro-allure.mjs +178 -0
- package/bin/samaro-init.mjs +407 -0
- package/bin/samaro-test.mjs +119 -0
- package/dist/cjs/config/index.d.ts +4 -0
- package/dist/cjs/config/index.d.ts.map +1 -0
- package/dist/cjs/config/index.js +11 -0
- package/dist/cjs/config/index.js.map +1 -0
- package/dist/cjs/config/playwright.component.config.d.ts +12 -0
- package/dist/cjs/config/playwright.component.config.d.ts.map +1 -0
- package/dist/cjs/config/playwright.component.config.js +42 -0
- package/dist/cjs/config/playwright.component.config.js.map +1 -0
- package/dist/cjs/config/playwright.config.d.ts +14 -0
- package/dist/cjs/config/playwright.config.d.ts.map +1 -0
- package/dist/cjs/config/playwright.config.js +53 -0
- package/dist/cjs/config/playwright.config.js.map +1 -0
- package/dist/cjs/config/vitest.config.d.ts +12 -0
- package/dist/cjs/config/vitest.config.d.ts.map +1 -0
- package/dist/cjs/config/vitest.config.js +60 -0
- package/dist/cjs/config/vitest.config.js.map +1 -0
- package/dist/cjs/helpers/allure.d.ts +141 -0
- package/dist/cjs/helpers/allure.d.ts.map +1 -0
- package/dist/cjs/helpers/allure.js +331 -0
- package/dist/cjs/helpers/allure.js.map +1 -0
- package/dist/cjs/helpers/api.d.ts +69 -0
- package/dist/cjs/helpers/api.d.ts.map +1 -0
- package/dist/cjs/helpers/api.js +163 -0
- package/dist/cjs/helpers/api.js.map +1 -0
- package/dist/cjs/helpers/auth.d.ts +35 -0
- package/dist/cjs/helpers/auth.d.ts.map +1 -0
- package/dist/cjs/helpers/auth.js +104 -0
- package/dist/cjs/helpers/auth.js.map +1 -0
- package/dist/cjs/helpers/config.d.ts +34 -0
- package/dist/cjs/helpers/config.d.ts.map +1 -0
- package/dist/cjs/helpers/config.js +70 -0
- package/dist/cjs/helpers/config.js.map +1 -0
- package/dist/cjs/helpers/debug.d.ts +48 -0
- package/dist/cjs/helpers/debug.d.ts.map +1 -0
- package/dist/cjs/helpers/debug.js +86 -0
- package/dist/cjs/helpers/debug.js.map +1 -0
- package/dist/cjs/helpers/index.d.ts +8 -0
- package/dist/cjs/helpers/index.d.ts.map +1 -0
- package/dist/cjs/helpers/index.js +76 -0
- package/dist/cjs/helpers/index.js.map +1 -0
- package/dist/cjs/helpers/setup.d.ts +50 -0
- package/dist/cjs/helpers/setup.d.ts.map +1 -0
- package/dist/cjs/helpers/setup.js +137 -0
- package/dist/cjs/helpers/setup.js.map +1 -0
- package/dist/cjs/src/index.d.ts +17 -0
- package/dist/cjs/src/index.d.ts.map +1 -0
- package/dist/cjs/src/index.js +99 -0
- package/dist/cjs/src/index.js.map +1 -0
- package/dist/esm/config/index.d.ts +4 -0
- package/dist/esm/config/index.d.ts.map +1 -0
- package/dist/esm/config/index.mjs +4 -0
- package/dist/esm/config/index.mjs.map +1 -0
- package/dist/esm/config/playwright.component.config.d.ts +12 -0
- package/dist/esm/config/playwright.component.config.d.ts.map +1 -0
- package/dist/esm/config/playwright.component.config.mjs +39 -0
- package/dist/esm/config/playwright.component.config.mjs.map +1 -0
- package/dist/esm/config/playwright.config.d.ts +14 -0
- package/dist/esm/config/playwright.config.d.ts.map +1 -0
- package/dist/esm/config/playwright.config.mjs +50 -0
- package/dist/esm/config/playwright.config.mjs.map +1 -0
- package/dist/esm/config/vitest.config.d.ts +12 -0
- package/dist/esm/config/vitest.config.d.ts.map +1 -0
- package/dist/esm/config/vitest.config.mjs +56 -0
- package/dist/esm/config/vitest.config.mjs.map +1 -0
- package/dist/esm/helpers/allure.d.ts +141 -0
- package/dist/esm/helpers/allure.d.ts.map +1 -0
- package/dist/esm/helpers/allure.mjs +306 -0
- package/dist/esm/helpers/allure.mjs.map +1 -0
- package/dist/esm/helpers/api.d.ts +69 -0
- package/dist/esm/helpers/api.d.ts.map +1 -0
- package/dist/esm/helpers/api.mjs +154 -0
- package/dist/esm/helpers/api.mjs.map +1 -0
- package/dist/esm/helpers/auth.d.ts +35 -0
- package/dist/esm/helpers/auth.d.ts.map +1 -0
- package/dist/esm/helpers/auth.mjs +96 -0
- package/dist/esm/helpers/auth.mjs.map +1 -0
- package/dist/esm/helpers/config.d.ts +34 -0
- package/dist/esm/helpers/config.d.ts.map +1 -0
- package/dist/esm/helpers/config.mjs +63 -0
- package/dist/esm/helpers/config.mjs.map +1 -0
- package/dist/esm/helpers/debug.d.ts +48 -0
- package/dist/esm/helpers/debug.d.ts.map +1 -0
- package/dist/esm/helpers/debug.mjs +76 -0
- package/dist/esm/helpers/debug.mjs.map +1 -0
- package/dist/esm/helpers/index.d.ts +8 -0
- package/dist/esm/helpers/index.d.ts.map +1 -0
- package/dist/esm/helpers/index.mjs +19 -0
- package/dist/esm/helpers/index.mjs.map +1 -0
- package/dist/esm/helpers/setup.d.ts +50 -0
- package/dist/esm/helpers/setup.d.ts.map +1 -0
- package/dist/esm/helpers/setup.mjs +95 -0
- package/dist/esm/helpers/setup.mjs.map +1 -0
- package/dist/esm/src/index.d.ts +17 -0
- package/dist/esm/src/index.d.ts.map +1 -0
- package/dist/esm/src/index.mjs +40 -0
- package/dist/esm/src/index.mjs.map +1 -0
- package/dist/types/config/index.d.ts +4 -0
- package/dist/types/config/index.d.ts.map +1 -0
- package/dist/types/config/playwright.component.config.d.ts +12 -0
- package/dist/types/config/playwright.component.config.d.ts.map +1 -0
- package/dist/types/config/playwright.config.d.ts +14 -0
- package/dist/types/config/playwright.config.d.ts.map +1 -0
- package/dist/types/config/vitest.config.d.ts +12 -0
- package/dist/types/config/vitest.config.d.ts.map +1 -0
- package/dist/types/helpers/allure.d.ts +141 -0
- package/dist/types/helpers/allure.d.ts.map +1 -0
- package/dist/types/helpers/api.d.ts +69 -0
- package/dist/types/helpers/api.d.ts.map +1 -0
- package/dist/types/helpers/auth.d.ts +35 -0
- package/dist/types/helpers/auth.d.ts.map +1 -0
- package/dist/types/helpers/config.d.ts +34 -0
- package/dist/types/helpers/config.d.ts.map +1 -0
- package/dist/types/helpers/debug.d.ts +48 -0
- package/dist/types/helpers/debug.d.ts.map +1 -0
- package/dist/types/helpers/index.d.ts +8 -0
- package/dist/types/helpers/index.d.ts.map +1 -0
- package/dist/types/helpers/setup.d.ts +50 -0
- package/dist/types/helpers/setup.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +17 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/package.json +140 -0
- package/schematics/collection.json +11 -0
- package/schematics/ng-add/index.js +126 -0
- package/schematics/ng-add/schema.json +26 -0
- package/scripts/check-allure-results.mjs +300 -0
- package/scripts/rename-esm-files.mjs +76 -0
- package/types/allure.d.ts +76 -0
- package/types/global.d.ts +49 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playwright.config.js","sourceRoot":"","sources":["../../../config/playwright.config.ts"],"names":[],"mappings":";;AAaA,wDA4DC;AAzED,2CAAyD;AAazD,SAAgB,sBAAsB,CAAC,UAAmC,EAAE;IAC1E,MAAM,EACJ,OAAO,GAAG,uBAAuB,EACjC,OAAO,GAAG,OAAO,EACjB,UAAU,GAAG,oBAAoB,EACjC,gBAAgB,GAAG,eAAe,EAClC,aAAa,GAAG,IAAI,EACpB,gBAAgB,GAAG,OAAO,EAC1B,OAAO,GAAG,MAAM,GACjB,GAAG,OAAO,CAAC;IAEZ,OAAO;QACL,OAAO;QACP,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QAC5B,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/B,OAAO,EAAE,CAAC;QACV,OAAO;QAEP,QAAQ,EAAE;YACR,CAAC,mBAAmB,EAAE;oBACpB,UAAU;oBACV,MAAM,EAAE,IAAI;oBACZ,UAAU,EAAE,IAAI;oBAChB,eAAe,EAAE;wBACf,SAAS,EAAE,YAAY;wBACvB,WAAW,EAAE,OAAO,CAAC,QAAQ;wBAC7B,YAAY,EAAE,OAAO,CAAC,OAAO;qBAC9B;iBACF,CAAC;YACF,CAAC,MAAM,EAAE,EAAE,YAAY,EAAE,mBAAmB,EAAE,CAAC;YAC/C,CAAC,MAAM,CAAC;SACT;QAED,GAAG,EAAE;YACH,OAAO;YACP,KAAK,EAAE,gBAAgB;YACvB,UAAU,EAAE,iBAAiB;YAC7B,aAAa,EAAE,KAAK;YACpB,iBAAiB,EAAE,MAAM;SAC1B;QAED,MAAM,EAAE;YACN,OAAO,EAAE,KAAK;SACf;QAED,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,UAAU;gBAChB,GAAG,EAAE,EAAE,GAAG,cAAO,CAAC,gBAAgB,CAAC,EAAE;aACtC;SACF;QAED,SAAS,EAAE;YACT,OAAO,EAAE,gBAAgB;YACzB,GAAG,EAAE,oBAAoB,aAAa,EAAE;YACxC,mBAAmB,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACpC,OAAO,EAAE,gBAAgB;SAC1B;KACF,CAAC;AACJ,CAAC;AAED,kBAAe,IAAA,mBAAY,EAAC,sBAAsB,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { mergeConfig } from 'vitest/config';
|
|
2
|
+
export interface SamaroVitestOptions {
|
|
3
|
+
projectRoot?: string;
|
|
4
|
+
testGlob?: string | string[];
|
|
5
|
+
resultsDir?: string;
|
|
6
|
+
setupFiles?: string[];
|
|
7
|
+
alias?: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
export declare function createVitestConfig(options?: SamaroVitestOptions): import("vite").UserConfig;
|
|
10
|
+
export { mergeConfig };
|
|
11
|
+
export default createVitestConfig;
|
|
12
|
+
//# sourceMappingURL=vitest.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../../../config/vitest.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,WAAW,EAAE,MAAM,eAAe,CAAC;AAqB1D,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,6BA+CnE;AAED,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeConfig = void 0;
|
|
4
|
+
exports.createVitestConfig = createVitestConfig;
|
|
5
|
+
const config_1 = require("vitest/config");
|
|
6
|
+
Object.defineProperty(exports, "mergeConfig", { enumerable: true, get: function () { return config_1.mergeConfig; } });
|
|
7
|
+
function getAngularPlugin() {
|
|
8
|
+
try {
|
|
9
|
+
// For ESM environments
|
|
10
|
+
// @ts-ignore - dynamic import for ESM compatibility
|
|
11
|
+
const angularModule = require('@analogjs/vite-plugin-angular');
|
|
12
|
+
// Handle different export styles: default export or named export
|
|
13
|
+
return angularModule.default || angularModule;
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
throw new Error('Failed to load @analogjs/vite-plugin-angular. ' +
|
|
17
|
+
'Please ensure it is installed in your project: npm install @analogjs/vite-plugin-angular');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function createVitestConfig(options = {}) {
|
|
21
|
+
const { projectRoot = process.cwd(), testGlob = 'src/**/*.spec.ts', resultsDir = 'allure-unit-results', setupFiles = [], alias = {}, } = options;
|
|
22
|
+
// Use setup file from user's project, not from package
|
|
23
|
+
const allSetupFiles = setupFiles.length > 0 ? setupFiles : [];
|
|
24
|
+
const testPatterns = Array.isArray(testGlob) ? testGlob : [testGlob];
|
|
25
|
+
return (0, config_1.defineConfig)({
|
|
26
|
+
plugins: [getAngularPlugin()],
|
|
27
|
+
test: {
|
|
28
|
+
globals: false,
|
|
29
|
+
environment: 'jsdom',
|
|
30
|
+
setupFiles: allSetupFiles,
|
|
31
|
+
include: testPatterns,
|
|
32
|
+
pool: 'threads',
|
|
33
|
+
reporters: [
|
|
34
|
+
'default',
|
|
35
|
+
[
|
|
36
|
+
'allure-vitest/reporter',
|
|
37
|
+
{
|
|
38
|
+
resultsDir,
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
],
|
|
42
|
+
coverage: {
|
|
43
|
+
provider: 'v8',
|
|
44
|
+
reporter: ['text', 'json', 'html'],
|
|
45
|
+
reportsDirectory: 'coverage',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
define: {
|
|
49
|
+
ngDevMode: true,
|
|
50
|
+
},
|
|
51
|
+
resolve: {
|
|
52
|
+
alias: {
|
|
53
|
+
'@': new URL('./src', 'file://' + projectRoot + '/').pathname,
|
|
54
|
+
...alias,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
exports.default = createVitestConfig;
|
|
60
|
+
//# sourceMappingURL=vitest.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.config.js","sourceRoot":"","sources":["../../../config/vitest.config.ts"],"names":[],"mappings":";;;AA6BA,gDA+CC;AA5ED,0CAA0D;AA8EjD,4FA9Ec,oBAAW,OA8Ed;AAxEpB,SAAS,gBAAgB;IACvB,IAAI,CAAC;QACH,uBAAuB;QACvB,oDAAoD;QACpD,MAAM,aAAa,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;QAC/D,iEAAiE;QACjE,OAAO,aAAa,CAAC,OAAO,IAAI,aAAa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;gBAC7D,GAAG,KAAK;aACT;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAGD,kBAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allure Metadata Helpers for SamaroUItest
|
|
3
|
+
*
|
|
4
|
+
* Provides decorators and functions for adding Allure metadata to tests.
|
|
5
|
+
* Works with both Vitest and Playwright test frameworks.
|
|
6
|
+
*/
|
|
7
|
+
export type Severity = 'blocker' | 'critical' | 'normal' | 'minor' | 'trivial';
|
|
8
|
+
export type LinkType = 'issue' | 'tms' | 'custom';
|
|
9
|
+
export type LabelName = 'epic' | 'feature' | 'story' | 'suite' | 'parentSuite' | 'subSuite' | 'owner' | 'severity' | 'tag' | 'layer' | 'host' | 'thread' | 'language' | 'framework' | 'package' | 'testClass' | 'testMethod';
|
|
10
|
+
/**
|
|
11
|
+
* Set test severity level
|
|
12
|
+
*/
|
|
13
|
+
export declare function severity(level: Severity): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => any;
|
|
14
|
+
/**
|
|
15
|
+
* Add tags/labels to test
|
|
16
|
+
*/
|
|
17
|
+
export declare function tag(...tags: string[]): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => any;
|
|
18
|
+
/**
|
|
19
|
+
* Set Epic for test hierarchy
|
|
20
|
+
*/
|
|
21
|
+
export declare function epic(name: string): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => any;
|
|
22
|
+
/**
|
|
23
|
+
* Set Feature for test hierarchy
|
|
24
|
+
*/
|
|
25
|
+
export declare function feature(name: string): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => any;
|
|
26
|
+
/**
|
|
27
|
+
* Set Story for test hierarchy
|
|
28
|
+
*/
|
|
29
|
+
export declare function story(name: string): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => any;
|
|
30
|
+
/**
|
|
31
|
+
* Set test owner
|
|
32
|
+
*/
|
|
33
|
+
export declare function owner(name: string): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => any;
|
|
34
|
+
/**
|
|
35
|
+
* Set test description
|
|
36
|
+
*/
|
|
37
|
+
export declare function description(text: string): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => any;
|
|
38
|
+
/**
|
|
39
|
+
* Set HTML description
|
|
40
|
+
*/
|
|
41
|
+
export declare function descriptionHtml(html: string): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => any;
|
|
42
|
+
/**
|
|
43
|
+
* Add link to external resource
|
|
44
|
+
*/
|
|
45
|
+
export declare function link(url: string, name?: string, type?: LinkType): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => any;
|
|
46
|
+
/**
|
|
47
|
+
* Add issue link
|
|
48
|
+
*/
|
|
49
|
+
export declare function issue(url: string, name?: string): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => any;
|
|
50
|
+
/**
|
|
51
|
+
* Add test management system link
|
|
52
|
+
*/
|
|
53
|
+
export declare function tms(url: string, name?: string): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => any;
|
|
54
|
+
/**
|
|
55
|
+
* Add Allure metadata to Playwright test
|
|
56
|
+
* Usage: test('my test', allureMeta({ severity: 'critical', tags: ['smoke'] }, async ({ page }) => { ... }))
|
|
57
|
+
*/
|
|
58
|
+
export declare function allureMeta<T extends (...args: any[]) => any>(metadata: {
|
|
59
|
+
severity?: Severity;
|
|
60
|
+
tags?: string[];
|
|
61
|
+
epic?: string;
|
|
62
|
+
feature?: string;
|
|
63
|
+
story?: string;
|
|
64
|
+
owner?: string;
|
|
65
|
+
description?: string;
|
|
66
|
+
descriptionHtml?: string;
|
|
67
|
+
links?: Array<{
|
|
68
|
+
url: string;
|
|
69
|
+
name?: string;
|
|
70
|
+
type?: LinkType;
|
|
71
|
+
}>;
|
|
72
|
+
}, testFn: T): T;
|
|
73
|
+
/**
|
|
74
|
+
* Add custom label to Playwright test at runtime
|
|
75
|
+
*/
|
|
76
|
+
export declare function addLabel(name: LabelName, value: string): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Add custom link to Playwright test at runtime
|
|
79
|
+
*/
|
|
80
|
+
export declare function addLink(url: string, name?: string, type?: LinkType): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Add attachment to test at runtime
|
|
83
|
+
*/
|
|
84
|
+
export declare function addAttachment(name: string, content: Buffer | string, type: string): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Add screenshot attachment
|
|
87
|
+
*/
|
|
88
|
+
export declare function attachScreenshot(name?: string, page?: any): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Add JSON attachment
|
|
91
|
+
*/
|
|
92
|
+
export declare function attachJson(name: string, data: any): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Add text attachment
|
|
95
|
+
*/
|
|
96
|
+
export declare function attachText(name: string, text: string): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* Add HTML attachment
|
|
99
|
+
*/
|
|
100
|
+
export declare function attachHtml(name: string, html: string): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Create a custom Allure step
|
|
103
|
+
*/
|
|
104
|
+
export declare function allureStep<T>(name: string, body: () => Promise<T> | T): Promise<T>;
|
|
105
|
+
export interface AllureMetadataOptions {
|
|
106
|
+
severity?: Severity;
|
|
107
|
+
tags?: string[];
|
|
108
|
+
epic?: string;
|
|
109
|
+
feature?: string;
|
|
110
|
+
story?: string;
|
|
111
|
+
owner?: string;
|
|
112
|
+
description?: string;
|
|
113
|
+
descriptionHtml?: string;
|
|
114
|
+
links?: Array<{
|
|
115
|
+
url: string;
|
|
116
|
+
name?: string;
|
|
117
|
+
type?: LinkType;
|
|
118
|
+
}>;
|
|
119
|
+
issue?: string | {
|
|
120
|
+
url: string;
|
|
121
|
+
name?: string;
|
|
122
|
+
};
|
|
123
|
+
tms?: string | {
|
|
124
|
+
url: string;
|
|
125
|
+
name?: string;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Combined decorator for multiple Allure metadata
|
|
130
|
+
*/
|
|
131
|
+
export declare function allure(options: AllureMetadataOptions): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => any;
|
|
132
|
+
/**
|
|
133
|
+
* Get all Allure metadata for a class or method
|
|
134
|
+
*/
|
|
135
|
+
export declare function getAllureMetadata(target: any, propertyKey?: string): AllureMetadataOptions | null;
|
|
136
|
+
/**
|
|
137
|
+
* Get metadata keys for a target
|
|
138
|
+
*/
|
|
139
|
+
export declare function getAllureMetadataKeys(target: any, propertyKey?: string): string[];
|
|
140
|
+
export type { Label, Link, Parameter, Attachment, Status, StatusDetails, StepResult, TestResult, TestResultContainer, } from 'allure-js-commons';
|
|
141
|
+
//# sourceMappingURL=allure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allure.d.ts","sourceRoot":"","sources":["../../../helpers/allure.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAG/E,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;AAGlD,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,SAAS,GACT,OAAO,GACP,OAAO,GACP,aAAa,GACb,UAAU,GACV,OAAO,GACP,UAAU,GACV,KAAK,GACL,OAAO,GACP,MAAM,GACN,QAAQ,GACR,UAAU,GACV,WAAW,GACX,SAAS,GACT,WAAW,GACX,YAAY,CAAC;AAEjB;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,QAAQ,IAC9B,QAAQ,GAAG,EAAE,cAAc,MAAM,EAAE,aAAa,kBAAkB,SAU3E;AAED;;GAEG;AACH,wBAAgB,GAAG,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,IAC3B,QAAQ,GAAG,EAAE,cAAc,MAAM,EAAE,aAAa,kBAAkB,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AE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAGjF;AAMD,YAAY,EACV,KAAK,EACL,IAAI,EACJ,SAAS,EACT,UAAU,EACV,MAAM,EACN,aAAa,EACb,UAAU,EACV,UAAU,EACV,mBAAmB,GACpB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Allure Metadata Helpers for SamaroUItest
|
|
4
|
+
*
|
|
5
|
+
* Provides decorators and functions for adding Allure metadata to tests.
|
|
6
|
+
* Works with both Vitest and Playwright test frameworks.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.severity = severity;
|
|
10
|
+
exports.tag = tag;
|
|
11
|
+
exports.epic = epic;
|
|
12
|
+
exports.feature = feature;
|
|
13
|
+
exports.story = story;
|
|
14
|
+
exports.owner = owner;
|
|
15
|
+
exports.description = description;
|
|
16
|
+
exports.descriptionHtml = descriptionHtml;
|
|
17
|
+
exports.link = link;
|
|
18
|
+
exports.issue = issue;
|
|
19
|
+
exports.tms = tms;
|
|
20
|
+
exports.allureMeta = allureMeta;
|
|
21
|
+
exports.addLabel = addLabel;
|
|
22
|
+
exports.addLink = addLink;
|
|
23
|
+
exports.addAttachment = addAttachment;
|
|
24
|
+
exports.attachScreenshot = attachScreenshot;
|
|
25
|
+
exports.attachJson = attachJson;
|
|
26
|
+
exports.attachText = attachText;
|
|
27
|
+
exports.attachHtml = attachHtml;
|
|
28
|
+
exports.allureStep = allureStep;
|
|
29
|
+
exports.allure = allure;
|
|
30
|
+
exports.getAllureMetadata = getAllureMetadata;
|
|
31
|
+
exports.getAllureMetadataKeys = getAllureMetadataKeys;
|
|
32
|
+
const test_1 = require("@playwright/test");
|
|
33
|
+
/**
|
|
34
|
+
* Set test severity level
|
|
35
|
+
*/
|
|
36
|
+
function severity(level) {
|
|
37
|
+
return (target, propertyKey, descriptor) => {
|
|
38
|
+
if (propertyKey) {
|
|
39
|
+
// Method decorator
|
|
40
|
+
Reflect.defineMetadata('allure:severity', level, target, propertyKey);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
// Class decorator
|
|
44
|
+
Reflect.defineMetadata('allure:severity', level, target);
|
|
45
|
+
}
|
|
46
|
+
return descriptor || target;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Add tags/labels to test
|
|
51
|
+
*/
|
|
52
|
+
function tag(...tags) {
|
|
53
|
+
return (target, propertyKey, descriptor) => {
|
|
54
|
+
const existingTags = Reflect.getMetadata('allure:tags', target, propertyKey || '') || [];
|
|
55
|
+
const allTags = [...existingTags, ...tags];
|
|
56
|
+
if (propertyKey) {
|
|
57
|
+
Reflect.defineMetadata('allure:tags', allTags, target, propertyKey);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
Reflect.defineMetadata('allure:tags', allTags, target);
|
|
61
|
+
}
|
|
62
|
+
return descriptor || target;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Set Epic for test hierarchy
|
|
67
|
+
*/
|
|
68
|
+
function epic(name) {
|
|
69
|
+
return (target, propertyKey, descriptor) => {
|
|
70
|
+
if (propertyKey) {
|
|
71
|
+
Reflect.defineMetadata('allure:epic', name, target, propertyKey);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
Reflect.defineMetadata('allure:epic', name, target);
|
|
75
|
+
}
|
|
76
|
+
return descriptor || target;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Set Feature for test hierarchy
|
|
81
|
+
*/
|
|
82
|
+
function feature(name) {
|
|
83
|
+
return (target, propertyKey, descriptor) => {
|
|
84
|
+
if (propertyKey) {
|
|
85
|
+
Reflect.defineMetadata('allure:feature', name, target, propertyKey);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
Reflect.defineMetadata('allure:feature', name, target);
|
|
89
|
+
}
|
|
90
|
+
return descriptor || target;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Set Story for test hierarchy
|
|
95
|
+
*/
|
|
96
|
+
function story(name) {
|
|
97
|
+
return (target, propertyKey, descriptor) => {
|
|
98
|
+
if (propertyKey) {
|
|
99
|
+
Reflect.defineMetadata('allure:story', name, target, propertyKey);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
Reflect.defineMetadata('allure:story', name, target);
|
|
103
|
+
}
|
|
104
|
+
return descriptor || target;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Set test owner
|
|
109
|
+
*/
|
|
110
|
+
function owner(name) {
|
|
111
|
+
return (target, propertyKey, descriptor) => {
|
|
112
|
+
if (propertyKey) {
|
|
113
|
+
Reflect.defineMetadata('allure:owner', name, target, propertyKey);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
Reflect.defineMetadata('allure:owner', name, target);
|
|
117
|
+
}
|
|
118
|
+
return descriptor || target;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Set test description
|
|
123
|
+
*/
|
|
124
|
+
function description(text) {
|
|
125
|
+
return (target, propertyKey, descriptor) => {
|
|
126
|
+
if (propertyKey) {
|
|
127
|
+
Reflect.defineMetadata('allure:description', text, target, propertyKey);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
Reflect.defineMetadata('allure:description', text, target);
|
|
131
|
+
}
|
|
132
|
+
return descriptor || target;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Set HTML description
|
|
137
|
+
*/
|
|
138
|
+
function descriptionHtml(html) {
|
|
139
|
+
return (target, propertyKey, descriptor) => {
|
|
140
|
+
if (propertyKey) {
|
|
141
|
+
Reflect.defineMetadata('allure:descriptionHtml', html, target, propertyKey);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
Reflect.defineMetadata('allure:descriptionHtml', html, target);
|
|
145
|
+
}
|
|
146
|
+
return descriptor || target;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Add link to external resource
|
|
151
|
+
*/
|
|
152
|
+
function link(url, name, type) {
|
|
153
|
+
return (target, propertyKey, descriptor) => {
|
|
154
|
+
const existingLinks = Reflect.getMetadata('allure:links', target, propertyKey || '') || [];
|
|
155
|
+
const allLinks = [...existingLinks, { url, name, type }];
|
|
156
|
+
if (propertyKey) {
|
|
157
|
+
Reflect.defineMetadata('allure:links', allLinks, target, propertyKey);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
Reflect.defineMetadata('allure:links', allLinks, target);
|
|
161
|
+
}
|
|
162
|
+
return descriptor || target;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Add issue link
|
|
167
|
+
*/
|
|
168
|
+
function issue(url, name) {
|
|
169
|
+
return link(url, name || url, 'issue');
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Add test management system link
|
|
173
|
+
*/
|
|
174
|
+
function tms(url, name) {
|
|
175
|
+
return link(url, name || url, 'tms');
|
|
176
|
+
}
|
|
177
|
+
// ============================================================================
|
|
178
|
+
// Playwright-specific helpers
|
|
179
|
+
// ============================================================================
|
|
180
|
+
/**
|
|
181
|
+
* Add Allure metadata to Playwright test
|
|
182
|
+
* Usage: test('my test', allureMeta({ severity: 'critical', tags: ['smoke'] }, async ({ page }) => { ... }))
|
|
183
|
+
*/
|
|
184
|
+
function allureMeta(metadata, testFn) {
|
|
185
|
+
return test_1.test.step(`Allure metadata: ${JSON.stringify(metadata)}`, testFn);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Add custom label to Playwright test at runtime
|
|
189
|
+
*/
|
|
190
|
+
async function addLabel(name, value) {
|
|
191
|
+
await test_1.test.step(`allure-label:${name}:${value}`, async () => { });
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Add custom link to Playwright test at runtime
|
|
195
|
+
*/
|
|
196
|
+
async function addLink(url, name, type) {
|
|
197
|
+
await test_1.test.step(`allure-link:${type || 'custom'}:${name || url}:${url}`, async () => { });
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Add attachment to test at runtime
|
|
201
|
+
*/
|
|
202
|
+
async function addAttachment(name, content, type) {
|
|
203
|
+
await test_1.test.step(`allure-attachment:${name}:${type}`, async () => {
|
|
204
|
+
await test_1.test.info().attach(name, { body: content, contentType: type });
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Add screenshot attachment
|
|
209
|
+
*/
|
|
210
|
+
async function attachScreenshot(name = 'Screenshot', page) {
|
|
211
|
+
if (page) {
|
|
212
|
+
const screenshot = await page.screenshot();
|
|
213
|
+
await test_1.test.info().attach(name, { body: screenshot, contentType: 'image/png' });
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Add JSON attachment
|
|
218
|
+
*/
|
|
219
|
+
async function attachJson(name, data) {
|
|
220
|
+
await test_1.test.info().attach(name, {
|
|
221
|
+
body: Buffer.from(JSON.stringify(data, null, 2)),
|
|
222
|
+
contentType: 'application/json',
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Add text attachment
|
|
227
|
+
*/
|
|
228
|
+
async function attachText(name, text) {
|
|
229
|
+
await test_1.test.info().attach(name, {
|
|
230
|
+
body: Buffer.from(text),
|
|
231
|
+
contentType: 'text/plain',
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Add HTML attachment
|
|
236
|
+
*/
|
|
237
|
+
async function attachHtml(name, html) {
|
|
238
|
+
await test_1.test.info().attach(name, {
|
|
239
|
+
body: Buffer.from(html),
|
|
240
|
+
contentType: 'text/html',
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Create a custom Allure step
|
|
245
|
+
*/
|
|
246
|
+
async function allureStep(name, body) {
|
|
247
|
+
return test_1.test.step(name, body);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Combined decorator for multiple Allure metadata
|
|
251
|
+
*/
|
|
252
|
+
function allure(options) {
|
|
253
|
+
return (target, propertyKey, descriptor) => {
|
|
254
|
+
const applyMetadata = (metaKey, value) => {
|
|
255
|
+
if (propertyKey) {
|
|
256
|
+
Reflect.defineMetadata(`allure:${metaKey}`, value, target, propertyKey);
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
Reflect.defineMetadata(`allure:${metaKey}`, value, target);
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
if (options.severity)
|
|
263
|
+
applyMetadata('severity', options.severity);
|
|
264
|
+
if (options.tags)
|
|
265
|
+
applyMetadata('tags', options.tags);
|
|
266
|
+
if (options.epic)
|
|
267
|
+
applyMetadata('epic', options.epic);
|
|
268
|
+
if (options.feature)
|
|
269
|
+
applyMetadata('feature', options.feature);
|
|
270
|
+
if (options.story)
|
|
271
|
+
applyMetadata('story', options.story);
|
|
272
|
+
if (options.owner)
|
|
273
|
+
applyMetadata('owner', options.owner);
|
|
274
|
+
if (options.description)
|
|
275
|
+
applyMetadata('description', options.description);
|
|
276
|
+
if (options.descriptionHtml)
|
|
277
|
+
applyMetadata('descriptionHtml', options.descriptionHtml);
|
|
278
|
+
// Handle links
|
|
279
|
+
const links = options.links || [];
|
|
280
|
+
if (options.issue) {
|
|
281
|
+
if (typeof options.issue === 'string') {
|
|
282
|
+
links.push({ url: options.issue, type: 'issue' });
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
links.push({ ...options.issue, type: 'issue' });
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
if (options.tms) {
|
|
289
|
+
if (typeof options.tms === 'string') {
|
|
290
|
+
links.push({ url: options.tms, type: 'tms' });
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
links.push({ ...options.tms, type: 'tms' });
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
if (links.length > 0) {
|
|
297
|
+
applyMetadata('links', links);
|
|
298
|
+
}
|
|
299
|
+
return descriptor || target;
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
// ============================================================================
|
|
303
|
+
// Utility functions for retrieving metadata
|
|
304
|
+
// ============================================================================
|
|
305
|
+
/**
|
|
306
|
+
* Get all Allure metadata for a class or method
|
|
307
|
+
*/
|
|
308
|
+
function getAllureMetadata(target, propertyKey) {
|
|
309
|
+
const metadata = {};
|
|
310
|
+
const keys = [
|
|
311
|
+
'severity', 'tags', 'epic', 'feature', 'story',
|
|
312
|
+
'owner', 'description', 'descriptionHtml', 'links'
|
|
313
|
+
];
|
|
314
|
+
let hasMetadata = false;
|
|
315
|
+
for (const key of keys) {
|
|
316
|
+
const value = Reflect.getMetadata(`allure:${key}`, target, propertyKey || '');
|
|
317
|
+
if (value !== undefined) {
|
|
318
|
+
metadata[key] = value;
|
|
319
|
+
hasMetadata = true;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return hasMetadata ? metadata : null;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Get metadata keys for a target
|
|
326
|
+
*/
|
|
327
|
+
function getAllureMetadataKeys(target, propertyKey) {
|
|
328
|
+
return Reflect.getMetadataKeys(target, propertyKey || '')
|
|
329
|
+
.filter((key) => key.startsWith('allure:'));
|
|
330
|
+
}
|
|
331
|
+
//# sourceMappingURL=allure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allure.js","sourceRoot":"","sources":["../../../helpers/allure.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAiCH,4BAWC;AAKD,kBAYC;AAKD,oBASC;AAKD,0BASC;AAKD,sBASC;AAKD,sBASC;AAKD,kCASC;AAKD,0CASC;AAKD,oBAYC;AAKD,sBAEC;AAKD,k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
1
|
+
import { APIRequestContext } from '@playwright/test';
|
|
2
|
+
export interface APIConfig {
|
|
3
|
+
baseURL: string;
|
|
4
|
+
}
|
|
5
|
+
export interface APIUser {
|
|
6
|
+
username: string;
|
|
7
|
+
email: string;
|
|
8
|
+
password: string;
|
|
9
|
+
}
|
|
10
|
+
export interface APIAuthResponse {
|
|
11
|
+
user: {
|
|
12
|
+
email: string;
|
|
13
|
+
token: string;
|
|
14
|
+
username: string;
|
|
15
|
+
bio: string | null;
|
|
16
|
+
image: string | null;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get API configuration from environment variables
|
|
21
|
+
*/
|
|
22
|
+
export declare function getAPIConfig(): APIConfig;
|
|
23
|
+
/**
|
|
24
|
+
* Register a user via API
|
|
25
|
+
*/
|
|
26
|
+
export declare function registerUserViaAPI(request: APIRequestContext, user: APIUser): Promise<{
|
|
27
|
+
token: string;
|
|
28
|
+
username: string;
|
|
29
|
+
email: string;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Login a user via API
|
|
33
|
+
*/
|
|
34
|
+
export declare function loginUserViaAPI(request: APIRequestContext, email: string, password: string): Promise<{
|
|
35
|
+
token: string;
|
|
36
|
+
username: string;
|
|
37
|
+
email: string;
|
|
38
|
+
}>;
|
|
39
|
+
/**
|
|
40
|
+
* Create an article via API
|
|
41
|
+
*/
|
|
42
|
+
export declare function createArticleViaAPI(request: APIRequestContext, token: string, article: {
|
|
43
|
+
title: string;
|
|
44
|
+
description: string;
|
|
45
|
+
body: string;
|
|
46
|
+
tagList?: string[];
|
|
47
|
+
}): Promise<{
|
|
48
|
+
slug: string;
|
|
49
|
+
title: string;
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* Delete an article via API
|
|
53
|
+
*/
|
|
54
|
+
export declare function deleteArticleViaAPI(request: APIRequestContext, token: string, slug: string): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Update user via API
|
|
57
|
+
*/
|
|
58
|
+
export declare function updateUserViaAPI(request: APIRequestContext, token: string, updates: {
|
|
59
|
+
email?: string;
|
|
60
|
+
bio?: string;
|
|
61
|
+
image?: string;
|
|
62
|
+
username?: string;
|
|
63
|
+
password?: string;
|
|
64
|
+
}): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Get current user via API
|
|
67
|
+
*/
|
|
68
|
+
export declare function getCurrentUserViaAPI(request: APIRequestContext, token: string): Promise<APIAuthResponse['user']>;
|
|
69
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../helpers/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,OAAO;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;QACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;KACtB,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,SAAS,CAIxC;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,iBAAiB,EAC1B,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAyB7D;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,iBAAiB,EAC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