From 24a133c35e7e8d74fc25decca3ace68bfd73427f Mon Sep 17 00:00:00 2001 From: Sashank Aryal <66688606+sashankaryal@users.noreply.github.com> Date: Fri, 4 Oct 2024 14:33:14 -0500 Subject: [PATCH] wait until buffering is done (#4892) --- e2e-pw/src/oss/poms/modal/imavid-controls.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/e2e-pw/src/oss/poms/modal/imavid-controls.ts b/e2e-pw/src/oss/poms/modal/imavid-controls.ts index acc7af3f25..81228ef68b 100644 --- a/e2e-pw/src/oss/poms/modal/imavid-controls.ts +++ b/e2e-pw/src/oss/poms/modal/imavid-controls.ts @@ -32,10 +32,22 @@ export class ModalImaAsVideoControlsPom { return timelineId; } + private async waitUntilBufferingIsFinished() { + await this.page.waitForFunction( + () => + document + .querySelector("[data-cy=imavid-playhead]") + ?.getAttribute("data-playhead-state") !== "buffering" + ); + } + private async togglePlay() { + await this.waitUntilBufferingIsFinished(); + let currentPlayHeadStatus = await this.playPauseButton.getAttribute( "data-playhead-state" ); + const original = currentPlayHeadStatus; // keep pressing space until play head status changes