|
| 1 | +import { expect, test } from "@playwright/test"; |
| 2 | + |
| 3 | +const recipes = [ |
| 4 | + { name: "Stint CLI", expected: "bin/stint config init" }, |
| 5 | + { name: "WakaTime CLI", expected: "wakatime-cli --entity" }, |
| 6 | + { name: "Codex", expected: "bin/stint --sync-ai-activity --agent codex" }, |
| 7 | + { name: "VS Code", expected: "Install the WakaTime extension from the VS Code Marketplace." }, |
| 8 | + { name: "JetBrains", expected: "Install the WakaTime plugin from JetBrains Marketplace." }, |
| 9 | + { name: "Vim/Neovim", expected: "Install vim-wakatime for Vim or Neovim." }, |
| 10 | + { name: "Shell CLI", expected: "curl -X POST" } |
| 11 | +]; |
| 12 | + |
| 13 | +const roadmapRecipes = [ |
| 14 | + { name: "Model-aware ingestion", expected: "ai_input_tokens" }, |
| 15 | + { name: "Native Stint CLI", expected: "bin/stint config init" }, |
| 16 | + { name: "Integration catalog", expected: "Create integration key" } |
| 17 | +]; |
| 18 | + |
| 19 | +test("integration names reveal full setup instructions", async ({ page }) => { |
| 20 | + await page.route("**/api/v1/meta", async (route) => { |
| 21 | + await route.fulfill({ |
| 22 | + contentType: "application/json", |
| 23 | + body: JSON.stringify({ data: { api_url: "http://127.0.0.1:3310/api/v1", base_url: "http://127.0.0.1:3310", hostname: "playwright", ip: "127.0.0.1", version: "test" } }) |
| 24 | + }); |
| 25 | + }); |
| 26 | + await page.route("**/api/v1/api_keys", async (route) => { |
| 27 | + await route.fulfill({ contentType: "application/json", body: JSON.stringify({ data: [] }) }); |
| 28 | + }); |
| 29 | + await page.route("**/api/v1/editors", async (route) => { |
| 30 | + await route.fulfill({ contentType: "application/json", body: JSON.stringify({ data: [] }) }); |
| 31 | + }); |
| 32 | + await page.route("**/api/v1/users/current/user_agents", async (route) => { |
| 33 | + await route.fulfill({ contentType: "application/json", body: JSON.stringify({ data: [] }) }); |
| 34 | + }); |
| 35 | + await page.route("**/api/v1/auth/me", async (route) => { |
| 36 | + await route.fulfill({ status: 401, contentType: "application/json", body: JSON.stringify({ error: "unauthorized" }) }); |
| 37 | + }); |
| 38 | + |
| 39 | + await page.goto("/integrations"); |
| 40 | + |
| 41 | + const stintCard = page.getByRole("button", { name: "Show Stint CLI integration instructions" }); |
| 42 | + await expect(stintCard).toContainText("live"); |
| 43 | + |
| 44 | + for (const recipe of recipes) { |
| 45 | + await page.getByRole("button", { name: `Show ${recipe.name} integration instructions` }).click(); |
| 46 | + await expect(page.locator("#integration-instructions")).toContainText(recipe.expected); |
| 47 | + } |
| 48 | + |
| 49 | + for (const recipe of roadmapRecipes) { |
| 50 | + await page.getByRole("button", { name: `Show ${recipe.name} roadmap instructions` }).click(); |
| 51 | + await expect(page.locator("#integration-instructions")).toContainText(recipe.expected); |
| 52 | + } |
| 53 | +}); |
0 commit comments