@shopware-ag/acceptance-test-suite 11.26.0 → 11.27.0
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/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +19 -23
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -3011,12 +3011,12 @@ declare function createRandomImage(width?: number, height?: number): Image;
|
|
|
3011
3011
|
*/
|
|
3012
3012
|
declare function hideElements(page: Page, selectors: (string | Locator)[]): Promise<void>;
|
|
3013
3013
|
/**
|
|
3014
|
-
* Replaces text content or input values of elements with
|
|
3014
|
+
* Replaces text content or input values of elements with a given replacement string (default: "***").
|
|
3015
3015
|
* - Works for inputs, textareas, contenteditables and generic elements.
|
|
3016
3016
|
* - Ensures frameworks see the change (dispatches input/change).
|
|
3017
|
-
* - Also masks placeholder so empty fields show
|
|
3017
|
+
* - Also masks placeholder so empty fields show replacement text in screenshots.
|
|
3018
3018
|
*/
|
|
3019
|
-
declare function replaceElements(page: Page, selectors: (string | Locator)[]): Promise<void>;
|
|
3019
|
+
declare function replaceElements(page: Page, selectors: (string | Locator)[], replaceWith?: string): Promise<void>;
|
|
3020
3020
|
/**
|
|
3021
3021
|
* Calculates the ideal viewport dimensions for a Playwright test based on scrollable content,
|
|
3022
3022
|
* header visibility, and optional configuration. Useful for dynamic screenshot sizing or
|
package/dist/index.d.ts
CHANGED
|
@@ -3011,12 +3011,12 @@ declare function createRandomImage(width?: number, height?: number): Image;
|
|
|
3011
3011
|
*/
|
|
3012
3012
|
declare function hideElements(page: Page, selectors: (string | Locator)[]): Promise<void>;
|
|
3013
3013
|
/**
|
|
3014
|
-
* Replaces text content or input values of elements with
|
|
3014
|
+
* Replaces text content or input values of elements with a given replacement string (default: "***").
|
|
3015
3015
|
* - Works for inputs, textareas, contenteditables and generic elements.
|
|
3016
3016
|
* - Ensures frameworks see the change (dispatches input/change).
|
|
3017
|
-
* - Also masks placeholder so empty fields show
|
|
3017
|
+
* - Also masks placeholder so empty fields show replacement text in screenshots.
|
|
3018
3018
|
*/
|
|
3019
|
-
declare function replaceElements(page: Page, selectors: (string | Locator)[]): Promise<void>;
|
|
3019
|
+
declare function replaceElements(page: Page, selectors: (string | Locator)[], replaceWith?: string): Promise<void>;
|
|
3020
3020
|
/**
|
|
3021
3021
|
* Calculates the ideal viewport dimensions for a Playwright test based on scrollable content,
|
|
3022
3022
|
* header visibility, and optional configuration. Useful for dynamic screenshot sizing or
|
package/dist/index.mjs
CHANGED
|
@@ -9154,7 +9154,7 @@ async function hideElements(page, selectors) {
|
|
|
9154
9154
|
}
|
|
9155
9155
|
);
|
|
9156
9156
|
}
|
|
9157
|
-
async function replaceElements(page, selectors) {
|
|
9157
|
+
async function replaceElements(page, selectors, replaceWith = "***") {
|
|
9158
9158
|
if (!selectors.length) {
|
|
9159
9159
|
console.warn(`[Error] No replaceable elements stated.`);
|
|
9160
9160
|
return;
|
|
@@ -9164,24 +9164,22 @@ async function replaceElements(page, selectors) {
|
|
|
9164
9164
|
selectors,
|
|
9165
9165
|
// String handler → replace text/value via querySelectorAll
|
|
9166
9166
|
async (page2, selectors2) => {
|
|
9167
|
-
await page2.evaluate((selectors3) => {
|
|
9167
|
+
await page2.evaluate(({ selectors: selectors3, replaceWith: replaceWith2 }) => {
|
|
9168
9168
|
const maskInputLike = (el) => {
|
|
9169
|
-
el.value =
|
|
9170
|
-
el.defaultValue =
|
|
9171
|
-
el.setAttribute("value",
|
|
9169
|
+
el.value = replaceWith2;
|
|
9170
|
+
el.defaultValue = replaceWith2;
|
|
9171
|
+
el.setAttribute("value", replaceWith2);
|
|
9172
9172
|
if ("placeholder" in el) {
|
|
9173
|
-
el.setAttribute("placeholder",
|
|
9173
|
+
el.setAttribute("placeholder", replaceWith2);
|
|
9174
9174
|
}
|
|
9175
9175
|
el.dispatchEvent(new Event("input", { bubbles: true }));
|
|
9176
9176
|
el.dispatchEvent(new Event("change", { bubbles: true }));
|
|
9177
9177
|
};
|
|
9178
9178
|
const maskGeneric = (el) => {
|
|
9179
|
+
el.textContent = replaceWith2;
|
|
9179
9180
|
if (el.isContentEditable) {
|
|
9180
|
-
el.textContent = "***";
|
|
9181
9181
|
el.dispatchEvent(new Event("input", { bubbles: true }));
|
|
9182
9182
|
el.dispatchEvent(new Event("change", { bubbles: true }));
|
|
9183
|
-
} else {
|
|
9184
|
-
el.textContent = "***";
|
|
9185
9183
|
}
|
|
9186
9184
|
};
|
|
9187
9185
|
selectors3.forEach((sel) => {
|
|
@@ -9194,21 +9192,21 @@ async function replaceElements(page, selectors) {
|
|
|
9194
9192
|
}
|
|
9195
9193
|
});
|
|
9196
9194
|
});
|
|
9197
|
-
}, selectors2);
|
|
9195
|
+
}, { selectors: selectors2, replaceWith });
|
|
9198
9196
|
},
|
|
9199
9197
|
// Locator handler → replace text/value directly
|
|
9200
9198
|
async (el) => {
|
|
9201
9199
|
try {
|
|
9202
9200
|
if (await el.isEditable()) {
|
|
9203
|
-
await el.fill(
|
|
9201
|
+
await el.fill(replaceWith, { force: true });
|
|
9204
9202
|
const handle2 = await el.elementHandle();
|
|
9205
9203
|
if (handle2) {
|
|
9206
|
-
await handle2.evaluate((node) => {
|
|
9204
|
+
await handle2.evaluate((node, replaceWith2) => {
|
|
9207
9205
|
if (node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement) {
|
|
9208
9206
|
if ("placeholder" in node)
|
|
9209
|
-
node.setAttribute("placeholder",
|
|
9207
|
+
node.setAttribute("placeholder", replaceWith2);
|
|
9210
9208
|
}
|
|
9211
|
-
});
|
|
9209
|
+
}, replaceWith);
|
|
9212
9210
|
}
|
|
9213
9211
|
return;
|
|
9214
9212
|
}
|
|
@@ -9217,24 +9215,22 @@ async function replaceElements(page, selectors) {
|
|
|
9217
9215
|
const handle = await el.elementHandle();
|
|
9218
9216
|
if (!handle)
|
|
9219
9217
|
return;
|
|
9220
|
-
await handle.evaluate((node) => {
|
|
9218
|
+
await handle.evaluate((node, replaceWith2) => {
|
|
9221
9219
|
const maskInputLike = (inp) => {
|
|
9222
|
-
inp.value =
|
|
9223
|
-
inp.defaultValue =
|
|
9224
|
-
inp.setAttribute("value",
|
|
9220
|
+
inp.value = replaceWith2;
|
|
9221
|
+
inp.defaultValue = replaceWith2;
|
|
9222
|
+
inp.setAttribute("value", replaceWith2);
|
|
9225
9223
|
if ("placeholder" in inp) {
|
|
9226
|
-
inp.setAttribute("placeholder",
|
|
9224
|
+
inp.setAttribute("placeholder", replaceWith2);
|
|
9227
9225
|
}
|
|
9228
9226
|
inp.dispatchEvent(new Event("input", { bubbles: true }));
|
|
9229
9227
|
inp.dispatchEvent(new Event("change", { bubbles: true }));
|
|
9230
9228
|
};
|
|
9231
9229
|
const maskGeneric = (el2) => {
|
|
9230
|
+
el2.textContent = replaceWith2;
|
|
9232
9231
|
if (el2.isContentEditable) {
|
|
9233
|
-
el2.textContent = "***";
|
|
9234
9232
|
el2.dispatchEvent(new Event("input", { bubbles: true }));
|
|
9235
9233
|
el2.dispatchEvent(new Event("change", { bubbles: true }));
|
|
9236
|
-
} else {
|
|
9237
|
-
el2.textContent = "***";
|
|
9238
9234
|
}
|
|
9239
9235
|
};
|
|
9240
9236
|
if (node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement) {
|
|
@@ -9242,7 +9238,7 @@ async function replaceElements(page, selectors) {
|
|
|
9242
9238
|
} else {
|
|
9243
9239
|
maskGeneric(node);
|
|
9244
9240
|
}
|
|
9245
|
-
});
|
|
9241
|
+
}, replaceWith);
|
|
9246
9242
|
}
|
|
9247
9243
|
);
|
|
9248
9244
|
}
|