chore: flip test (#11707)

This commit is contained in:
Nikolay Vitkov 2024-01-22 10:13:53 +01:00 committed by GitHub
parent 76da4e6479
commit 280249ff2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 9 deletions

View File

@ -497,12 +497,6 @@
"parameters": ["webDriverBiDi"], "parameters": ["webDriverBiDi"],
"expectations": ["PASS"] "expectations": ["PASS"]
}, },
{
"testIdPattern": "[evaluation.spec] Evaluation specs Page.evaluate should fail for circular object",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["FAIL"]
},
{ {
"testIdPattern": "[evaluation.spec] Evaluation specs Page.evaluate should replace symbols with undefined", "testIdPattern": "[evaluation.spec] Evaluation specs Page.evaluate should replace symbols with undefined",
"platforms": ["darwin", "linux", "win32"], "platforms": ["darwin", "linux", "win32"],
@ -515,6 +509,12 @@
"parameters": ["cdp"], "parameters": ["cdp"],
"expectations": ["FAIL"] "expectations": ["FAIL"]
}, },
{
"testIdPattern": "[evaluation.spec] Evaluation specs Page.evaluate should work for circular object",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp"],
"expectations": ["FAIL"]
},
{ {
"testIdPattern": "[evaluation.spec] Evaluation specs Page.evaluateOnNewDocument *", "testIdPattern": "[evaluation.spec] Evaluation specs Page.evaluateOnNewDocument *",
"platforms": ["darwin", "linux", "win32"], "platforms": ["darwin", "linux", "win32"],

View File

@ -324,16 +324,29 @@ describe('Evaluation specs', function () {
promise: {}, promise: {},
}); });
}); });
it('should fail for circular object', async () => { it('should work for circular object', async () => {
const {page} = await getTestState(); const {page} = await getTestState();
const result = await page.evaluate(() => { const result = await page.evaluate(() => {
const a: Record<string, unknown> = {}; const a: Record<string, unknown> = {
c: 5,
d: {
foo: 'bar',
},
};
const b = {a}; const b = {a};
a['b'] = b; a['b'] = b;
return a; return a;
}); });
expect(result).toBe(undefined); expect(result).toMatchObject({
c: 5,
d: {
foo: 'bar',
},
b: {
a: undefined,
},
});
}); });
it('should accept a string', async () => { it('should accept a string', async () => {
const {page} = await getTestState(); const {page} = await getTestState();