Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
test: toJSON property for Arrays after evaluation in FF (#7016)
Max Schmitt5157f74bcc7e
diff --git a/tests/page/page-evaluate.spec.ts b/tests/page/page-evaluate.spec.tsindex c5e41cfae7..9b575d001c 100644--- a/tests/page/page-evaluate.spec.ts+++ b/tests/page/page-evaluate.spec.ts@@ -548,7 +548,7 @@ it('should not use toJSON when evaluating', async ({ page }) => {expect(result).toEqual({ data: 'data', toJSON: {} });});-it('should not use Array.prototype.toJSON when evaluating', async ({ page, browserName }) => {+it('should not use Array.prototype.toJSON when evaluating', async ({ page }) => {const result = await page.evaluate(() => {(Array.prototype as any).toJSON = () => 'busted';return [1, 2, 3];@@ -556,6 +556,13 @@ it('should not use Array.prototype.toJSON when evaluating', async ({ page, browsexpect(result).toEqual([1,2,3]);});+it('should not add a toJSON property to newly created Arrays after evaluation', async ({ page, browserName }) => {+ it.fixme(browserName === 'firefox')+ await page.evaluate(() => []);+ const hasToJSONProperty = await page.evaluate(() => "toJSON" in []);+ expect(hasToJSONProperty).toEqual(false);+});+it('should not use toJSON in jsonValue', async ({ page }) => {const resultHandle = await page.evaluateHandle(() => ({ toJSON: () => 'string', data: 'data' }));expect(await resultHandle.jsonValue()).toEqual({ data: 'data', toJSON: {} });