Skip to content

Commit 1c568f9

Browse files
authored
Add a skills launcher modal (anomalyco#906)
* Add a skills launcher modal * Fix shared skill imports * Add shared skill import demo video * Add live skill import evidence * Fix share link imports without descriptions --------- Co-authored-by: jcllobet <[email protected]>
1 parent 4dbd930 commit 1c568f9

24 files changed

Lines changed: 663 additions & 122 deletions
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import { expect, test } from "@playwright/test";
2+
3+
const bundleUrl = "https://share.openwork.software/b/test-skill";
4+
5+
test.beforeEach(async ({ page }) => {
6+
await page.route("**/b/test-skill*", async (route) => {
7+
const url = new URL(route.request().url());
8+
if (url.searchParams.get("format") !== "json") {
9+
await route.fulfill({
10+
status: 404,
11+
headers: {
12+
"content-type": "application/json",
13+
"access-control-allow-origin": "*",
14+
},
15+
body: JSON.stringify({ message: "Not found" }),
16+
});
17+
return;
18+
}
19+
20+
await route.fulfill({
21+
status: 200,
22+
headers: {
23+
"content-type": "application/json",
24+
"access-control-allow-origin": "*",
25+
},
26+
body: JSON.stringify({
27+
schemaVersion: 1,
28+
type: "skill",
29+
name: "test-skill",
30+
content: "# Test skill\n\nUse this test skill.",
31+
description: "Playwright fixture skill",
32+
}),
33+
});
34+
});
35+
36+
await page.goto("/skills-launcher-harness.html");
37+
});
38+
39+
test("both create entry points open the launcher modal", async ({ page }) => {
40+
await page.getByRole("button", { name: "New skill" }).click();
41+
const createDialog = page.getByRole("dialog", { name: "Create a skill" });
42+
await expect(createDialog).toBeVisible();
43+
await expect(createDialog.getByRole("button", { name: "Upload the skill" })).toBeVisible();
44+
await expect(createDialog.getByRole("button", { name: "Create/edit in skill editor" })).toBeVisible();
45+
await expect(createDialog.getByRole("button", { name: "Install from link" })).toBeVisible();
46+
await expect(createDialog.getByRole("button", { name: "Create a skill in chat" })).toBeVisible();
47+
48+
await createDialog.getByRole("button", { name: "Close create skill modal" }).click();
49+
50+
await page.getByRole("button", { name: "Create skill in chat" }).click();
51+
await expect(page.getByRole("dialog", { name: "Create a skill" })).toBeVisible();
52+
});
53+
54+
test("launcher actions route into the shared flows", async ({ page }) => {
55+
await page.getByRole("button", { name: "New skill" }).click();
56+
let dialog = page.getByRole("dialog", { name: "Create a skill" });
57+
58+
await dialog.getByRole("button", { name: "Upload the skill" }).click();
59+
await expect(page.getByTestId("import-count")).toHaveText("1");
60+
61+
await page.getByRole("button", { name: "New skill" }).click();
62+
dialog = page.getByRole("dialog", { name: "Create a skill" });
63+
await dialog.getByRole("button", { name: "Create a skill in chat" }).click();
64+
await expect(page.getByTestId("session-count")).toHaveText("1");
65+
await expect(page.getByTestId("prompt-value")).toHaveText("/skill-creator");
66+
67+
await page.getByRole("button", { name: "New skill" }).click();
68+
dialog = page.getByRole("dialog", { name: "Create a skill" });
69+
await dialog.getByRole("button", { name: "Create/edit in skill editor" }).click();
70+
const installDialog = page.getByRole("dialog", { name: "Install from link" });
71+
await expect(page.getByTestId("opened-url")).toHaveText("https://share.openworklabs.com");
72+
await expect(installDialog.getByText("Paste the share link from the editor to install it here.")).toBeVisible();
73+
74+
await installDialog.getByLabel("Skill bundle link").fill(bundleUrl);
75+
await installDialog.getByRole("button", { name: "Preview" }).click();
76+
await expect(installDialog.getByText("Skill:")).toBeVisible();
77+
await installDialog.getByRole("button", { name: "Install", exact: true }).click();
78+
await expect(page.getByTestId("saved-skills")).toContainText("test-skill");
79+
});
80+
81+
test("toolbar install shortcut opens the shared install flow directly", async ({ page }) => {
82+
await page.getByRole("button", { name: "Install from link" }).last().click();
83+
const installDialog = page.getByRole("dialog", { name: "Install from link" });
84+
await expect(installDialog).toBeVisible();
85+
await expect(installDialog.getByText("Paste a skill bundle URL, preview it, then install.")).toBeVisible();
86+
});

‎packages/app/package.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"test:fs-engine": "node scripts/fs-engine.mjs",
2222
"test:local-file-path": "node scripts/local-file-path.mjs",
2323
"test:browser-entry": "node scripts/browser-entry.mjs",
24-
"test:e2e": "pnpm test:local-file-path && node scripts/e2e.mjs && node scripts/session-switch.mjs && node scripts/fs-engine.mjs && node scripts/browser-entry.mjs",
24+
"test:e2e:skills-launcher": "playwright test --config playwright.config.ts",
25+
"test:e2e": "pnpm test:local-file-path && node scripts/e2e.mjs && node scripts/session-switch.mjs && node scripts/fs-engine.mjs && node scripts/browser-entry.mjs && pnpm test:e2e:skills-launcher",
2526
"bump:patch": "node scripts/bump-version.mjs patch",
2627
"bump:minor": "node scripts/bump-version.mjs minor",
2728
"bump:major": "node scripts/bump-version.mjs major",
@@ -53,6 +54,7 @@
5354
"solid-js": "^1.9.0"
5455
},
5556
"devDependencies": {
57+
"@playwright/test": "^1.51.1",
5658
"@tailwindcss/vite": "^4.1.18",
5759
"tailwindcss": "^4.1.18",
5860
"typescript": "^5.6.3",

‎packages/app/playwright.config.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { defineConfig } from "@playwright/test";
2+
3+
export default defineConfig({
4+
testDir: "./e2e",
5+
timeout: 30_000,
6+
fullyParallel: true,
7+
reporter: "list",
8+
outputDir: "../../tmp/openwork-app-playwright",
9+
use: {
10+
baseURL: "http://127.0.0.1:4173",
11+
trace: "retain-on-failure",
12+
},
13+
webServer: {
14+
command: "OPENWORK_DEV_MODE=1 pnpm exec vite --host 127.0.0.1 --port 4173",
15+
url: "http://127.0.0.1:4173/skills-launcher-harness.html",
16+
reuseExistingServer: !process.env.CI,
17+
timeout: 120_000,
18+
},
19+
});
97.6 KB
Loading
134 KB
Loading
143 KB
Loading
134 KB
Loading
164 KB
Loading
81.1 KB
Loading
1.95 MB
Loading

0 commit comments

Comments
 (0)