test: change test for BrowserContext (#12321)

This commit is contained in:
Nikolay Vitkov 2024-04-24 13:40:42 +02:00 committed by GitHub
parent c9a5644c65
commit 97637036c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 61 additions and 58 deletions

View File

@ -202,55 +202,6 @@
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[browsercontext.spec] *",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should be prompt by default",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext should close all belonging targets once closing context",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext should create new incognito context",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext should have default context",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext should timeout waiting for a non-existent target",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext should wait for a target",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext window.open should use parent tab context",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[CDPSession.spec] Target.createCDPSession *",
"platforms": ["darwin", "linux", "win32"],
@ -1001,10 +952,11 @@
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should fail when bad permission is given",
"testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should deny permission when not listed",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["PASS"]
"expectations": ["FAIL"],
"comment": "Firefox does not have support for the Permissions BiDi extension yet"
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should grant permission when listed",
@ -1013,6 +965,13 @@
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should grant permission when listed",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "Firefox does not have support for the Permissions BiDi extension yet"
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should grant persistent-storage",
"platforms": ["darwin", "linux", "win32"],
@ -1020,6 +979,13 @@
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should grant persistent-storage",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "Firefox does not have support for the Permissions BiDi extension yet"
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should isolate permissions between browser contexts",
"platforms": ["darwin", "linux", "win32"],
@ -1027,6 +993,13 @@
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should isolate permissions between browser contexts",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "Firefox does not have support for the Permissions BiDi extension yet"
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should reset permissions",
"platforms": ["darwin", "linux", "win32"],
@ -1034,12 +1007,26 @@
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should reset permissions",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "Firefox does not have support for the Permissions BiDi extension yet"
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should trigger permission onchange",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "firefox"],
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should trigger permission onchange",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "firefox"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
"comment": "Firefox does not have support for the Permissions BiDi extension yet"
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext should fire target events",
@ -1055,6 +1042,13 @@
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext should fire target events",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "In BiDi currently more events than needed are fired (because target is updated more often). We probably need to adjust the test as the behavior is not broken per se"
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext should wait for a target",
"platforms": ["darwin", "linux", "win32"],
@ -1069,6 +1063,13 @@
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext should work across sessions",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "Firefox does not support multiple connection at this time"
},
{
"testIdPattern": "[CDPSession.spec] Target.createCDPSession should be able to detach session",
"platforms": ["darwin", "linux", "win32"],

View File

@ -155,6 +155,7 @@ describe('BrowserContext', function () {
skipContextCreation: true,
});
const contextCount = browser.browserContexts().length;
// Create two incognito contexts.
const context1 = await browser.createBrowserContext();
const context2 = await browser.createBrowserContext();
@ -209,7 +210,7 @@ describe('BrowserContext', function () {
// Cleanup contexts.
await Promise.all([context1.close(), context2.close()]);
expect(browser.browserContexts()).toHaveLength(1);
expect(browser.browserContexts()).toHaveLength(contextCount);
});
it('should work across sessions', async () => {
@ -238,12 +239,13 @@ describe('BrowserContext', function () {
skipContextCreation: true,
});
expect(browser.browserContexts()).toHaveLength(1);
expect(browser.browserContexts()[0]!.id).toBeUndefined();
const contextCount = browser.browserContexts().length;
expect(contextCount).toBeGreaterThanOrEqual(1);
const context = await browser.createBrowserContext();
expect(browser.browserContexts()).toHaveLength(2);
expect(browser.browserContexts()[1]!.id).toBeDefined();
expect(browser.browserContexts()).toHaveLength(contextCount + 1);
expect(context.id).toBeDefined();
await context.close();
});