Skip to content

Commit

Permalink
Make inspector-elements-05 test deterministic. Insert iframe dynamica…
Browse files Browse the repository at this point in the history
…lly. (#10323)

* Make inspector-elements-05 test deterministic. Insert iframe dynamically.

* Re-record doc_inspector_basic.html.
  • Loading branch information
klochek authored Feb 14, 2024
1 parent 7333d1c commit 87b3856
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/e2e-tests/examples.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/e2e-tests/tests/highlighter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test("highlighter: element highlighter works everywhere", async ({
await warpToMessage(page, "ExampleFinished");
await openElementsPanel(page);

await selectElementsListRow(page, { text: "myiframe" });
await selectElementsListRow(page, { text: 'iframe id="myiframe"', type: "opening" });

const highlighter = page.locator("#box-model-content");
await highlighter.waitFor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test(`inspector-elements-05_search: element picker and iframe behavior`, async (
await openElementsPanel(page);

// This search string should not match anything initially
await seekToTimePercent(page, 50);
await warpToMessage(page, "waiting for iframe");
await searchElementsPanel(page, "inner-body");
await verifySearchResults(page, { currentNumber: 0, totalNumber: 0 });

Expand Down
15 changes: 13 additions & 2 deletions public/test/examples/doc_inspector_basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@
console.log("iframeFinished");
window.setTimeout(foo);
}

function createIFrame() {
var iframe = document.createElement("iframe");
iframe.id = "myiframe";
iframe.src = "./iframe.html";
document.getElementById("iframehost").appendChild(iframe);
}

console.log("waiting for iframe");
window.setTimeout(createIFrame);

</script>
<div id="div1">
<div id="div2">
Expand All @@ -23,7 +34,8 @@
</div>
<div id="div4" some-attribute="STUFF"></div>
</div>
<iframe src="iframe.html" id="myiframe"></iframe>
<div id="iframehost">
</div>

<script>
function printCenter(id) {
Expand All @@ -41,6 +53,5 @@
}

printCenter("maindiv");
printCenter("myiframe");
</script>
</body>

0 comments on commit 87b3856

Please sign in to comment.