diff options
-rw-r--r-- | test/selenium.test.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/selenium.test.ts b/test/selenium.test.ts index f87e92cf..f06de269 100644 --- a/test/selenium.test.ts +++ b/test/selenium.test.ts @@ -24,6 +24,8 @@ test("Selenium Chrome test", async () => { await createSegment(driver, "4", "10.33", "0:04.000 to 0:10.330"); await editSegments(driver, 0, "0:04.000", "0:10.330", "5", "13.211", "0:05.000 to 0:13.211", false); + + await skipSegment(driver, 5, 13.211); } finally { await driver.quit(); } @@ -85,4 +87,16 @@ async function editSegments(driver: WebDriver, index: number, expectedStartTimeB sponsorTimeDisplays = await driver.findElements(By.className("sponsorTimeDisplay")); sponsorTimeDisplay = sponsorTimeDisplays[index]; await driver.wait(until.elementTextIs(sponsorTimeDisplay, expectedDisplayedTime)); +} + +async function skipSegment(driver: WebDriver, startTime: number, endTime: number): Promise<void> { + const video = await driver.findElement(By.css("video")); + + await driver.executeScript("document.querySelector('video').currentTime = " + (startTime - 0.5)); + await driver.executeScript("document.querySelector('video').play()"); + + await driver.sleep(1000); + + expect(parseFloat(await video.getAttribute("currentTime"))).toBeGreaterThan(endTime); + await driver.executeScript("document.querySelector('video').pause()"); }
\ No newline at end of file |