test(ui): retire 33 duplicate executions and share render setup (#16072)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip authored and GitHub committed 2026-10-14 23:12:34 -05:00
1 parent f64d05adf4
commit ccbfefef5f
59 files changed
+6112 -1038

No files matched your search

@@ -662,36 +662,6 @@ describe("EnvironmentVariablesEditor", () => {
expect(secretValueField?.value).toBe("supersecretvalue");
});
it("opens the create-secret popover from the picker's + Create item (§6.4, PAP-12476)", async () => {
// Regression: selecting the picker's `+ Create secret` item closes the
// combobox popover and (in the same tick) opens the anchored create-secret
// popover. The two Radix popovers must not race — the create popover has to
// survive the combobox's focus-return instead of being dismissed instantly.
render(
<EnvironmentVariablesEditor
value={{ GH: { type: "secret_ref", secretId: "s1", version: 2 } }}
secrets={secrets}
onChange={() => {}}
onCreateSecret={async () => secrets[0]}
/>,
);
const combobox = container.querySelector<HTMLElement>('[role="combobox"]')!;
combobox.focus();
await flush();
const createItem = [...document.querySelectorAll<HTMLElement>("[cmdk-item]")].find((el) =>
el.textContent?.includes("Create"),
);
expect(createItem, "create item should be present in the open picker").toBeTruthy();
createItem!.click();
await flush();
// The create-secret popover is open (heading rendered) and stays open.
expect(document.body.textContent, "create-secret popover should open").toContain("Create secret");
expect(
document.querySelector('input[aria-label="Secret name"]'),
"create-secret name field should render",
).toBeTruthy();
});
it("keeps the create-secret popover open when focus returns to a control inside the value cell (§6.4, PAP-12492)", async () => {
// Regression for the *fragile* part of the picker → create transition.
// The picker's combobox and the anchored create popover share the value
@@ -724,6 +694,11 @@ describe("EnvironmentVariablesEditor", () => {
await flush();
expect(document.body.textContent, "create-secret popover should open").toContain("Create secret");
expect(
document.querySelector('input[aria-label="Secret name"]'),
"create-secret name field should render",
).toBeTruthy();
// Simulate the picker's animation-delayed focus-return landing on a control
// that lives inside the value cell (the source-switch trigger is a stable
// in-anchor target that doesn't reopen the picker). Moving focus fires a