test(desktop): pin workflow form-builder fill handoff and saved payload

The committed form-builder scenario could not distinguish a wrong-target
"Message text" fill under ordinary timing: the outgoing trigger inspector
keeps its identically labeled input actionable through the
AnimatePresence wait-mode handoff to the first step textarea, so the
repaired locator still needs committed causal coverage. Slow only the
animations that contain the outgoing trigger input, run the unchanged
helper fill and value assertion inside that real handoff window, then
parse the actual recorded create_workflow.payload.yamlDefinition to
require the persisted step_1 id and "Workflow notification" text and an
unfiltered message_posted trigger.

Under this schedule a first-seam wrong-target mutant fails at the
existing value assertion instead of passing 1/1; the restored scenario
and the full 29-test workflows spec stay green. The check reads the
production serializer's own saved YAML (steps[0].id/text), not a
test-authored shape.

Signed-off-by: Logan Johnson <loganj@squareup.com>
This commit is contained in:
Logan Johnson
2026-09-10 02:16:02 -04:00
parent 612a131b24
commit 893c668e14

View File

@@ -221,8 +221,32 @@ test("creates a workflow via the form builder", async ({ page }) => {
const workflowName = `test_workflow_${Date.now()}`;
await navigateToWorkflows(page);
// Keep the outgoing trigger's Message text mounted during the step handoff.
await page.evaluate(() => {
const animate = Element.prototype.animate;
Element.prototype.animate = function (...args) {
const animation = animate.apply(this, args);
if (this.querySelector("#wf-trigger-trigger_text-value")) {
animation.updatePlaybackRate(0.1);
}
return animation;
};
});
await createWorkflow(page, workflowName);
const yaml = await page.evaluate(() => {
const call = [...(window.__BUZZ_E2E_COMMAND_PAYLOADS__ ?? [])]
.reverse()
.find((candidate) => candidate.command === "create_workflow");
return (call?.payload as { yamlDefinition?: string } | undefined)
?.yamlDefinition;
});
const saved = parseYaml(yaml ?? "");
expect(saved.steps[0].id).toBe("step_1");
expect(saved.steps[0].text).toBe("Workflow notification");
expect(saved.trigger.on).toBe("message_posted");
expect(saved.trigger.filter).toBeUndefined();
// Verify workflow appears in the list
await expect(page.getByTestId("workflows-view")).toContainText(workflowName);
});