Skip to content

Commit c3577c9

Browse files
Update failing E2E test: Replace activeLine validation with transcript validation (#1459)
* Pass playwright videojs test
1 parent d6f6c57 commit c3577c9

File tree

1 file changed

+7
-31
lines changed

1 file changed

+7
-31
lines changed
+7-31
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { test, expect } from "@playwright/test"
2-
import { CoursePage, VideoElement } from "../util"
2+
import { CoursePage } from "../util"
33

44
test("Start and end times does not exist", async ({ page }) => {
55
const course = new CoursePage(page, "course")
@@ -10,11 +10,16 @@ test("Start and end times does not exist", async ({ page }) => {
1010
expect(src).not.toMatch(/.*?end=.*/)
1111
})
1212

13-
test("Start time exists", async ({ page }) => {
13+
test("Start time exists and transcript line matches", async ({ page }) => {
1414
const course = new CoursePage(page, "course")
1515
await course.goto("resources/ocw_test_course_mit8_01f16_l01v01_360p")
1616
const src = await page.locator("iframe.vjs-tech").getAttribute("src")
1717
expect(src).toMatch(/.*?start=13.*/)
18+
19+
const transcriptLine = page.locator('.transcript-line[data-begin="12.06"]')
20+
await expect(transcriptLine).toContainText(
21+
"so here's our runner, and here's our road"
22+
)
1823
})
1924

2025
test("End time exists", async ({ page }) => {
@@ -36,32 +41,3 @@ test("Start and end time exists", async ({ page }) => {
3641
expect(urlParams.get("start")).toEqual(expectedStartTime)
3742
expect(urlParams.get("end")).toEqual(expectedEndTime)
3843
})
39-
40-
test("Transcripts start time matches video start time", async ({ page }) => {
41-
const course = new CoursePage(page, "course")
42-
const videoSection = new VideoElement(page)
43-
const expectedStartTime = "13"
44-
45-
await course.goto("resources/ocw_test_course_mit8_01f16_l01v01_360p")
46-
const src = await videoSection.iframe().getAttribute("src")
47-
48-
const urlParams = new URLSearchParams(src || "")
49-
expect(urlParams.get("start")).toEqual(expectedStartTime)
50-
51-
await videoSection.expectPlayerReady()
52-
await videoSection.playButton().click()
53-
54-
const activeCaption = await videoSection.transcript
55-
.activeLine()
56-
.getAttribute("data-begin")
57-
const nextCaption = await videoSection.transcript
58-
.nextLine()
59-
.getAttribute("data-begin")
60-
61-
expect(parseFloat(activeCaption || "0")).toBeLessThanOrEqual(
62-
parseFloat(expectedStartTime)
63-
)
64-
expect(parseFloat(nextCaption || "0")).toBeGreaterThanOrEqual(
65-
parseFloat(expectedStartTime)
66-
)
67-
})

0 commit comments

Comments
 (0)