✨ feat: add video tour functionality with helpers, configuration, and homepage walkthrough
This commit is contained in:
49
video-tours/tours/homepage.tour.ts
Normal file
49
video-tours/tours/homepage.tour.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { tour } from "./fixtures"
|
||||
import { moveThenClick, smoothScroll } from "../helpers"
|
||||
|
||||
/**
|
||||
* Video tour: Homepage walkthrough
|
||||
*
|
||||
* Demonstrates the main page navigation:
|
||||
* 1. Homepage overview with scroll
|
||||
* 2. Navigation links
|
||||
*
|
||||
* Adapt the steps below when the UI changes.
|
||||
* Run: yarn tour
|
||||
*/
|
||||
tour("Homepage Walkthrough", async ({ tourPage: page }) => {
|
||||
tour.setTimeout(60000)
|
||||
|
||||
// ── 1. Homepage ──────────────────────────────────────────────────
|
||||
await page.goto("/")
|
||||
await page.waitForTimeout(2500)
|
||||
|
||||
// Scroll down to see page content
|
||||
await smoothScroll(page, 400)
|
||||
await page.waitForTimeout(2000)
|
||||
|
||||
// Scroll back up
|
||||
await smoothScroll(page, 0)
|
||||
await page.waitForTimeout(1000)
|
||||
|
||||
// ── 2. Navigate via links ────────────────────────────────────────
|
||||
const navLinks = page.locator("nav a")
|
||||
const count = await navLinks.count()
|
||||
|
||||
for (let i = 0; i < Math.min(count, 3); i++) {
|
||||
const link = navLinks.nth(i)
|
||||
if (await link.isVisible({ timeout: 2000 }).catch(() => false)) {
|
||||
await moveThenClick(page, link)
|
||||
await page.waitForTimeout(2000)
|
||||
|
||||
// Scroll a bit on each page
|
||||
await smoothScroll(page, 300)
|
||||
await page.waitForTimeout(1500)
|
||||
await smoothScroll(page, 0)
|
||||
await page.waitForTimeout(500)
|
||||
}
|
||||
}
|
||||
|
||||
// Final pause
|
||||
await page.waitForTimeout(1500)
|
||||
})
|
||||
Reference in New Issue
Block a user