@thinkwise/testwise 0.2.0-beta.3 → 0.2.5
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/Testwise.ts +8 -7
- package/artifact-builder/ArtifactManager.ts +0 -1
- package/artifact-builder/InterfaceGenerator.ts +73 -83
- package/artifact-builder/ModelDataBuilder.ts +74 -86
- package/artifact-builder/ModelDataRefiner.ts +18 -13
- package/artifact-builder/SchemaGenerator.ts +1 -4
- package/artifact-builder/ScreenInterfaceRefiner.ts +0 -5
- package/artifact-builder/SelectorBuilder.ts +8 -1
- package/artifact-builder/SubjectComponentGenerator.ts +77 -7
- package/artifact-builder/SubjectGenerator.ts +3 -3
- package/artifact-builder/SubjectRegistration.ts +69 -61
- package/artifact-builder/helpers/DataRetriever.ts +6 -3
- package/artifact-builder/helpers/NamingHandler.ts +28 -20
- package/artifact-builder/helpers/Stopwatch.ts +13 -0
- package/artifact-builder/helpers/index.ts +1 -0
- package/components/BaseComponentObjects.ts +4 -1
- package/components/action-bar/ActionBar.ts +3 -3
- package/components/grid/Grid.ts +18 -21
- package/components/tab/BaseTab.ts +2 -2
- package/components/tab/BaseTabObjects.ts +1 -1
- package/components/tab/DetailTabPage.ts +2 -2
- package/components/tab/Tab.ts +4 -4
- package/controls/LookupDropdown.ts +7 -2
- package/dist/Testwise.d.ts +1 -0
- package/dist/Testwise.js +15 -6
- package/dist/Testwise.js.map +1 -1
- package/dist/artifact-builder/ArtifactManager.js.map +1 -1
- package/dist/artifact-builder/InterfaceGenerator.d.ts +1 -1
- package/dist/artifact-builder/InterfaceGenerator.js +60 -67
- package/dist/artifact-builder/InterfaceGenerator.js.map +1 -1
- package/dist/artifact-builder/ModelDataBuilder.js +49 -60
- package/dist/artifact-builder/ModelDataBuilder.js.map +1 -1
- package/dist/artifact-builder/ModelDataRefiner.js +11 -7
- package/dist/artifact-builder/ModelDataRefiner.js.map +1 -1
- package/dist/artifact-builder/SchemaGenerator.js +0 -2
- package/dist/artifact-builder/SchemaGenerator.js.map +1 -1
- package/dist/artifact-builder/ScreenInterfaceRefiner.js +0 -5
- package/dist/artifact-builder/ScreenInterfaceRefiner.js.map +1 -1
- package/dist/artifact-builder/SelectorBuilder.js +3 -1
- package/dist/artifact-builder/SelectorBuilder.js.map +1 -1
- package/dist/artifact-builder/SubjectComponentGenerator.d.ts +4 -0
- package/dist/artifact-builder/SubjectComponentGenerator.js +61 -5
- package/dist/artifact-builder/SubjectComponentGenerator.js.map +1 -1
- package/dist/artifact-builder/SubjectGenerator.js +1 -1
- package/dist/artifact-builder/SubjectGenerator.js.map +1 -1
- package/dist/artifact-builder/SubjectRegistration.d.ts +10 -11
- package/dist/artifact-builder/SubjectRegistration.js +52 -44
- package/dist/artifact-builder/SubjectRegistration.js.map +1 -1
- package/dist/artifact-builder/helpers/DataRetriever.js +4 -3
- package/dist/artifact-builder/helpers/DataRetriever.js.map +1 -1
- package/dist/artifact-builder/helpers/NamingHandler.d.ts +2 -1
- package/dist/artifact-builder/helpers/NamingHandler.js +23 -16
- package/dist/artifact-builder/helpers/NamingHandler.js.map +1 -1
- package/dist/artifact-builder/helpers/Stopwatch.d.ts +5 -0
- package/dist/artifact-builder/helpers/Stopwatch.js +13 -0
- package/dist/artifact-builder/helpers/Stopwatch.js.map +1 -0
- package/dist/artifact-builder/helpers/index.d.ts +1 -0
- package/dist/artifact-builder/helpers/index.js +1 -0
- package/dist/artifact-builder/helpers/index.js.map +1 -1
- package/dist/components/BaseComponentObjects.d.ts +1 -0
- package/dist/components/BaseComponentObjects.js +3 -1
- package/dist/components/BaseComponentObjects.js.map +1 -1
- package/dist/components/action-bar/ActionBar.d.ts +1 -1
- package/dist/components/action-bar/ActionBar.js +3 -3
- package/dist/components/grid/Grid.d.ts +1 -0
- package/dist/components/grid/Grid.js +4 -1
- package/dist/components/grid/Grid.js.map +1 -1
- package/dist/components/tab/BaseTab.d.ts +2 -2
- package/dist/components/tab/BaseTab.js +2 -2
- package/dist/components/tab/BaseTab.js.map +1 -1
- package/dist/components/tab/BaseTabObjects.js +1 -1
- package/dist/components/tab/BaseTabObjects.js.map +1 -1
- package/dist/components/tab/DetailTabPage.d.ts +2 -2
- package/dist/components/tab/DetailTabPage.js +2 -2
- package/dist/components/tab/DetailTabPage.js.map +1 -1
- package/dist/components/tab/Tab.d.ts +3 -3
- package/dist/components/tab/Tab.js +4 -4
- package/dist/components/tab/Tab.js.map +1 -1
- package/dist/controls/LookupDropdown.d.ts +3 -7
- package/dist/controls/LookupDropdown.js.map +1 -1
- package/dist/enums/ElementTypes.d.ts +1 -1
- package/dist/enums/ElementTypes.js +1 -1
- package/dist/enums/ElementTypes.js.map +1 -1
- package/dist/helpers/ConfigChecker.d.ts +3 -0
- package/dist/helpers/ConfigChecker.js +7 -0
- package/dist/helpers/ConfigChecker.js.map +1 -0
- package/dist/helpers/LoginHelper.js +1 -1
- package/dist/helpers/LoginHelper.js.map +1 -1
- package/dist/interfaces/IComponentObjects.d.ts +1 -0
- package/dist/page-extensions/SubjectRegistry.d.ts +0 -8
- package/dist/page-extensions/SubjectRegistry.js +2 -6
- package/dist/page-extensions/SubjectRegistry.js.map +1 -1
- package/dist/page-extensions/index.d.ts +0 -1
- package/dist/page-extensions/index.js +0 -1
- package/dist/page-extensions/index.js.map +1 -1
- package/dist/services/IndiciumApi.service.d.ts +27 -0
- package/dist/services/IndiciumApi.service.js +135 -0
- package/dist/services/IndiciumApi.service.js.map +1 -0
- package/dist/templates/test-artifacts/SubjectPageBase.d.ts +5 -0
- package/dist/templates/test-artifacts/SubjectPageBase.js +6 -0
- package/dist/templates/test-artifacts/SubjectPageBase.js.map +1 -0
- package/dist/templates/test-artifacts/screens/index.d.ts +1 -0
- package/dist/templates/test-artifacts/screens/index.js +2 -0
- package/dist/templates/test-artifacts/screens/index.js.map +1 -0
- package/dist/templates/test-artifacts/subjects/index.d.ts +1 -0
- package/dist/templates/test-artifacts/subjects/index.js +2 -0
- package/dist/templates/test-artifacts/subjects/index.js.map +1 -0
- package/enums/ElementTypes.ts +2 -2
- package/helpers/ConfigChecker.ts +7 -0
- package/helpers/LoginHelper.ts +1 -1
- package/interfaces/IComponentObjects.ts +1 -0
- package/interfaces/IRegisteredSubjects.ts +1 -1
- package/package.json +5 -3
- package/page-extensions/SubjectRegistry.ts +2 -19
- package/page-extensions/index.ts +0 -1
- package/scripts/main.js +63 -82
- package/scripts/postinstall.js +40 -42
- package/scripts/setup.js +37 -37
- package/scripts/sync.js +726 -39
- package/services/ConfigBuilder.ts +1 -1
- package/services/IndiciumApi.service.ts +159 -0
- package/templates/SubjectRegistry.template.ts +73 -0
- package/templates/test-artifacts/SubjectPageBase.ts +9 -0
- package/templates/test-artifacts/screens/index.ts +0 -0
- package/templates/test-artifacts/subjects/index.ts +0 -0
- package/tsconfig.json +2 -3
- package/types/Components.ts +1 -1
- package/dist/config.json +0 -10
- package/dist/page-extensions/SubjectProvider.d.ts +0 -11
- package/dist/page-extensions/SubjectProvider.js +0 -24
- package/dist/page-extensions/SubjectProvider.js.map +0 -1
- package/dist/test-artifacts/index.d.ts +0 -3
- package/dist/test-artifacts/index.js +0 -4
- package/dist/test-artifacts/index.js.map +0 -1
- package/page-extensions/SubjectProvider.ts +0 -41
- package/test-artifacts/index.ts +0 -3
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
/** biome-ignore-all lint/style/noNonNullAssertion: because null is bad */
|
|
3
|
+
/** biome-ignore-all lint/suspicious/noExplicitAny: because it is necessary */
|
|
4
|
+
import axios, { type AxiosInstance } from 'axios';
|
|
5
|
+
import { testwiseConfig } from './ConfigBuilder.js';
|
|
6
|
+
|
|
7
|
+
export class IndiciumApiService {
|
|
8
|
+
private axiosInstance: AxiosInstance | null = null;
|
|
9
|
+
private metaEndpoint: string | null = null;
|
|
10
|
+
private guiApplId: number | null = null;
|
|
11
|
+
private isVerified = false;
|
|
12
|
+
private initPromise: Promise<void>;
|
|
13
|
+
|
|
14
|
+
constructor() {
|
|
15
|
+
this.initPromise = this.initialize();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal helper to ensure the service is fully initialized and verified
|
|
20
|
+
* before any API calls are made.
|
|
21
|
+
*/
|
|
22
|
+
private async ensureReady(): Promise<void> {
|
|
23
|
+
await this.initPromise;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
private async initialize(): Promise<void> {
|
|
27
|
+
const config = testwiseConfig();
|
|
28
|
+
const serviceUrl = config.get<string>('environmentSettings.serviceUrl')?.replace(/\/$/, '');
|
|
29
|
+
const metaEndpoint = config.get<string>('environmentSettings.metaEndpoint')?.replace(/^\//, '').replace(/\/$/, '');
|
|
30
|
+
const authUser = config.get<string>('environmentSettings.authUser');
|
|
31
|
+
const authUserPassword = config.get<string>('environmentSettings.authUserPassword');
|
|
32
|
+
const guiApplAlias = config.get<string>('environmentSettings.guiApplAlias');
|
|
33
|
+
|
|
34
|
+
if (!serviceUrl || !metaEndpoint || !authUser || !authUserPassword || !guiApplAlias) {
|
|
35
|
+
console.warn('IndiciumApiService: Configuration is incomplete.');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
this.metaEndpoint = metaEndpoint;
|
|
40
|
+
this.axiosInstance = axios.create({
|
|
41
|
+
baseURL: serviceUrl,
|
|
42
|
+
headers: {
|
|
43
|
+
Authorization: `Basic ${Buffer.from(`${authUser}:${authUserPassword}`).toString('base64')}`,
|
|
44
|
+
accept: '*/*'
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
await this.verifyConnection(guiApplAlias);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private async verifyConnection(targetAlias: string): Promise<void> {
|
|
52
|
+
if (!this.axiosInstance || !this.metaEndpoint) return;
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
const response = await this.axiosInstance.get(`/iam/${this.metaEndpoint}/i_ui_gui_appl`);
|
|
56
|
+
const apps = response.data?.value || [];
|
|
57
|
+
|
|
58
|
+
const foundApp = apps.find(
|
|
59
|
+
(app: any) => app.gui_appl_alias?.toString().toLowerCase() === targetAlias.toString().toLowerCase()
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
if (foundApp) {
|
|
63
|
+
this.guiApplId = foundApp.gui_appl_id;
|
|
64
|
+
this.isVerified = true;
|
|
65
|
+
} else {
|
|
66
|
+
console.warn(`IndiciumApiService: No GUI Application found for alias: ${targetAlias}`);
|
|
67
|
+
}
|
|
68
|
+
} catch (error) {
|
|
69
|
+
console.error('IndiciumApiService: Verification failed:', error);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public async canConnectToProject(): Promise<boolean> {
|
|
74
|
+
await this.ensureReady();
|
|
75
|
+
return this.isVerified;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public async getVerifiedGuiApplId(): Promise<number | null> {
|
|
79
|
+
await this.ensureReady();
|
|
80
|
+
return this.guiApplId;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public async getAllTables(): Promise<any[]> {
|
|
84
|
+
await this.ensureReady();
|
|
85
|
+
if (!this.isVerified || !this.guiApplId) return [];
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
const response = await this.axiosInstance!.get(
|
|
89
|
+
`/iam/${this.metaEndpoint}/i_ui_tab?$filter=gui_appl_id%20eq%20${this.guiApplId}`
|
|
90
|
+
);
|
|
91
|
+
return response.data?.value || [];
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.error('Failed to fetch tables:', error);
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
public async getAllColumns(): Promise<any[]> {
|
|
99
|
+
await this.ensureReady();
|
|
100
|
+
if (!this.isVerified || !this.guiApplId) return [];
|
|
101
|
+
|
|
102
|
+
try {
|
|
103
|
+
const response = await this.axiosInstance!.get(
|
|
104
|
+
`/iam/${this.metaEndpoint}/i_ui_col?$filter=gui_appl_id%20eq%20${this.guiApplId}`
|
|
105
|
+
);
|
|
106
|
+
return response.data?.value || [];
|
|
107
|
+
} catch (error) {
|
|
108
|
+
console.error('Failed to fetch columns:', error);
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
public async getLookups(): Promise<any[]> {
|
|
114
|
+
await this.ensureReady();
|
|
115
|
+
if (!this.isVerified || !this.guiApplId) return [];
|
|
116
|
+
|
|
117
|
+
try {
|
|
118
|
+
const response = await this.axiosInstance!.get(
|
|
119
|
+
`/iam/${this.metaEndpoint}/i_ui_tab_look_up?$filter=gui_appl_id%20eq%20${this.guiApplId}`
|
|
120
|
+
);
|
|
121
|
+
return response.data?.value || [];
|
|
122
|
+
} catch (error) {
|
|
123
|
+
console.error('Failed to fetch lookups:', error);
|
|
124
|
+
return [];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
public async getScreenComponents(): Promise<any[]> {
|
|
129
|
+
await this.ensureReady();
|
|
130
|
+
if (!this.isVerified || !this.guiApplId) return [];
|
|
131
|
+
|
|
132
|
+
try {
|
|
133
|
+
const response = await this.axiosInstance!.get(
|
|
134
|
+
`/iam/${this.metaEndpoint}/i_ui_screen_component?$filter=gui_appl_id%20eq%20${this.guiApplId}`
|
|
135
|
+
);
|
|
136
|
+
return response.data?.value || [];
|
|
137
|
+
} catch (error) {
|
|
138
|
+
console.error('Failed to fetch screen components:', error);
|
|
139
|
+
return [];
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Returns the verified GUI Application ID.
|
|
145
|
+
* Throws an error if verification failed or the alias was not found.
|
|
146
|
+
*/
|
|
147
|
+
public async getGuiApplId(): Promise<number> {
|
|
148
|
+
await this.ensureReady();
|
|
149
|
+
|
|
150
|
+
if (this.isVerified && this.guiApplId !== null) {
|
|
151
|
+
return this.guiApplId;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const alias = testwiseConfig().get<string>('environmentSettings.guiApplAlias');
|
|
155
|
+
throw new Error(`IndiciumApiService: Failed to resolve GUI Application ID for alias "${alias}".`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export const indiciumApi = new IndiciumApiService();
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
/** biome-ignore-all lint/suspicious/noExplicitAny: reason 42 */
|
|
3
|
+
|
|
4
|
+
import type { Page } from '@playwright/test';
|
|
5
|
+
import type { Test } from '../types/Test.js';
|
|
6
|
+
|
|
7
|
+
declare module '@playwright/test' {
|
|
8
|
+
interface Page {
|
|
9
|
+
subject: SubjectType;
|
|
10
|
+
get: <T>(ctor: new (page: Page) => T) => T;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
class Get {
|
|
15
|
+
private _page: Page;
|
|
16
|
+
constructor(page: Page) {
|
|
17
|
+
this._page = page;
|
|
18
|
+
}
|
|
19
|
+
getSubject<T>(ctor: new (page: Page) => T): T {
|
|
20
|
+
return new ctor(this._page);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type SubjectType = {
|
|
25
|
+
none: unknown;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export class SubjectRegistry {
|
|
29
|
+
private _test: Test;
|
|
30
|
+
|
|
31
|
+
constructor(test: Test) {
|
|
32
|
+
this._test = test.extend({
|
|
33
|
+
page: async ({ page }, use) => {
|
|
34
|
+
const getInstance = new Get(page);
|
|
35
|
+
page.get = getInstance.getSubject.bind(getInstance);
|
|
36
|
+
|
|
37
|
+
page.subject = new Proxy({} as SubjectType, {
|
|
38
|
+
get: (target, prop: string | symbol) => {
|
|
39
|
+
if (prop === 'then') return undefined;
|
|
40
|
+
if (typeof prop === 'symbol') return (target as any)[prop];
|
|
41
|
+
|
|
42
|
+
const paths: Record<string, string> = {
|
|
43
|
+
none: ''
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const path = paths[prop as string];
|
|
47
|
+
if (!path) return undefined;
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
// biome-ignore lint/suspicious/noThenProperty: must be thenable
|
|
51
|
+
then: (onfulfilled: any) => {
|
|
52
|
+
return import(path).then((m) => {
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
54
|
+
const SubjectClass = m[prop as string] || m.default;
|
|
55
|
+
if (!SubjectClass) throw new Error(`Class ${String(prop)} not found`);
|
|
56
|
+
|
|
57
|
+
const instance = page.get(SubjectClass);
|
|
58
|
+
return onfulfilled(instance);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
await use(page);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
get test() {
|
|
71
|
+
return this._test;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
File without changes
|
|
File without changes
|
package/tsconfig.json
CHANGED
package/types/Components.ts
CHANGED
|
@@ -52,4 +52,4 @@ export const subjectComponents: SubjectComponents[] = ['Form', 'Grid'];
|
|
|
52
52
|
|
|
53
53
|
export type ScreenComponents = SubjectComponents | SubjectAgnosticComponents;
|
|
54
54
|
export const screenComponents: ScreenComponents[] = [...coreComponents, ...subjectComponents];
|
|
55
|
-
export const disabledScreenComponents: ScreenComponents[] = ['Splitter'];
|
|
55
|
+
export const disabledScreenComponents: ScreenComponents[] = ['Splitter'];
|
package/dist/config.json
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"defaultApplication": "",
|
|
3
|
-
"defaultPlatform": 3,
|
|
4
|
-
"loginOptionsDisabled": false,
|
|
5
|
-
"loginOptionsHidden": false,
|
|
6
|
-
"installNotificationDisabled": true,
|
|
7
|
-
"installNotificationExpirationInDays": 30,
|
|
8
|
-
"useServiceWorker": false,
|
|
9
|
-
"useFormFieldBackgroundColor": true
|
|
10
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Test } from '../types/Test.js';
|
|
2
|
-
declare module '@playwright/test' {
|
|
3
|
-
interface Page {
|
|
4
|
-
get: <T>(ctor: new (page: Page) => T) => T;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
export declare class SubjectProvider {
|
|
8
|
-
private _test;
|
|
9
|
-
constructor(test: Test);
|
|
10
|
-
get test(): Test;
|
|
11
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
class Get {
|
|
2
|
-
constructor(page) {
|
|
3
|
-
this._page = page;
|
|
4
|
-
}
|
|
5
|
-
getSubject(ctor) {
|
|
6
|
-
return new ctor(this._page);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
export class SubjectProvider {
|
|
10
|
-
constructor(test) {
|
|
11
|
-
this._test = test.extend({
|
|
12
|
-
page: async ({ page }, use) => {
|
|
13
|
-
const getInstance = new Get(page);
|
|
14
|
-
page.get = getInstance.getSubject.bind(getInstance);
|
|
15
|
-
// page.subject definition goes here
|
|
16
|
-
await use(page);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
get test() {
|
|
21
|
-
return this._test;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=SubjectProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SubjectProvider.js","sourceRoot":"","sources":["../../page-extensions/SubjectProvider.ts"],"names":[],"mappings":"AAGA,MAAM,GAAG;IAGP,YAAY,IAAU;QACpB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,UAAU,CAAI,IAA2B;QACvC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;CACF;AAQD,MAAM,OAAO,eAAe;IAG1B,YAAY,IAAU;QACpB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;YACvB,IAAI,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE;gBAC5B,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;gBAClC,IAAI,CAAC,GAAG,GAAG,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBAEpD,oCAAoC;gBAEpC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../test-artifacts/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { Page } from '@playwright/test';
|
|
2
|
-
import type { Test } from '../types/Test.js';
|
|
3
|
-
|
|
4
|
-
class Get {
|
|
5
|
-
private _page: Page;
|
|
6
|
-
|
|
7
|
-
constructor(page: Page) {
|
|
8
|
-
this._page = page;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
getSubject<T>(ctor: new (page: Page) => T): T {
|
|
12
|
-
return new ctor(this._page);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
declare module '@playwright/test' {
|
|
17
|
-
interface Page {
|
|
18
|
-
get: <T>(ctor: new (page: Page) => T) => T;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export class SubjectProvider {
|
|
23
|
-
private _test: Test;
|
|
24
|
-
|
|
25
|
-
constructor(test: Test) {
|
|
26
|
-
this._test = test.extend({
|
|
27
|
-
page: async ({ page }, use) => {
|
|
28
|
-
const getInstance = new Get(page);
|
|
29
|
-
page.get = getInstance.getSubject.bind(getInstance);
|
|
30
|
-
|
|
31
|
-
// page.subject definition goes here
|
|
32
|
-
|
|
33
|
-
await use(page);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
get test() {
|
|
39
|
-
return this._test;
|
|
40
|
-
}
|
|
41
|
-
}
|
package/test-artifacts/index.ts
DELETED