Skip to content

Commit 0c843f8

Browse files
authored
fix(testing): re-add Puppeteer asElement() calls (#5114)
Fixes a regression caused by the removal of a few `asElement()` calls in 91cfa2c. Turns out these are necessary for the case where the handle is `null`. To avoid type errors, we cast the returned value to be of type `ElementHandle<Element>` rather than `ElementHandle<Node`. STENCIL-1032: `E2EPage.find()` throws error when using piercing selector targeting a non-existing element Fixes: #5113
1 parent 7219441 commit 0c843f8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/testing/puppeteer/puppeteer-element.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ async function findWithCssSelector(
593593
return null;
594594
}
595595

596-
elmHandle = shadowHandle;
596+
elmHandle = shadowHandle.asElement() as puppeteer.ElementHandle<Element>;
597597
}
598598

599599
return elmHandle;
@@ -646,7 +646,7 @@ async function findWithText(
646646
);
647647

648648
if (jsHandle) {
649-
return jsHandle;
649+
return jsHandle.asElement() as puppeteer.ElementHandle<Element>;
650650
}
651651

652652
return null;

0 commit comments

Comments
 (0)