@thinkwise/testwise 0.2.21 → 0.2.67
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 +2 -0
- package/artifact-builder/SelectorBuilder.ts +2 -2
- package/artifact-builder/SubjectComponentGenerator.ts +21 -12
- package/artifact-builder/SubjectGenerator.ts +20 -6
- package/components/action-bar/ActionBar.ts +7 -7
- package/components/action-bar/CustomActionBar.ts +0 -5
- package/components/cardlist/Cardlist.ts +3 -3
- package/components/chart/Chart.ts +3 -3
- package/components/combined-filter/CombinedFilter.ts +3 -3
- package/components/cube-view-bar/CubeViewBar.ts +3 -3
- package/components/filter/ExcelStyleFilterPopup.ts +69 -0
- package/components/filter/ExcelStyleFilterPopupObjects.ts +46 -0
- package/components/filter/FilterForm.ts +3 -3
- package/components/filter/FilterPopup.ts +187 -0
- package/components/filter/FilterPopupObjects.ts +63 -0
- package/components/filter/ManagePrefilterPopup.ts +44 -0
- package/components/filter/ManagePrefilterPopupObjects.ts +28 -0
- package/components/form/Form.ts +3 -3
- package/components/grid/Grid.ts +48 -133
- package/components/grid/GridObjects.ts +0 -19
- package/components/index.ts +4 -0
- package/components/maps/Maps.ts +3 -3
- package/components/menu/ListBarMenuComponent.ts +11 -0
- package/components/menu/ListBarMenuComponentObjects.ts +6 -0
- package/components/pivot-grid/PivotGrid.ts +3 -3
- package/components/pivot-grid/PivotGridFieldList.ts +3 -3
- package/components/pop-up/AllRowsPopUp.ts +29 -0
- package/components/pop-up/AllRowsPopUpObjects.ts +22 -0
- package/components/prefilter-list/PrefilterList.ts +3 -3
- package/components/preview/Preview.ts +3 -3
- package/components/report-bar/ReportBar.ts +3 -3
- package/components/report-tiles/ReportTiles.ts +3 -3
- package/components/scheduler/Scheduler.ts +3 -3
- package/components/splitter/Splitter.ts +3 -3
- package/components/tab/BaseTab.ts +3 -3
- package/components/tab/DetailTabPage.ts +4 -4
- package/components/tab/Tab.ts +4 -4
- package/components/task/TaskBar.ts +3 -3
- package/components/task/TaskTiles.ts +3 -3
- package/components/topbar/TopBar.ts +2 -0
- package/components/tree-view/TreeView.ts +3 -3
- package/controls/DateControl.ts +13 -14
- package/controls/DateControlObjects.ts +15 -0
- package/controls/FormComboBox.ts +17 -30
- package/controls/FormComboBoxObjects.ts +27 -0
- package/controls/GridColumnControl.ts +68 -0
- package/controls/GridColumnControlObjects.ts +20 -0
- package/controls/InputFieldControl.ts +17 -20
- package/controls/InputFieldControlObjects.ts +19 -0
- package/controls/LookupDropdown.ts +65 -24
- package/controls/LookupDropdownObjects.ts +19 -0
- package/controls/index.ts +1 -0
- package/dist/Testwise.d.ts +1 -0
- package/dist/Testwise.js +1 -0
- package/dist/Testwise.js.map +1 -1
- package/dist/artifact-builder/SelectorBuilder.d.ts +1 -1
- package/dist/artifact-builder/SelectorBuilder.js +2 -2
- package/dist/artifact-builder/SelectorBuilder.js.map +1 -1
- package/dist/artifact-builder/SubjectComponentGenerator.js +18 -12
- package/dist/artifact-builder/SubjectComponentGenerator.js.map +1 -1
- package/dist/artifact-builder/SubjectGenerator.d.ts +1 -0
- package/dist/artifact-builder/SubjectGenerator.js +16 -6
- package/dist/artifact-builder/SubjectGenerator.js.map +1 -1
- package/dist/components/action-bar/ActionBar.d.ts +2 -2
- package/dist/components/action-bar/ActionBar.js +7 -7
- package/dist/components/action-bar/ActionBar.js.map +1 -1
- package/dist/components/action-bar/CustomActionBar.d.ts +0 -2
- package/dist/components/action-bar/CustomActionBar.js +0 -3
- package/dist/components/action-bar/CustomActionBar.js.map +1 -1
- package/dist/components/cardlist/Cardlist.d.ts +2 -2
- package/dist/components/cardlist/Cardlist.js +2 -2
- package/dist/components/cardlist/Cardlist.js.map +1 -1
- package/dist/components/chart/Chart.d.ts +2 -2
- package/dist/components/chart/Chart.js +2 -2
- package/dist/components/chart/Chart.js.map +1 -1
- package/dist/components/combined-filter/CombinedFilter.d.ts +2 -2
- package/dist/components/combined-filter/CombinedFilter.js +2 -2
- package/dist/components/combined-filter/CombinedFilter.js.map +1 -1
- package/dist/components/cube-view-bar/CubeViewBar.d.ts +2 -2
- package/dist/components/cube-view-bar/CubeViewBar.js +2 -2
- package/dist/components/cube-view-bar/CubeViewBar.js.map +1 -1
- package/dist/components/filter/ExcelStyleFilterPopup.d.ts +19 -0
- package/dist/components/filter/ExcelStyleFilterPopup.js +64 -0
- package/dist/components/filter/ExcelStyleFilterPopup.js.map +1 -0
- package/dist/components/filter/ExcelStyleFilterPopupObjects.d.ts +16 -0
- package/dist/components/filter/ExcelStyleFilterPopupObjects.js +26 -0
- package/dist/components/filter/ExcelStyleFilterPopupObjects.js.map +1 -0
- package/dist/components/filter/FilterForm.d.ts +2 -2
- package/dist/components/filter/FilterForm.js +2 -2
- package/dist/components/filter/FilterForm.js.map +1 -1
- package/dist/components/filter/FilterPopup.d.ts +41 -0
- package/dist/components/filter/FilterPopup.js +126 -0
- package/dist/components/filter/FilterPopup.js.map +1 -0
- package/dist/components/filter/FilterPopupObjects.d.ts +29 -0
- package/dist/components/filter/FilterPopupObjects.js +30 -0
- package/dist/components/filter/FilterPopupObjects.js.map +1 -0
- package/dist/components/filter/ManagePrefilterPopup.d.ts +14 -0
- package/dist/components/filter/ManagePrefilterPopup.js +33 -0
- package/dist/components/filter/ManagePrefilterPopup.js.map +1 -0
- package/dist/components/filter/ManagePrefilterPopupObjects.d.ts +11 -0
- package/dist/components/filter/ManagePrefilterPopupObjects.js +19 -0
- package/dist/components/filter/ManagePrefilterPopupObjects.js.map +1 -0
- package/dist/components/form/Form.d.ts +2 -2
- package/dist/components/form/Form.js +2 -2
- package/dist/components/form/Form.js.map +1 -1
- package/dist/components/grid/Grid.d.ts +7 -37
- package/dist/components/grid/Grid.js +32 -127
- package/dist/components/grid/Grid.js.map +1 -1
- package/dist/components/grid/GridObjects.d.ts +0 -6
- package/dist/components/grid/GridObjects.js +0 -8
- package/dist/components/grid/GridObjects.js.map +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +4 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/maps/Maps.d.ts +2 -2
- package/dist/components/maps/Maps.js +2 -2
- package/dist/components/maps/Maps.js.map +1 -1
- package/dist/components/menu/ListBarMenuComponent.d.ts +6 -0
- package/dist/components/menu/ListBarMenuComponent.js +10 -0
- package/dist/components/menu/ListBarMenuComponent.js.map +1 -1
- package/dist/components/menu/ListBarMenuComponentObjects.d.ts +2 -0
- package/dist/components/menu/ListBarMenuComponentObjects.js +2 -0
- package/dist/components/menu/ListBarMenuComponentObjects.js.map +1 -1
- package/dist/components/pivot-grid/PivotGrid.d.ts +2 -2
- package/dist/components/pivot-grid/PivotGrid.js +2 -2
- package/dist/components/pivot-grid/PivotGrid.js.map +1 -1
- package/dist/components/pivot-grid/PivotGridFieldList.d.ts +2 -2
- package/dist/components/pivot-grid/PivotGridFieldList.js +2 -2
- package/dist/components/pivot-grid/PivotGridFieldList.js.map +1 -1
- package/dist/components/pop-up/AllRowsPopUp.d.ts +12 -0
- package/dist/components/pop-up/AllRowsPopUp.js +19 -0
- package/dist/components/pop-up/AllRowsPopUp.js.map +1 -0
- package/dist/components/pop-up/AllRowsPopUpObjects.d.ts +11 -0
- package/dist/components/pop-up/AllRowsPopUpObjects.js +13 -0
- package/dist/components/pop-up/AllRowsPopUpObjects.js.map +1 -0
- package/dist/components/prefilter-list/PrefilterList.d.ts +2 -2
- package/dist/components/prefilter-list/PrefilterList.js +2 -2
- package/dist/components/prefilter-list/PrefilterList.js.map +1 -1
- package/dist/components/preview/Preview.d.ts +2 -2
- package/dist/components/preview/Preview.js +2 -2
- package/dist/components/preview/Preview.js.map +1 -1
- package/dist/components/report-bar/ReportBar.d.ts +2 -2
- package/dist/components/report-bar/ReportBar.js +2 -2
- package/dist/components/report-bar/ReportBar.js.map +1 -1
- package/dist/components/report-tiles/ReportTiles.d.ts +2 -2
- package/dist/components/report-tiles/ReportTiles.js +2 -2
- package/dist/components/report-tiles/ReportTiles.js.map +1 -1
- package/dist/components/scheduler/Scheduler.d.ts +2 -2
- package/dist/components/scheduler/Scheduler.js +2 -2
- package/dist/components/scheduler/Scheduler.js.map +1 -1
- package/dist/components/splitter/Splitter.d.ts +2 -2
- package/dist/components/splitter/Splitter.js +2 -2
- package/dist/components/splitter/Splitter.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/DetailTabPage.d.ts +2 -2
- package/dist/components/tab/DetailTabPage.js +3 -3
- package/dist/components/tab/DetailTabPage.js.map +1 -1
- package/dist/components/tab/Tab.d.ts +2 -2
- package/dist/components/tab/Tab.js +3 -3
- package/dist/components/tab/Tab.js.map +1 -1
- package/dist/components/task/TaskBar.d.ts +2 -2
- package/dist/components/task/TaskBar.js +2 -2
- package/dist/components/task/TaskBar.js.map +1 -1
- package/dist/components/task/TaskTiles.d.ts +2 -2
- package/dist/components/task/TaskTiles.js +2 -2
- package/dist/components/task/TaskTiles.js.map +1 -1
- package/dist/components/topbar/TopBar.d.ts +1 -0
- package/dist/components/topbar/TopBar.js +1 -0
- package/dist/components/topbar/TopBar.js.map +1 -1
- package/dist/components/tree-view/TreeView.d.ts +2 -2
- package/dist/components/tree-view/TreeView.js +2 -2
- package/dist/components/tree-view/TreeView.js.map +1 -1
- package/dist/controls/DateControl.d.ts +4 -5
- package/dist/controls/DateControl.js +11 -11
- package/dist/controls/DateControl.js.map +1 -1
- package/dist/controls/DateControlObjects.d.ts +8 -0
- package/dist/controls/DateControlObjects.js +9 -0
- package/dist/controls/DateControlObjects.js.map +1 -0
- package/dist/controls/FormComboBox.d.ts +2 -2
- package/dist/controls/FormComboBox.js +15 -20
- package/dist/controls/FormComboBox.js.map +1 -1
- package/dist/controls/FormComboBoxObjects.d.ts +12 -0
- package/dist/controls/FormComboBoxObjects.js +16 -0
- package/dist/controls/FormComboBoxObjects.js.map +1 -0
- package/dist/controls/GridColumnControl.d.ts +10 -0
- package/dist/controls/GridColumnControl.js +43 -0
- package/dist/controls/GridColumnControl.js.map +1 -0
- package/dist/controls/GridColumnControlObjects.d.ts +9 -0
- package/dist/controls/GridColumnControlObjects.js +13 -0
- package/dist/controls/GridColumnControlObjects.js.map +1 -0
- package/dist/controls/InputFieldControl.d.ts +4 -6
- package/dist/controls/InputFieldControl.js +14 -15
- package/dist/controls/InputFieldControl.js.map +1 -1
- package/dist/controls/InputFieldControlObjects.d.ts +10 -0
- package/dist/controls/InputFieldControlObjects.js +11 -0
- package/dist/controls/InputFieldControlObjects.js.map +1 -0
- package/dist/controls/LookupDropdown.d.ts +6 -1
- package/dist/controls/LookupDropdown.js +51 -19
- package/dist/controls/LookupDropdown.js.map +1 -1
- package/dist/controls/LookupDropdownObjects.d.ts +10 -0
- package/dist/controls/LookupDropdownObjects.js +11 -0
- package/dist/controls/LookupDropdownObjects.js.map +1 -0
- package/dist/controls/index.d.ts +1 -0
- package/dist/controls/index.js +1 -0
- package/dist/controls/index.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/FlightTracker.d.ts +7 -0
- package/dist/helpers/FlightTracker.js +63 -11
- package/dist/helpers/FlightTracker.js.map +1 -1
- package/dist/helpers/LoginHelper.d.ts +11 -3
- package/dist/helpers/LoginHelper.js +59 -13
- package/dist/helpers/LoginHelper.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/page-extensions/GlobalComponents.d.ts +2 -1
- package/dist/page-extensions/GlobalComponents.js +2 -1
- package/dist/page-extensions/GlobalComponents.js.map +1 -1
- package/dist/page-overrides/ClickOverride.d.ts +1 -0
- package/dist/page-overrides/ClickOverride.js +57 -46
- package/dist/page-overrides/ClickOverride.js.map +1 -1
- package/dist/types/Universal.d.ts +1 -0
- package/enums/ElementTypes.ts +1 -1
- package/helpers/FlightTracker.ts +71 -11
- package/helpers/LoginHelper.ts +79 -21
- package/index.ts +1 -1
- package/package.json +6 -5
- package/page-extensions/GlobalComponents.ts +3 -0
- package/page-overrides/ClickOverride.ts +69 -64
- package/types/Universal.ts +1 -0
package/helpers/LoginHelper.ts
CHANGED
|
@@ -1,32 +1,24 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import type { Page } from '@playwright/test';
|
|
4
|
+
import type { APIResponse, Page } from '@playwright/test';
|
|
5
5
|
import { testwiseConfig } from '../services/ConfigBuilder.js';
|
|
6
6
|
import type { UniversalConfigOptions, UniversalLoginOptions } from '../types/index.js';
|
|
7
7
|
import { pollUntil } from './Poll.js';
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
const configFixture = JSON.parse(fs.readFileSync(path.resolve(
|
|
9
|
+
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const configFixture = JSON.parse(fs.readFileSync(path.resolve(dirname, '../../config.json'), 'utf-8'));
|
|
11
11
|
|
|
12
12
|
export class LoginHelper {
|
|
13
13
|
private _page: Page;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
protected serviceUrl = String(testwiseConfig().get('environmentSettings.serviceUrl'));
|
|
15
|
+
protected metaEndpoint = String(testwiseConfig().get('environmentSettings.metaEndpoint'));
|
|
16
16
|
|
|
17
17
|
constructor(page: Page) {
|
|
18
|
-
this.
|
|
19
|
-
|
|
20
|
-
const serviceUrl = testwiseConfig().get<string>('environmentSettings.serviceUrl');
|
|
21
|
-
const metaEndpoint = testwiseConfig().get<string>('environmentSettings.metaEndpoint');
|
|
18
|
+
if (!this.serviceUrl || this.serviceUrl === 'undefined') throw new Error('Service URL not found');
|
|
19
|
+
if (!this.metaEndpoint || this.metaEndpoint === 'undefined') throw new Error('Meta endpoint not found');
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
throw new Error(
|
|
25
|
-
'Either environmentSettings.serviceUrl or environmentSettings.metaEndpoint is not defined in the configuration.'
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
this._serviceUrl = serviceUrl;
|
|
29
|
-
this._metaEndpoint = metaEndpoint;
|
|
21
|
+
this._page = page;
|
|
30
22
|
}
|
|
31
23
|
|
|
32
24
|
/**
|
|
@@ -101,11 +93,11 @@ export class LoginHelper {
|
|
|
101
93
|
}
|
|
102
94
|
|
|
103
95
|
if (serviceUrl && metaEndpoint) {
|
|
104
|
-
this.
|
|
105
|
-
this.
|
|
96
|
+
this.serviceUrl = serviceUrl;
|
|
97
|
+
this.metaEndpoint = metaEndpoint;
|
|
106
98
|
}
|
|
107
99
|
|
|
108
|
-
const response = await this._page.request.post(`${this.
|
|
100
|
+
const response = await this._page.request.post(`${this.serviceUrl}/account/api/login`, {
|
|
109
101
|
form: {
|
|
110
102
|
UserName: username,
|
|
111
103
|
Password: password
|
|
@@ -116,6 +108,36 @@ export class LoginHelper {
|
|
|
116
108
|
throw new Error(`Login failed with status code: ${response.status()}`);
|
|
117
109
|
}
|
|
118
110
|
|
|
111
|
+
if (password === username && /^Worker_\d+$/.test(username)) {
|
|
112
|
+
const userPreferences = new UserPreferences(this._page, this.serviceUrl, this.metaEndpoint);
|
|
113
|
+
|
|
114
|
+
if (!options.userPreference) {
|
|
115
|
+
console.info(
|
|
116
|
+
`No user preference configuration ID provided for worker account ${username}. User preferences will be disabled to prevent unexpected test behavior.`
|
|
117
|
+
);
|
|
118
|
+
} else {
|
|
119
|
+
console.info(
|
|
120
|
+
`User preference configuration ID ${options.userPreference} provided for worker account ${username}. Attempting to disable user preferences before re-enabling with provided configuration.`
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
try {
|
|
125
|
+
await userPreferences.disable();
|
|
126
|
+
console.info(`Successfully disabled user preferences for worker account ${username}.`);
|
|
127
|
+
|
|
128
|
+
if (options.userPreference) {
|
|
129
|
+
await userPreferences.run(options.userPreference);
|
|
130
|
+
console.info(
|
|
131
|
+
`Successfully re-enabled user preferences for worker account ${username} with configuration ID ${options.userPreference}.`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
} catch (error) {
|
|
135
|
+
console.warn(
|
|
136
|
+
`User preferences may not be properly configured for worker account ${username}. Tests may be unstable. Error details: ${error}`
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
119
141
|
// Set the navigator.language property
|
|
120
142
|
await this._page.route('**/*', (route, request) => {
|
|
121
143
|
route.continue({
|
|
@@ -142,7 +164,7 @@ export class LoginHelper {
|
|
|
142
164
|
contentType: 'application/json',
|
|
143
165
|
body: JSON.stringify({
|
|
144
166
|
...configFixture,
|
|
145
|
-
serviceUrl: `${this.
|
|
167
|
+
serviceUrl: `${this.serviceUrl}/iam/${this.metaEndpoint}`,
|
|
146
168
|
...options
|
|
147
169
|
})
|
|
148
170
|
});
|
|
@@ -150,7 +172,7 @@ export class LoginHelper {
|
|
|
150
172
|
}
|
|
151
173
|
|
|
152
174
|
public async logOut() {
|
|
153
|
-
const response = await this._page.request.post(`${this.
|
|
175
|
+
const response = await this._page.request.post(`${this.serviceUrl}/account/api/logout`);
|
|
154
176
|
|
|
155
177
|
if (![204, 401].includes(response.status())) {
|
|
156
178
|
throw new Error(`Logout failed with status code: ${response.status()}`);
|
|
@@ -159,3 +181,39 @@ export class LoginHelper {
|
|
|
159
181
|
await this._page.context().clearCookies();
|
|
160
182
|
}
|
|
161
183
|
}
|
|
184
|
+
|
|
185
|
+
export class UserPreferences {
|
|
186
|
+
private _page: Page;
|
|
187
|
+
|
|
188
|
+
public readonly guiApplAlias = String(testwiseConfig().get<string>('environmentSettings.guiApplAlias'));
|
|
189
|
+
public readonly url: string;
|
|
190
|
+
|
|
191
|
+
constructor(requestContext: Page, serviceUrl?: string, metaEndpoint?: string) {
|
|
192
|
+
this._page = requestContext;
|
|
193
|
+
|
|
194
|
+
serviceUrl = serviceUrl ?? testwiseConfig().get<string>('environmentSettings.serviceUrl');
|
|
195
|
+
metaEndpoint = metaEndpoint ?? testwiseConfig().get<string>('environmentSettings.metaEndpoint');
|
|
196
|
+
|
|
197
|
+
if (!serviceUrl) throw new Error('Service URL not found or is empty');
|
|
198
|
+
if (!metaEndpoint) throw new Error('Meta endpoint not found or is empty');
|
|
199
|
+
if (!this.guiApplAlias) throw new Error('GUI application alias not found or is empty');
|
|
200
|
+
|
|
201
|
+
this.url = `${serviceUrl}/${metaEndpoint}/${this.guiApplAlias}`;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
public async run(upConfigurationId: number) {
|
|
205
|
+
const fullUrl = `${this.url}/set_up_configuration`;
|
|
206
|
+
|
|
207
|
+
const data = {
|
|
208
|
+
up_configuration_id: upConfigurationId
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
await this._page.request.post(fullUrl, { headers: { 'Content-Type': 'application/json; charset=utf-8' }, data });
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
public async disable(): Promise<APIResponse> {
|
|
215
|
+
const fullUrl = `${this.url}/disable_up`;
|
|
216
|
+
|
|
217
|
+
return await this._page.request.post(fullUrl, { headers: { 'Content-Type': 'application/json; charset=utf-8' } });
|
|
218
|
+
}
|
|
219
|
+
}
|
package/index.ts
CHANGED
|
@@ -12,7 +12,6 @@ console.warn = (...args: unknown[]) => logger.warn(args.join(' '));
|
|
|
12
12
|
console.error = (...args: unknown[]) => logger.error(args.join(' '));
|
|
13
13
|
console.debug = (...args: unknown[]) => logger.debug(args.join(' '));
|
|
14
14
|
|
|
15
|
-
export { originalLog, originalInfo, originalWarn, originalError, originalDebug };
|
|
16
15
|
export * from './artifact-builder/index.js';
|
|
17
16
|
export * from './components/index.js';
|
|
18
17
|
export * from './controls/index.js';
|
|
@@ -23,3 +22,4 @@ export * from './page-overrides/index.js';
|
|
|
23
22
|
export * from './services/index.js';
|
|
24
23
|
export * from './Testwise.js';
|
|
25
24
|
export * from './types/index.js';
|
|
25
|
+
export { originalDebug, originalError, originalInfo, originalLog, originalWarn };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thinkwise/testwise",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.67",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint ./ --cache --ignore-pattern .gitignore",
|
|
12
|
-
"format:fix": "
|
|
13
|
-
"format:check": "
|
|
12
|
+
"format:fix": "run-s \"lint --fix\" && biome check --fix --unsafe",
|
|
13
|
+
"format:check": "run-s \"lint \" && biome check",
|
|
14
14
|
"postinstall": "node scripts/main.js postinstall"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [],
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"description": "",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@thinkwise/backups": "^1.0.
|
|
21
|
+
"@thinkwise/backups": "^1.0.16",
|
|
22
22
|
"@types/node": "^22.15.29",
|
|
23
23
|
"axios": "^1.9.0",
|
|
24
24
|
"chalk": "^5.4.1",
|
|
@@ -37,10 +37,11 @@
|
|
|
37
37
|
"@playwright/test": "^1.56.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@biomejs/biome": "^2.
|
|
40
|
+
"@biomejs/biome": "^2.4.8",
|
|
41
41
|
"@eslint/js": "^9.28.0",
|
|
42
42
|
"eslint": "^9.39.2",
|
|
43
43
|
"eslint-plugin-playwright": "^2.2.0",
|
|
44
|
+
"npm-run-all": "^4.1.5",
|
|
44
45
|
"typescript-eslint": "^8.34.0"
|
|
45
46
|
},
|
|
46
47
|
"exports": {
|
|
@@ -2,6 +2,7 @@ import type { Page } from '@playwright/test';
|
|
|
2
2
|
import {
|
|
3
3
|
ExportComponent,
|
|
4
4
|
ListBarMenuComponent,
|
|
5
|
+
ManagePrefilterPopup,
|
|
5
6
|
PopUpComponent,
|
|
6
7
|
SnackBarComponent,
|
|
7
8
|
TopBarComponent
|
|
@@ -14,6 +15,7 @@ class GlobalComponents {
|
|
|
14
15
|
public snackBar: SnackBarComponent;
|
|
15
16
|
public topBar: TopBarComponent;
|
|
16
17
|
public listBarMenu: ListBarMenuComponent;
|
|
18
|
+
public managePrefilterPopup: ManagePrefilterPopup;
|
|
17
19
|
|
|
18
20
|
constructor(page: Page) {
|
|
19
21
|
this.popUp = new PopUpComponent(page);
|
|
@@ -21,6 +23,7 @@ class GlobalComponents {
|
|
|
21
23
|
this.snackBar = new SnackBarComponent(page);
|
|
22
24
|
this.topBar = new TopBarComponent(page);
|
|
23
25
|
this.listBarMenu = new ListBarMenuComponent(page);
|
|
26
|
+
this.managePrefilterPopup = new ManagePrefilterPopup(page);
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
29
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Locator } from '@playwright/test';
|
|
1
|
+
import type { Locator, Page } from '@playwright/test';
|
|
2
2
|
import { FlightTracker } from '../helpers/FlightTracker.js';
|
|
3
3
|
import { testwiseConfig } from '../services/ConfigBuilder.js';
|
|
4
4
|
import type { Test } from '../types/Test.js';
|
|
@@ -9,26 +9,41 @@ const continueOnError = testwiseConfig().get<boolean>('featureSettings.InflightR
|
|
|
9
9
|
|
|
10
10
|
export class ClickOverride {
|
|
11
11
|
private _test: Test;
|
|
12
|
+
private _page: Page | null = null;
|
|
12
13
|
private flightTracker: FlightTracker = new FlightTracker();
|
|
13
14
|
|
|
14
15
|
constructor(test: Test) {
|
|
15
16
|
this._test = test.extend({
|
|
16
17
|
page: async ({ page }, use) => {
|
|
18
|
+
this._page = page;
|
|
19
|
+
|
|
20
|
+
const isTrackable = (url: string, resourceType: string) => {
|
|
21
|
+
const lowerUrl = url.toLowerCase();
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
resourceType === 'xhr' &&
|
|
25
|
+
!lowerUrl.includes('/detect_change(') &&
|
|
26
|
+
!lowerUrl.includes('/set_gui_start_use_log_session') &&
|
|
27
|
+
!lowerUrl.includes('download_icon') &&
|
|
28
|
+
!lowerUrl.includes('download_list_bar_grp_icon') &&
|
|
29
|
+
!lowerUrl.includes('/badge()')
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
17
33
|
const overrideClickMethod = (locator: Locator): Locator => {
|
|
18
34
|
const originalClickMethod = locator.click.bind(locator);
|
|
19
35
|
|
|
20
36
|
page.on('request', (request) => {
|
|
21
|
-
if (request.
|
|
37
|
+
if (isTrackable(request.url(), request.resourceType())) {
|
|
22
38
|
this.flightTracker.requestsInFlight++;
|
|
23
39
|
}
|
|
24
40
|
});
|
|
25
41
|
|
|
26
42
|
page.on('response', (response) => {
|
|
27
|
-
if (response.request().
|
|
43
|
+
if (isTrackable(response.request().url(), response.request().resourceType())) {
|
|
28
44
|
if (this.flightTracker.requestsInFlight > 0) {
|
|
29
45
|
this.flightTracker.requestsInFlight--;
|
|
30
46
|
}
|
|
31
|
-
|
|
32
47
|
if (this.flightTracker.requestsInFlight === 0) {
|
|
33
48
|
this.flightTracker.eventEmitter.emit('idle');
|
|
34
49
|
}
|
|
@@ -42,75 +57,65 @@ export class ClickOverride {
|
|
|
42
57
|
await this.flightTracker.waitToContinue();
|
|
43
58
|
} catch (error) {
|
|
44
59
|
console.warn('Exception while waiting for inflight requests to finish:', error);
|
|
45
|
-
|
|
60
|
+
if (this._page) {
|
|
61
|
+
const inflightRequests = await this._page.evaluate(() => {
|
|
62
|
+
return performance
|
|
63
|
+
.getEntriesByType('resource')
|
|
64
|
+
.filter((entry) => {
|
|
65
|
+
const res = entry as PerformanceResourceTiming;
|
|
66
|
+
return (
|
|
67
|
+
res.initiatorType === 'xmlhttprequest' &&
|
|
68
|
+
!res.name.includes('/detect_change(') &&
|
|
69
|
+
!res.name.includes('/set_gui_start_use_log_session')
|
|
70
|
+
);
|
|
71
|
+
})
|
|
72
|
+
.map((entry) => (entry as PerformanceResourceTiming).name);
|
|
73
|
+
});
|
|
74
|
+
console.debug('Current inflight XHR requests:', inflightRequests);
|
|
75
|
+
}
|
|
46
76
|
if (!continueOnError) throw error;
|
|
47
77
|
}
|
|
48
78
|
}
|
|
79
|
+
return;
|
|
49
80
|
};
|
|
50
81
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const originalGetByLabelMethod = locator.getByLabel.bind(locator);
|
|
69
|
-
locator.getByLabel = (...args) => overrideClickMethod(originalGetByLabelMethod(...args));
|
|
70
|
-
|
|
71
|
-
const originalGetByRoleMethod = locator.getByRole.bind(locator);
|
|
72
|
-
locator.getByRole = (...args) => overrideClickMethod(originalGetByRoleMethod(...args));
|
|
73
|
-
|
|
74
|
-
const originalGetByPlaceholderMethod = locator.getByPlaceholder.bind(locator);
|
|
75
|
-
locator.getByPlaceholder = (...args) => overrideClickMethod(originalGetByPlaceholderMethod(...args));
|
|
76
|
-
|
|
77
|
-
const originalGetByTitleMethod = locator.getByTitle.bind(locator);
|
|
78
|
-
locator.getByTitle = (...args) => overrideClickMethod(originalGetByTitleMethod(...args));
|
|
82
|
+
const locatorMethods = [
|
|
83
|
+
'locator',
|
|
84
|
+
'filter',
|
|
85
|
+
'getByText',
|
|
86
|
+
'getByTestId',
|
|
87
|
+
'getByAltText',
|
|
88
|
+
'getByLabel',
|
|
89
|
+
'getByRole',
|
|
90
|
+
'getByPlaceholder',
|
|
91
|
+
'getByTitle'
|
|
92
|
+
] as const;
|
|
93
|
+
|
|
94
|
+
for (const method of locatorMethods) {
|
|
95
|
+
const original = (locator[method] as (...args: unknown[]) => Locator).bind(locator);
|
|
96
|
+
(locator as unknown as Record<string, (...args: unknown[]) => Locator>)[method] = (...args: unknown[]) =>
|
|
97
|
+
overrideClickMethod(original(...args));
|
|
98
|
+
}
|
|
79
99
|
|
|
80
100
|
return locator;
|
|
81
101
|
};
|
|
82
102
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
// Override the getByRole.click method
|
|
100
|
-
const originalGetByRole = page.getByRole.bind(page);
|
|
101
|
-
page.getByRole = (...args) => overrideClickMethod(originalGetByRole(...args));
|
|
102
|
-
|
|
103
|
-
// Override the getByPlaceholder.click method
|
|
104
|
-
const originalGetByPlaceholder = page.getByPlaceholder.bind(page);
|
|
105
|
-
page.getByPlaceholder = (...args) => overrideClickMethod(originalGetByPlaceholder(...args));
|
|
106
|
-
|
|
107
|
-
// Override the getByText.click method
|
|
108
|
-
const originalGetByText = page.getByText.bind(page);
|
|
109
|
-
page.getByText = (...args) => overrideClickMethod(originalGetByText(...args));
|
|
110
|
-
|
|
111
|
-
// Override the getByTitle.click method
|
|
112
|
-
const originalGetByTitle = page.getByTitle.bind(page);
|
|
113
|
-
page.getByTitle = (...args) => overrideClickMethod(originalGetByTitle(...args));
|
|
103
|
+
const rootMethods = [
|
|
104
|
+
'locator',
|
|
105
|
+
'getByTestId',
|
|
106
|
+
'getByAltText',
|
|
107
|
+
'getByLabel',
|
|
108
|
+
'getByRole',
|
|
109
|
+
'getByPlaceholder',
|
|
110
|
+
'getByText',
|
|
111
|
+
'getByTitle'
|
|
112
|
+
] as const;
|
|
113
|
+
|
|
114
|
+
for (const method of rootMethods) {
|
|
115
|
+
const original = (page[method] as (...args: unknown[]) => Locator).bind(page);
|
|
116
|
+
(page as unknown as Record<string, (...args: unknown[]) => Locator>)[method] = (...args: unknown[]) =>
|
|
117
|
+
overrideClickMethod(original(...args));
|
|
118
|
+
}
|
|
114
119
|
|
|
115
120
|
await use(page);
|
|
116
121
|
}
|