Download tasks/linkedin/tests/oracle-runtime/clone/scripts/flow-test.mjs from TIGER-Lab/WebsiteBench: direct link, hf CLI and curl.
- Browser
- Download file 4.49 kB
-
https://huggingface.co/datasets/TIGER-Lab/WebsiteBench/resolve/main/tasks/linkedin/tests/oracle-runtime/clone/scripts/flow-test.mjs
- Command line
-
hf download hf://datasets/TIGER-Lab/WebsiteBench/tasks/linkedin/tests/oracle-runtime/clone/scripts/flow-test.mjs
-
curl -L -o flow-test.mjs https://huggingface.co/datasets/TIGER-Lab/WebsiteBench/resolve/main/tasks/linkedin/tests/oracle-runtime/clone/scripts/flow-test.mjs
4.49 kB
| import { chromium } from "playwright"; | |
| import { mkdir, writeFile } from "node:fs/promises"; | |
| import path from "node:path"; | |
| const baseURL = process.env.BASE_URL || "http://localhost:3000"; | |
| const root = process.cwd(); | |
| const outDir = path.join(root, "test-results", "flow"); | |
| await mkdir(outDir, { recursive: true }); | |
| const browser = await chromium.launch({ headless: true }); | |
| const results = []; | |
| try { | |
| const context = await browser.newContext({ viewport: { width: 1440, height: 900 }, colorScheme: "light" }); | |
| const page = await context.newPage(); | |
| await page.goto(baseURL, { waitUntil: "networkidle" }); | |
| results.push({ step: "home", title: await page.title(), heroVisible: await page.getByRole("heading", { name: "LinkedIn" }).isVisible() }); | |
| await page.getByRole("button", { name: /Show more/i }).click(); | |
| results.push({ step: "home-jobs-expanded", researchVisible: await page.getByRole("link", { name: "Research" }).isVisible() }); | |
| await page.getByRole("button", { name: /Choose a topic/i }).click(); | |
| results.push({ step: "home-learning-menu", aiTopicVisible: await page.getByRole("link", { name: "Generative AI" }).isVisible() }); | |
| await page.getByRole("button", { name: /Next slide/i }).click(); | |
| results.push({ step: "home-carousel", carouselVisible: await page.getByText(/Skills that compound/i).isVisible() }); | |
| await page.screenshot({ path: path.join(outDir, "desktop-home-expanded.png"), fullPage: false, animations: "disabled" }); | |
| await page.getByRole("link", { name: /Join the community/i }).click(); | |
| await page.waitForURL(/\/register/); | |
| await page.getByText(/not a LinkedIn sign-in/i).waitFor({ state: "visible", timeout: 10000 }); | |
| results.push({ step: "register", noticeVisible: true }); | |
| await page.goto(`${baseURL}/learning`, { waitUntil: "networkidle" }); | |
| await page.getByPlaceholder(/Search skills/i).fill("excel"); | |
| await page.getByRole("button", { name: /Software/i }).click(); | |
| results.push({ step: "learning-filter", excelVisible: await page.getByRole("button", { name: "Excel" }).isVisible() }); | |
| await page.screenshot({ path: path.join(outDir, "desktop-learning-filter.png"), fullPage: false, animations: "disabled" }); | |
| await page.goto(`${baseURL}/learning/systems-thinking`, { waitUntil: "networkidle" }); | |
| results.push({ step: "learning-detail", previewVisible: await page.getByText(/Preview lesson/i).isVisible() }); | |
| await page.goto(`${baseURL}/top-content`, { waitUntil: "networkidle" }); | |
| await Promise.all([ | |
| page.waitForURL(/\/top-content\//), | |
| page.locator(".content-card").first().click(), | |
| ]); | |
| results.push({ step: "top-content-detail", summaryVisible: await page.locator(".ai-summary").isVisible() }); | |
| await page.goto(`${baseURL}/games/logic-grid`, { waitUntil: "networkidle" }); | |
| await page.getByRole("button", { name: "Start game" }).click(); | |
| results.push({ step: "games-start", boardVisible: await page.getByText("Signal", { exact: true }).isVisible() }); | |
| await page.screenshot({ path: path.join(outDir, "desktop-game-start.png"), fullPage: false, animations: "disabled" }); | |
| await page.goto(`${baseURL}/directory/people`, { waitUntil: "networkidle" }); | |
| results.push({ step: "directory-authwall", authwallVisible: await page.getByText(/Join LinkedIn to continue/i).isVisible() }); | |
| await page.goto(`${baseURL}/verify-email`, { waitUntil: "networkidle" }); | |
| results.push({ step: "verify-email-invalid", invalidLinkVisible: await page.getByRole("heading", { name: "Link unavailable" }).isVisible() }); | |
| await page.goto(`${baseURL}/premium`, { waitUntil: "domcontentloaded" }); | |
| await page.waitForURL(/\/login\?next=%2Fpremium/); | |
| results.push({ step: "premium-auth-guard", redirectedToLogin: true }); | |
| await page.goto(`${baseURL}/feed`, { waitUntil: "domcontentloaded" }); | |
| await page.waitForURL(/\/login\?next=%2Ffeed/); | |
| results.push({ step: "feed-auth-guard", redirectedToLogin: true }); | |
| await page.goto(`${baseURL}/jobs`, { waitUntil: "domcontentloaded" }); | |
| await page.waitForURL(/\/login\?next=%2Fjobs/); | |
| results.push({ step: "jobs-auth-guard", redirectedToLogin: true }); | |
| await context.close(); | |
| } finally { | |
| await browser.close(); | |
| } | |
| await writeFile(path.join(outDir, "results.json"), JSON.stringify({ generatedAt: new Date().toISOString(), baseURL, results }, null, 2)); | |
| if (results.some((result) => Object.values(result).includes(false))) { | |
| throw new Error(`Flow assertions failed: ${JSON.stringify(results)}`); | |
| } | |
| console.log(JSON.stringify({ baseURL, results }, null, 2)); | |