Skip to content

Commit

Permalink
DRAFT: try to reproduce #620
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagowfx committed Apr 17, 2023
1 parent 4a5e67d commit 7b7408b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/bidiMapper/domains/context/browsingContextImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ export class BrowsingContextImpl {
});

// Remove context from the parent.
if (this.parentId !== null) {
const parent = this.#browsingContextStorage.getContext(this.parentId);
if (!this.isTopLevelContext()) {
const parent = this.#browsingContextStorage.getContext(this.parentId!);
parent.#children.delete(this.contextId);
}

Expand Down Expand Up @@ -273,9 +273,9 @@ export class BrowsingContextImpl {
}
this.#url = params.frame.url + (params.frame.urlFragment ?? '');

// At the point the page is initiated, all the nested iframes from the
// At the point the page is initialized, all the nested iframes from the
// previous page are detached and realms are destroyed.
// Remove context's children.
// Remove children from context.
await this.#deleteChildren();

// Remove all the already created realms.
Expand Down
29 changes: 26 additions & 3 deletions tests/test_browsing_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

import pytest
from anys import ANY_STR
from test_helpers import (ANY_TIMESTAMP, execute_command, get_tree, goto_url,
read_JSON_message, send_JSON_command, subscribe,
wait_for_event)
from test_helpers import (ANY_TIMESTAMP, AnyExtending, execute_command,
get_tree, goto_url, read_JSON_message,
send_JSON_command, subscribe, wait_for_event)


@pytest.mark.asyncio
Expand Down Expand Up @@ -732,6 +732,29 @@ async def test_browsingContext_navigateSameDocumentNavigation_waitComplete_navig
} == result


@pytest.mark.asyncio
async def test_browsingContext_logAfterNavigation(websocket, context_id, html):
await subscribe(websocket, "log.entryAdded")

await send_JSON_command(
websocket, {
"method": "browsingContext.navigate",
"params": {
"url": html("<script>console.log('mylog');</script>"),
"context": context_id,
"wait": "complete"
}
})

result = await wait_for_event(websocket, "log.entryAdded")
assert result == {
"method": "log.entryAdded",
"params": AnyExtending({
"text": "mylog",
})
}


@pytest.mark.asyncio
@pytest.mark.skip(reason="TODO: Not implemented yet.")
async def test_browsingContext_type_textTyped():
Expand Down

0 comments on commit 7b7408b

Please sign in to comment.