@axinom/mosaic-e2e-page-model 0.5.3-rc.9 → 0.6.0-rc.1
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/dist/ui-selectors/toast-notifications.d.ts +48 -0
- package/dist/ui-selectors/toast-notifications.d.ts.map +1 -0
- package/dist/ui-selectors/toast-notifications.js +68 -0
- package/dist/ui-selectors/toast-notifications.js.map +1 -0
- package/dist/ui-selectors/ui-shell-model.d.ts +3 -0
- package/dist/ui-selectors/ui-shell-model.d.ts.map +1 -1
- package/dist/ui-selectors/ui-shell-model.js +3 -0
- package/dist/ui-selectors/ui-shell-model.js.map +1 -1
- package/package.json +3 -3
- package/src/ui-selectors/toast-notifications.ts +73 -0
- package/src/ui-selectors/ui-shell-model.ts +4 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ComponentModel } from '@axinom/mosaic-e2e-ui-selectors';
|
|
2
|
+
import { FrameLocator, Locator, Page } from 'playwright-core';
|
|
3
|
+
/**
|
|
4
|
+
* A model for a toast notifications
|
|
5
|
+
* with methods to get individual toast messages.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Notifications extends ComponentModel {
|
|
8
|
+
/**
|
|
9
|
+
* A model for the toast notifications.
|
|
10
|
+
* @param parent The parent playwright page, frame or component model.
|
|
11
|
+
* @param xpath A relative xpath selector to this element from the parent.
|
|
12
|
+
*/
|
|
13
|
+
constructor(parent: Page | FrameLocator, xpath?: string);
|
|
14
|
+
/**
|
|
15
|
+
* This method gets a visible notification by position.
|
|
16
|
+
* Position 1 is the first notification.
|
|
17
|
+
* Negative numbers count from the end.
|
|
18
|
+
* @param position The position of the notification.
|
|
19
|
+
* @returns A model for the notification.
|
|
20
|
+
*/
|
|
21
|
+
getNotification(position?: number): Notification;
|
|
22
|
+
/**
|
|
23
|
+
* This method gets a visible notification by title.
|
|
24
|
+
* @param title A title of the notification.
|
|
25
|
+
* @returns A model for the notification.
|
|
26
|
+
*/
|
|
27
|
+
getNotificationByTitle(title: string): Notification;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A model for individual toast notification message
|
|
31
|
+
*/
|
|
32
|
+
export declare class Notification extends ComponentModel {
|
|
33
|
+
message: Locator;
|
|
34
|
+
/**
|
|
35
|
+
* @returns A locator to the notification message title.
|
|
36
|
+
*/
|
|
37
|
+
getNotificationTitle(): Locator;
|
|
38
|
+
/**
|
|
39
|
+
* @returns A locator to the notification message body.
|
|
40
|
+
*/
|
|
41
|
+
getNotificationBody(): Locator;
|
|
42
|
+
/**
|
|
43
|
+
* This method closes the notification.
|
|
44
|
+
* @returns a promise that resolves when the notification is removed from the DOM.
|
|
45
|
+
*/
|
|
46
|
+
closeToast(): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=toast-notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-notifications.d.ts","sourceRoot":"","sources":["../../src/ui-selectors/toast-notifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE9D;;;GAGG;AACH,qBAAa,aAAc,SAAQ,cAAc;IAC/C;;;;OAIG;gBAED,MAAM,EAAE,IAAI,GAAG,YAAY,EAC3B,KAAK,SAA4C;IAKnD;;;;;;OAMG;IACH,eAAe,CAAC,QAAQ,SAAI,GAAG,YAAY;IAI3C;;;;OAIG;IACH,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;CAMpD;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,cAAc;IAC9C,OAAO,EAAE,OAAO,CAAuB;IAEvC;;OAEG;IACH,oBAAoB,IAAI,OAAO;IAI/B;;OAEG;IACH,mBAAmB,IAAI,OAAO;IAI9B;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAIlC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Notification = exports.Notifications = void 0;
|
|
4
|
+
const mosaic_e2e_ui_selectors_1 = require("@axinom/mosaic-e2e-ui-selectors");
|
|
5
|
+
/**
|
|
6
|
+
* A model for a toast notifications
|
|
7
|
+
* with methods to get individual toast messages.
|
|
8
|
+
*/
|
|
9
|
+
class Notifications extends mosaic_e2e_ui_selectors_1.ComponentModel {
|
|
10
|
+
/**
|
|
11
|
+
* A model for the toast notifications.
|
|
12
|
+
* @param parent The parent playwright page, frame or component model.
|
|
13
|
+
* @param xpath A relative xpath selector to this element from the parent.
|
|
14
|
+
*/
|
|
15
|
+
constructor(parent, xpath = '//*[@data-test-id="toast-notification"]') {
|
|
16
|
+
super(parent, xpath);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* This method gets a visible notification by position.
|
|
20
|
+
* Position 1 is the first notification.
|
|
21
|
+
* Negative numbers count from the end.
|
|
22
|
+
* @param position The position of the notification.
|
|
23
|
+
* @returns A model for the notification.
|
|
24
|
+
*/
|
|
25
|
+
getNotification(position = 1) {
|
|
26
|
+
return new Notification(this, ``, position);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* This method gets a visible notification by title.
|
|
30
|
+
* @param title A title of the notification.
|
|
31
|
+
* @returns A model for the notification.
|
|
32
|
+
*/
|
|
33
|
+
getNotificationByTitle(title) {
|
|
34
|
+
return new Notification(this, `[.//*[@data-test-id="toast-title" and text()="${title}"]]`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.Notifications = Notifications;
|
|
38
|
+
/**
|
|
39
|
+
* A model for individual toast notification message
|
|
40
|
+
*/
|
|
41
|
+
class Notification extends mosaic_e2e_ui_selectors_1.ComponentModel {
|
|
42
|
+
constructor() {
|
|
43
|
+
super(...arguments);
|
|
44
|
+
this.message = this.getLocator(``);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @returns A locator to the notification message title.
|
|
48
|
+
*/
|
|
49
|
+
getNotificationTitle() {
|
|
50
|
+
return this.getLocator(`//*[@data-test-id="toast-title"]`);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @returns A locator to the notification message body.
|
|
54
|
+
*/
|
|
55
|
+
getNotificationBody() {
|
|
56
|
+
return this.getLocator(`//*[@data-test-id="toast-body"]`);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* This method closes the notification.
|
|
60
|
+
* @returns a promise that resolves when the notification is removed from the DOM.
|
|
61
|
+
*/
|
|
62
|
+
async closeToast() {
|
|
63
|
+
await this.getLocator(`//*[@data-test-id="toast-close"]`).click();
|
|
64
|
+
return this.message.waitFor({ state: 'detached' });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.Notification = Notification;
|
|
68
|
+
//# sourceMappingURL=toast-notifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-notifications.js","sourceRoot":"","sources":["../../src/ui-selectors/toast-notifications.ts"],"names":[],"mappings":";;;AAAA,6EAAiE;AAGjE;;;GAGG;AACH,MAAa,aAAc,SAAQ,wCAAc;IAC/C;;;;OAIG;IACH,YACE,MAA2B,EAC3B,KAAK,GAAG,yCAAyC;QAEjD,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACvB,CAAC;IAED;;;;;;OAMG;IACH,eAAe,CAAC,QAAQ,GAAG,CAAC;QAC1B,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACH,sBAAsB,CAAC,KAAa;QAClC,OAAO,IAAI,YAAY,CACrB,IAAI,EACJ,iDAAiD,KAAK,KAAK,CAC5D,CAAC;IACJ,CAAC;CACF;AAnCD,sCAmCC;AAED;;GAEG;AACH,MAAa,YAAa,SAAQ,wCAAc;IAAhD;;QACE,YAAO,GAAY,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IAwBzC,CAAC;IAtBC;;OAEG;IACH,oBAAoB;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,mBAAmB;QACjB,OAAO,IAAI,CAAC,UAAU,CAAC,iCAAiC,CAAC,CAAC;IAC5D,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC,KAAK,EAAE,CAAC;QAClE,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;IACrD,CAAC;CACF;AAzBD,oCAyBC"}
|
|
@@ -2,6 +2,7 @@ import { Hub, LandingPageHeader, LandingPageTiles, PageHeader } from '@axinom/mo
|
|
|
2
2
|
import { Page } from 'playwright-core';
|
|
3
3
|
import { Breadcrumbs } from './breadcrumbs';
|
|
4
4
|
import { NavigationPanel } from './navigation-panel';
|
|
5
|
+
import { Notifications } from './toast-notifications';
|
|
5
6
|
/**
|
|
6
7
|
* A model representing the Mosaic UI including methods for navigation.
|
|
7
8
|
* This model should be used for page and UI components which are provided by Mosaic as a service.
|
|
@@ -30,6 +31,8 @@ export declare class UiShellModel {
|
|
|
30
31
|
readonly settingsPageHub: Hub;
|
|
31
32
|
/** A model for navigation panel */
|
|
32
33
|
readonly navigationPanel: NavigationPanel;
|
|
34
|
+
/** A model for toast notifications */
|
|
35
|
+
readonly notifications: Notifications;
|
|
33
36
|
/**
|
|
34
37
|
* This method navigates to the landing page breadcrumb.
|
|
35
38
|
* The management system must be loaded & signed in before using this method.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-shell-model.d.ts","sourceRoot":"","sources":["../../src/ui-selectors/ui-shell-model.ts"],"names":[],"mappings":"AACA,OAAO,EACL,GA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;;;;;OAOG;IACG,2BAA2B,IAAI,OAAO,CAAC,IAAI,CAAC;IAMlD;;;;;;;;OAQG;IACG,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB7D;;;;;;;;;;;OAWG;IACG,sBAAsB,CAC1B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC;IAIhB;;;;;;;;;;;;OAYG;IACG,+BAA+B,CACnC,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC;IAIhB;;;;;;;;;;;;;OAaG;IACG,uBAAuB,CAC3B,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC;IAuBhB;;;;;;;;;;;;OAYG;IACG,gCAAgC,CACpC,UAAU,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC;IAuBhB;;;;;;;;;;;;;OAaG;IACH,IAAI,qBAAqB,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAmBpE;YAEa,qBAAqB;CAWpC"}
|
|
@@ -5,6 +5,7 @@ exports.UiShellModel = void 0;
|
|
|
5
5
|
const mosaic_e2e_ui_selectors_1 = require("@axinom/mosaic-e2e-ui-selectors");
|
|
6
6
|
const breadcrumbs_1 = require("./breadcrumbs");
|
|
7
7
|
const navigation_panel_1 = require("./navigation-panel");
|
|
8
|
+
const toast_notifications_1 = require("./toast-notifications");
|
|
8
9
|
/**
|
|
9
10
|
* A model representing the Mosaic UI including methods for navigation.
|
|
10
11
|
* This model should be used for page and UI components which are provided by Mosaic as a service.
|
|
@@ -32,6 +33,8 @@ class UiShellModel {
|
|
|
32
33
|
this.settingsPageHub = new mosaic_e2e_ui_selectors_1.Hub(this.page);
|
|
33
34
|
/** A model for navigation panel */
|
|
34
35
|
this.navigationPanel = new navigation_panel_1.NavigationPanel(this.page);
|
|
36
|
+
/** A model for toast notifications */
|
|
37
|
+
this.notifications = new toast_notifications_1.Notifications(this.page);
|
|
35
38
|
}
|
|
36
39
|
/**
|
|
37
40
|
* This method navigates to the landing page breadcrumb.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-shell-model.js","sourceRoot":"","sources":["../../src/ui-selectors/ui-shell-model.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD,6EAKyC;AAEzC,+CAA4C;AAC5C,yDAAqD;
|
|
1
|
+
{"version":3,"file":"ui-shell-model.js","sourceRoot":"","sources":["../../src/ui-selectors/ui-shell-model.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD,6EAKyC;AAEzC,+CAA4C;AAC5C,yDAAqD;AACrD,+DAAsD;AAEtD;;;;;;;;;GASG;AACH,MAAa,YAAY;IACvB;IACE,kCAAkC;IACf,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;QAG/B,uCAAuC;QAC9B,gBAAW,GAAG,IAAI,yBAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAElD,kDAAkD;QACzC,sBAAiB,GAAG,IAAI,2CAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9D,0CAA0C;QACjC,qBAAgB,GAAG,IAAI,0CAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE5D,4CAA4C;QACnC,uBAAkB,GAAG,IAAI,oCAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAExD,qDAAqD;QAC5C,oBAAe,GAAG,IAAI,6BAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9C,mCAAmC;QAC1B,oBAAe,GAAG,IAAI,kCAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE1D,sCAAsC;QAC7B,kBAAa,GAAG,IAAI,mCAAa,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,wGAAwG;QACxG,OAAO,KAAK,EAAE,OAAqB,EAAiB,EAAE;YACpD,uCAAuC;YACvC,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;QAC7C,CAAC,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,qBAAqB;QACjC,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CACxC,4CAA4C,CAC7C,CAAC;QAEF,sEAAsE;QACtE,IAAI,MAAM,gBAAgB,CAAC,SAAS,EAAE,EAAE;YACtC,gBAAgB,CAAC,KAAK,EAAE,CAAC;YACzB,MAAM,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;SAChE;IACH,CAAC;CACF;AAzQD,oCAyQC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axinom/mosaic-e2e-page-model",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-rc.1",
|
|
4
4
|
"description": "A page model for testing an Axinom Mosaic Management System with Playwright.",
|
|
5
5
|
"author": "Axinom",
|
|
6
6
|
"license": "PROPRIETARY",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dev": "tsc -w"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@axinom/mosaic-e2e-ui-selectors": "^0.5.3-rc.
|
|
25
|
+
"@axinom/mosaic-e2e-ui-selectors": "^0.5.3-rc.12"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^18.11.18",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "bd66b60f4dba6ddbf0c94c3b632a4baffbefb13c"
|
|
39
39
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ComponentModel } from '@axinom/mosaic-e2e-ui-selectors';
|
|
2
|
+
import { FrameLocator, Locator, Page } from 'playwright-core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A model for a toast notifications
|
|
6
|
+
* with methods to get individual toast messages.
|
|
7
|
+
*/
|
|
8
|
+
export class Notifications extends ComponentModel {
|
|
9
|
+
/**
|
|
10
|
+
* A model for the toast notifications.
|
|
11
|
+
* @param parent The parent playwright page, frame or component model.
|
|
12
|
+
* @param xpath A relative xpath selector to this element from the parent.
|
|
13
|
+
*/
|
|
14
|
+
constructor(
|
|
15
|
+
parent: Page | FrameLocator,
|
|
16
|
+
xpath = '//*[@data-test-id="toast-notification"]',
|
|
17
|
+
) {
|
|
18
|
+
super(parent, xpath);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* This method gets a visible notification by position.
|
|
23
|
+
* Position 1 is the first notification.
|
|
24
|
+
* Negative numbers count from the end.
|
|
25
|
+
* @param position The position of the notification.
|
|
26
|
+
* @returns A model for the notification.
|
|
27
|
+
*/
|
|
28
|
+
getNotification(position = 1): Notification {
|
|
29
|
+
return new Notification(this, ``, position);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* This method gets a visible notification by title.
|
|
34
|
+
* @param title A title of the notification.
|
|
35
|
+
* @returns A model for the notification.
|
|
36
|
+
*/
|
|
37
|
+
getNotificationByTitle(title: string): Notification {
|
|
38
|
+
return new Notification(
|
|
39
|
+
this,
|
|
40
|
+
`[.//*[@data-test-id="toast-title" and text()="${title}"]]`,
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A model for individual toast notification message
|
|
47
|
+
*/
|
|
48
|
+
export class Notification extends ComponentModel {
|
|
49
|
+
message: Locator = this.getLocator(``);
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @returns A locator to the notification message title.
|
|
53
|
+
*/
|
|
54
|
+
getNotificationTitle(): Locator {
|
|
55
|
+
return this.getLocator(`//*[@data-test-id="toast-title"]`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @returns A locator to the notification message body.
|
|
60
|
+
*/
|
|
61
|
+
getNotificationBody(): Locator {
|
|
62
|
+
return this.getLocator(`//*[@data-test-id="toast-body"]`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* This method closes the notification.
|
|
67
|
+
* @returns a promise that resolves when the notification is removed from the DOM.
|
|
68
|
+
*/
|
|
69
|
+
async closeToast(): Promise<void> {
|
|
70
|
+
await this.getLocator(`//*[@data-test-id="toast-close"]`).click();
|
|
71
|
+
return this.message.waitFor({ state: 'detached' });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import { Page } from 'playwright-core';
|
|
9
9
|
import { Breadcrumbs } from './breadcrumbs';
|
|
10
10
|
import { NavigationPanel } from './navigation-panel';
|
|
11
|
+
import { Notifications } from './toast-notifications';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* A model representing the Mosaic UI including methods for navigation.
|
|
@@ -43,6 +44,9 @@ export class UiShellModel {
|
|
|
43
44
|
/** A model for navigation panel */
|
|
44
45
|
readonly navigationPanel = new NavigationPanel(this.page);
|
|
45
46
|
|
|
47
|
+
/** A model for toast notifications */
|
|
48
|
+
readonly notifications = new Notifications(this.page);
|
|
49
|
+
|
|
46
50
|
/**
|
|
47
51
|
* This method navigates to the landing page breadcrumb.
|
|
48
52
|
* The management system must be loaded & signed in before using this method.
|