From c6be042acf49d1a2b0c127a703c763b69106a7fc Mon Sep 17 00:00:00 2001 From: William Johnson Date: Thu, 21 Oct 2021 15:49:22 -0400 Subject: [PATCH] (bento): refactor test to use existing shadow root utilities (#36454) --- test/e2e/test-bento.js | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/test/e2e/test-bento.js b/test/e2e/test-bento.js index c9499946daca..7abab6163a6a 100644 --- a/test/e2e/test-bento.js +++ b/test/e2e/test-bento.js @@ -10,22 +10,11 @@ describes.endtoend( // is attached as soon as possible. // (Feel free to increase if flaky.) this.timeout(100); - - const shadowRoot = await env.controller.evaluate( - () => - new Promise((resolve) => { - function getShadowRoot() { - const {shadowRoot} = document.body.firstElementChild; - if (shadowRoot) { - resolve(shadowRoot); - } else { - setTimeout(getShadowRoot, 15); - } - } - getShadowRoot(); - }) + await env.controller.switchToShadowRoot( + await env.controller.findElement('bento-timeago') ); - await expect(shadowRoot).ok; + + await expect(await env.controller.findElement('time')).ok; }); } );