From 5fad3555e192fb06fbeba2495fe1950f7b904723 Mon Sep 17 00:00:00 2001 From: MarconLP <13001502+MarconLP@users.noreply.github.com> Date: Sat, 15 Apr 2023 22:20:43 +0200 Subject: [PATCH] add test for renaming a video --- tests/video.spec.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/video.spec.ts b/tests/video.spec.ts index 6668ae6..67bef1e 100644 --- a/tests/video.spec.ts +++ b/tests/video.spec.ts @@ -14,3 +14,20 @@ test("should be able to view video", async ({ page }) => { const isPaused = await video.evaluate((v: HTMLVideoElement) => v.paused); expect(isPaused).toBe(true); }); + +test("should be able to rename video", async ({ page }) => { + const randomTitle = "Random title " + Math.random().toString(); + + await page.goto("http://localhost:3000/videos"); + await page.locator("div.grid > a:nth-child(1)").click(); + await expect(page).toHaveURL(/http:\/\/localhost:3000\/share\/[A-Za-z0-9]+/); + + await page.locator("button > svg").click(); + await page.getByText("Rename").click(); + await page.click("#title"); + await page.fill("#title", randomTitle); + await page.getByText("Save").click(); + expect( + await page.locator("div > span.text-lg.font-medium").textContent() + ).toBe(randomTitle); +});