History

Harden picker add e2e selection

Rhys Sullivan committed 4 months ago

Commit 609d07e1 parent 1464f064 files · +34 −26Browse files

Unified · Split

4 files
  1. e2e/scenarios/google-per-service-add-ui.test.ts +3 −15
  2. e2e/scenarios/microsoft-per-workload-add-ui.test.ts +10 −10
  3. e2e/scenarios/support/picker.ts +21 −0
  4. examples/all-plugins/src/main.ts +0 −1
e2e/scenarios/google-per-service-add-ui.test.ts+3−15
@@ -34,7 +34,7 @@ import { Effect } from "effect"; · 33 unmodified lines
34 34
35import { scenario } from "../src/scenario";35import { scenario } from "../src/scenario";
36import { Browser, Target } from "../src/services";36import { Browser, Target } from "../src/services";
37import { setPresetChecked } from "./support/picker";37import { clearCheckedPresets, setPresetChecked } from "./support/picker";
38 38
39scenario(39scenario(
40 "Google · the per-service picker fans out to separate integrations and skips existing ones",40 "Google · the per-service picker fans out to separate integrations and skips existing ones",
@@ -59,17 +59,7 @@ scenario( · 18 unmodified lines
59 async () => {59 async () => {
60 // Clear every featured default, then select only the three preset60 // Clear every featured default, then select only the three preset
61 // products under test.61 // products under test.
62 const featuredDefaults = [62 await clearCheckedPresets(page);
63 "google-calendar",
64 "google-gmail",
65 "google-sheets",
66 "google-drive",
67 "google-docs",
68 ];
69 for (const presetId of featuredDefaults) {
70 await setPresetChecked(page, presetId, false);
71 }
72
73 for (const presetId of ["google-calendar", "google-gmail", "google-drive"]) {63 for (const presetId of ["google-calendar", "google-gmail", "google-drive"]) {
74 await setPresetChecked(page, presetId, true);64 await setPresetChecked(page, presetId, true);
75 }65 }
@@ -152,9 +142,7 @@ scenario( · 76 unmodified lines
152 await page.getByText("Customize your Google connection").waitFor();142 await page.getByText("Customize your Google connection").waitFor();
153 143
154 // Clear the featured defaults so only Calendar (already added) is checked.144 // Clear the featured defaults so only Calendar (already added) is checked.
155 for (const presetId of ["google-gmail", "google-sheets", "google-drive", "google-docs"]) {145 await clearCheckedPresets(page);
156 await setPresetChecked(page, presetId, false);
157 }
158 await setPresetChecked(page, "google-calendar", true);146 await setPresetChecked(page, "google-calendar", true);
159 147
160 await page.getByTestId("google-add-submit").click();148 await page.getByTestId("google-add-submit").click();
e2e/scenarios/microsoft-per-workload-add-ui.test.ts+10−10
@@ -26,7 +26,7 @@ import { Effect } from "effect"; · 25 unmodified lines
26 26
27import { scenario } from "../src/scenario";27import { scenario } from "../src/scenario";
28import { Browser, Target } from "../src/services";28import { Browser, Target } from "../src/services";
29import { setPresetChecked } from "./support/picker";29import { clearCheckedPresets, setPresetChecked } from "./support/picker";
30 30
31scenario(31scenario(
32 "Microsoft · the per-workload picker fans out to separate integrations and skips existing ones",32 "Microsoft · the per-workload picker fans out to separate integrations and skips existing ones",
@@ -46,11 +46,8 @@ scenario( · 13 unmodified lines
46 });46 });
47 47
48 await step("Clear defaults, check Mail + Calendar, and add a custom scope", async () => {48 await step("Clear defaults, check Mail + Calendar, and add a custom scope", async () => {
49 // The featured defaults (profile, mail, calendar, contacts, tasks, files)49 // Clear every checked default, then select only the two under test.
50 // start checked; clear them, then select only the two under test.50 await clearCheckedPresets(page);
51 for (const presetId of ["profile", "mail", "calendar", "contacts", "tasks", "files"]) {
52 await setPresetChecked(page, presetId, false);
53 }
54 for (const presetId of ["mail", "calendar"]) {51 for (const presetId of ["mail", "calendar"]) {
55 await setPresetChecked(page, presetId, true);52 await setPresetChecked(page, presetId, true);
56 }53 }
@@ -66,7 +63,12 @@ scenario( · 9 unmodified lines
66 await page.getByTestId("microsoft-add-submit").click();63 await page.getByTestId("microsoft-add-submit").click();
67 // Each workload fetches + stream-compiles the 37MB Graph spec; allow a64 // Each workload fetches + stream-compiles the 37MB Graph spec; allow a
68 // wide window for the result panel to populate.65 // wide window for the result panel to populate.
69 await page.getByTestId("microsoft-add-results").waitFor({ timeout: 300_000 });66 const results = page.getByTestId("microsoft-add-results");
67 await results.waitFor({ timeout: 300_000 });
68 expect(
69 await results.locator('[data-testid^="add-result-row-"]').count(),
70 "only Mail, Calendar, and the custom scope are created",
71 ).toBe(3);
70 72
71 for (const presetId of ["mail", "calendar"]) {73 for (const presetId of ["mail", "calendar"]) {
72 const row = page.getByTestId(`add-result-row-${presetId}`);74 const row = page.getByTestId(`add-result-row-${presetId}`);
@@ -118,9 +120,7 @@ scenario( · 45 unmodified lines
118 await page.goto("/integrations/add/microsoft", { waitUntil: "domcontentloaded" });120 await page.goto("/integrations/add/microsoft", { waitUntil: "domcontentloaded" });
119 await page.getByText("Customize Microsoft Graph").waitFor();121 await page.getByText("Customize Microsoft Graph").waitFor();
120 122
121 for (const presetId of ["profile", "mail", "calendar", "contacts", "tasks", "files"]) {123 await clearCheckedPresets(page);
122 await setPresetChecked(page, presetId, false);
123 }
124 await setPresetChecked(page, "mail", true);124 await setPresetChecked(page, "mail", true);
125 125
126 await page.getByTestId("microsoft-add-submit").click();126 await page.getByTestId("microsoft-add-submit").click();
e2e/scenarios/support/picker.ts+21−0
@@ -27,3 +27,24 @@ export const setPresetChecked = async ( · 26 unmodified lines
27 )27 )
28 .toBe(String(checked));28 .toBe(String(checked));
29};29};
30
31export const clearCheckedPresets = async (page: Page): Promise<void> => {
32 const boxes = page.locator('[data-testid^="preset-checkbox-"]');
33 await boxes.first().waitFor();
34
35 const checkedPresetIds: string[] = [];
36 const count = await boxes.count();
37 for (let index = 0; index < count; index += 1) {
38 const box = boxes.nth(index);
39 if ((await box.getAttribute("aria-checked")) !== "true") continue;
40
41 const testId = await box.getAttribute("data-testid");
42 if (testId?.startsWith("preset-checkbox-")) {
43 checkedPresetIds.push(testId.slice("preset-checkbox-".length));
44 }
45 }
46
47 for (const presetId of checkedPresetIds) {
48 await setPresetChecked(page, presetId, false);
49 }
50};
examples/all-plugins/src/main.ts+0−1
@@ -418,7 +418,6 @@ const program = Effect.gen(function* () { · 417 unmodified lines
418 console.log(" executor.fileSecrets.filePath: ", executor.fileSecrets.filePath);418 console.log(" executor.fileSecrets.filePath: ", executor.fileSecrets.filePath);
419 419
420 // executor.mcp.addServer({ transport: "remote", name: "...", endpoint: "...", slug: "..." });420 // executor.mcp.addServer({ transport: "remote", name: "...", endpoint: "...", slug: "..." });
421 // executor.google.addBundle({ urls: ["..."], slug: "google" });
422 // executor.onepassword.configure({ auth: { kind: "desktop-app", accountName: "..." }, vaultId: "..." });421 // executor.onepassword.configure({ auth: { kind: "desktop-app", accountName: "..." }, vaultId: "..." });
423 422
424 // -------------------------------------------------------------------------423 // -------------------------------------------------------------------------