Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: add a test for issue 28520 (#28552)

Dmitry Gozman532e4c58021c
diff --git a/tests/page/page-evaluate.spec.ts b/tests/page/page-evaluate.spec.ts
index 37aa0a6c8f..5e101f1b7a 100644
--- a/tests/page/page-evaluate.spec.ts
+++ b/tests/page/page-evaluate.spec.ts
@@ -769,3 +769,11 @@ it('should expose utilityScript', async ({ page }) => {
utils: true,
});
});
+
+it('should work with Array.from/map', async ({ page }) => {
+ it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/28520' });
+ expect(await page.evaluate(() => {
+ const r = (str, amount) => Array.from(Array(amount)).map(() => str).join('');
+ return r('([a-f0-9]{2})', 3);
+ })).toBe('([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})');
+});