Skip to content

Commit

Permalink
test: change test for BrowserContext
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightning00Blade committed Apr 24, 2024
1 parent c9a5644 commit 0dd6cab
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 56 deletions.
124 changes: 73 additions & 51 deletions test/TestExpectations.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down Expand Up @@ -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",
Expand All @@ -1013,34 +965,69 @@
"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"],
"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 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"],
"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 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"],
"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 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": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "Firefox does not have support for the Permissions BiDi extension yet"
},
{
"testIdPattern": "[browsercontext.spec] BrowserContext should fire target events",
"platforms": ["darwin", "linux", "win32"],
Expand All @@ -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"],
Expand All @@ -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"],
Expand Down Expand Up @@ -1132,6 +1133,13 @@
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[click.spec] Page.click should click the button with deviceScaleFactor set",
"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": "[click.spec] Page.click should click the button with fixed position inside an iframe",
"platforms": ["darwin", "linux", "win32"],
Expand Down Expand Up @@ -1552,6 +1560,13 @@
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[emulation.spec] Emulation Page.viewport should load correct pictures when emulation dpr",
"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": "[emulation.spec] Emulation Page.viewport should support landscape emulation",
"platforms": ["darwin", "linux", "win32"],
Expand All @@ -1573,6 +1588,13 @@
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[emulation.spec] Emulation Page.viewport should update media queries when resoltion changes",
"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": "[evaluation.spec] Evaluation specs Page.evaluate should simulate a user gesture",
"platforms": ["darwin", "linux", "win32"],
Expand Down
12 changes: 7 additions & 5 deletions test/src/browsercontext.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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();
});

Expand Down

0 comments on commit 0dd6cab

Please sign in to comment.