@bigbinary/neeto-playwright-commons 2.0.1 → 2.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/index.cjs.js +14 -5
- package/index.cjs.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +14 -5
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -6097,6 +6097,7 @@ declare const COMMON_SELECTORS: {
|
|
|
6097
6097
|
profileSidebar: string;
|
|
6098
6098
|
selectOption: (label: string) => string;
|
|
6099
6099
|
radioLabel: (embedLabel: string) => string;
|
|
6100
|
+
neetoUiToastr: string;
|
|
6100
6101
|
toastMessage: (type: string) => string;
|
|
6101
6102
|
toastCloseButton: string;
|
|
6102
6103
|
windowAlert: string;
|
package/index.js
CHANGED
|
@@ -4874,6 +4874,7 @@ const COMMON_SELECTORS = {
|
|
|
4874
4874
|
profileSidebar: "profile-section",
|
|
4875
4875
|
selectOption: (label) => `${hyphenate(label)}-select-option`,
|
|
4876
4876
|
radioLabel: (embedLabel) => `${hyphenate(embedLabel)}-radio-label`,
|
|
4877
|
+
neetoUiToastr: ".Toastify__toast", // TODO: Replace this with ".neeto-ui-toastr"
|
|
4877
4878
|
toastMessage: (type) => `toastr-${type}-container`,
|
|
4878
4879
|
toastCloseButton: "toastr-close-button",
|
|
4879
4880
|
windowAlert: "#alert-box",
|
|
@@ -5922,11 +5923,19 @@ class CustomCommands {
|
|
|
5922
5923
|
return await this.recursiveMethod(callback, condition, timeout, startTime, 1);
|
|
5923
5924
|
};
|
|
5924
5925
|
verifyToast = async ({ message = "", toastType = "success", closeAfterVerification = true, timeout = 10_000, customPageContext = this.page, } = {}) => {
|
|
5925
|
-
|
|
5926
|
-
const toastrLocator =
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5926
|
+
// React-toastify does not support adding data-* attributes to toast DOM elements: https://github.com/fkhadra/react-toastify/issues/1106
|
|
5927
|
+
const toastrLocator = customPageContext
|
|
5928
|
+
.locator(COMMON_SELECTORS.neetoUiToastr)
|
|
5929
|
+
.filter({
|
|
5930
|
+
has: customPageContext.getByTestId(COMMON_SELECTORS.toastMessage(toastType)),
|
|
5931
|
+
});
|
|
5932
|
+
const filteredToastrLocator = (isEmpty(message)
|
|
5933
|
+
? toastrLocator
|
|
5934
|
+
: toastrLocator.filter({ hasText: message }))
|
|
5935
|
+
// eslint-disable-next-line playwright/no-nth-methods
|
|
5936
|
+
.first();
|
|
5937
|
+
await expect(filteredToastrLocator).toContainText(isEmpty(message) ? "👍" : message, { timeout });
|
|
5938
|
+
const toastrCloseButton = filteredToastrLocator.getByTestId(COMMON_SELECTORS.toastCloseButton);
|
|
5930
5939
|
if (!closeAfterVerification && (await toastrCloseButton.isHidden()))
|
|
5931
5940
|
return;
|
|
5932
5941
|
const buttonHandle = await toastrCloseButton.elementHandle();
|