Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mitodl/ocw-hugo-themes
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: eb84a09f0652414e6d5c69069d13c9a105b16a07
Choose a base ref
..
head repository: mitodl/ocw-hugo-themes
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3560ba46b0eb485c0ddb9b9e9d6a1f93d3e0ef9b
Choose a head ref
Showing with 7 additions and 31 deletions.
  1. +7 −31 tests-e2e/ocw-ci-test-course/video.spec.ts
38 changes: 7 additions & 31 deletions tests-e2e/ocw-ci-test-course/video.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, expect } from "@playwright/test"
import { CoursePage, VideoElement } from "../util"
import { CoursePage } from "../util"

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

test("Start time exists", async ({ page }) => {
test("Start time exists and transcript line matches", async ({ page }) => {
const course = new CoursePage(page, "course")
await course.goto("resources/ocw_test_course_mit8_01f16_l01v01_360p")
const src = await page.locator("iframe.vjs-tech").getAttribute("src")
expect(src).toMatch(/.*?start=13.*/)

const transcriptLine = page.locator('.transcript-line[data-begin="12.06"]')
await expect(transcriptLine).toContainText(
"so here's our runner, and here's our road"
)
})

test("End time exists", async ({ page }) => {
@@ -36,32 +41,3 @@ test("Start and end time exists", async ({ page }) => {
expect(urlParams.get("start")).toEqual(expectedStartTime)
expect(urlParams.get("end")).toEqual(expectedEndTime)
})

test("Transcripts start time matches video start time", async ({ page }) => {
const course = new CoursePage(page, "course")
const videoSection = new VideoElement(page)
const expectedStartTime = "13"

await course.goto("resources/ocw_test_course_mit8_01f16_l01v01_360p")
const src = await videoSection.iframe().getAttribute("src")

const urlParams = new URLSearchParams(src || "")
expect(urlParams.get("start")).toEqual(expectedStartTime)

await videoSection.expectPlayerReady()
await videoSection.playButton().click()

const activeCaption = await videoSection.transcript
.activeLine()
.getAttribute("data-begin")
const nextCaption = await videoSection.transcript
.nextLine()
.getAttribute("data-begin")

expect(parseFloat(activeCaption || "0")).toBeLessThanOrEqual(
parseFloat(expectedStartTime)
)
expect(parseFloat(nextCaption || "0")).toBeGreaterThanOrEqual(
parseFloat(expectedStartTime)
)
})