Skip to content

Commit

Permalink
fix(testing): don't remove request interceptor
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed May 11, 2020
1 parent 5c29758 commit 8a18112
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/testing/puppeteer/puppeteer-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ async function e2eSetContent(page: E2EPageInternal, html: string, options: puppe
const pageUrl = env.__STENCIL_BROWSER_URL__;

await page.setRequestInterception(true);

const interceptedReqCallback = (interceptedRequest: any) => {
if (pageUrl === interceptedRequest.url()) {
interceptedRequest.respond({
Expand All @@ -255,8 +255,6 @@ async function e2eSetContent(page: E2EPageInternal, html: string, options: puppe

await waitForStencil(page);

page.removeListener('request', interceptedReqCallback);

return rsp;
}

Expand Down Expand Up @@ -305,8 +303,11 @@ async function waitForChanges(page: E2EPageInternal) {
requestAnimationFrame(() => {
const promises: Promise<any>[] = [];

const waitComponentOnReady = (elm: Element, promises: Promise<any>[]) => {
const waitComponentOnReady = (elm: Element | ShadowRoot, promises: Promise<any>[]) => {
if (elm != null) {
if ('shadowRoot' in elm && elm.shadowRoot instanceof ShadowRoot) {
waitComponentOnReady(elm.shadowRoot, promises);
}
const children = elm.children;
const len = children.length;
for (let i = 0; i < len; i++) {
Expand Down

0 comments on commit 8a18112

Please sign in to comment.