From d505b10ac6f8fb23711bb6abe1c92d161512a260 Mon Sep 17 00:00:00 2001 From: YaelChen Date: Wed, 8 Jan 2025 10:39:40 +0200 Subject: [PATCH] test: add test for YouTube modal in about page --- tests/about.spec.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/about.spec.ts b/tests/about.spec.ts index 869dbb20..f8b0af7d 100644 --- a/tests/about.spec.ts +++ b/tests/about.spec.ts @@ -107,14 +107,15 @@ test.describe('About Page Tests', () => { ) }) - test('About YouTube modal plays video', async ({ page }) => { + test('the YouTube modal in "about" is visible and have the correct src', async ({ page }) => { await page.goto('/about') - const videoFrame = page.frameLocator('iframe[title="YouTube video player"]') - const playButton = videoFrame.getByLabel('Play', { exact: true }) - await playButton.click() - await playButton.waitFor({ state: 'hidden' }) - const video = videoFrame.locator('video') - await video.hover() - await expect(videoFrame.getByLabel('Pause')).toBeVisible() + const iframeElement = await page.waitForSelector('iframe') + const Visible = await iframeElement.isVisible() + expect(Visible).toBe(true) + //const iframe = await iframeElement.contentFrame + const videoSrc = await iframeElement.getAttribute('src') + expect(videoSrc).toBe( + 'https://www.youtube.com/embed/videoseries?si=oTULlxq8Is188hPu&list=PL6Rh06rT7uiX1AQE-lm55hy-seL3idx3T', + ) }) })