From 532e4c58021c5b6636c761c9ccb910e3bfd0a74c Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Fri, 8 Dec 2023 10:55:26 -0800 Subject: [PATCH] test: add a test for issue 28520 (#28552) References #28520. --- tests/page/page-evaluate.spec.ts | 8 ++++++++ 1 file changed, 8 insertions(+) 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})'); +});