335d80bf66
Co-authored-by: nova28 <17953305+nova28@users.noreply.github.com> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> Co-authored-by: Carlos Florencio <carlosmflorencio@gmail.com>
56 lines
2.3 KiB
TypeScript
56 lines
2.3 KiB
TypeScript
// Filename starts with "mobile-" so this runs on the mobile-chrome project.
|
|
import { expect, test } from "../../fixtures/test-base";
|
|
import { installFixturePlugin, PLUGIN_ID } from "../../helpers/plugin-fixture";
|
|
|
|
test.describe("Mobile plugin task-list facet", () => {
|
|
test.afterEach(async ({ apiClient }) => {
|
|
await apiClient.rawRequest("DELETE", `/api/plugins/${PLUGIN_ID}`).catch(() => undefined);
|
|
});
|
|
|
|
test("adds a facet to the mobile Group picker", async ({ testPage, apiClient, seedData }) => {
|
|
test.setTimeout(90_000);
|
|
|
|
await installFixturePlugin(testPage);
|
|
const taskId = (
|
|
await apiClient.createTask(seedData.workspaceId, "Mobile facet task", {
|
|
workflow_id: seedData.workflowId,
|
|
workflow_step_id: seedData.startStepId,
|
|
})
|
|
).id;
|
|
|
|
await testPage.goto("/tasks?group=none");
|
|
await testPage.waitForLoadState("networkidle");
|
|
|
|
await testPage.evaluate(
|
|
({ taskId }: { taskId: string }) => {
|
|
const win = window as Record<string, unknown>;
|
|
win.__e2eFacetValues = { [taskId]: [{ value: "alpha", label: "Alpha" }] };
|
|
(win.__e2eFacetNotify as () => void)();
|
|
},
|
|
{ taskId },
|
|
);
|
|
|
|
await testPage.getByRole("button", { name: "Open menu" }).tap();
|
|
const menu = testPage.getByRole("dialog", { name: "Menu" });
|
|
const groupSelect = menu.getByTestId("mobile-tasks-list-group");
|
|
await groupSelect.evaluate((element) => element.scrollIntoView({ block: "center" }));
|
|
await expect(groupSelect).toBeInViewport();
|
|
const listbox = testPage.getByRole("listbox");
|
|
await expect(async () => {
|
|
if (!(await listbox.isVisible())) await groupSelect.tap();
|
|
const fixtureTag = listbox.getByRole("option", { name: "Fixture tag" });
|
|
await expect(fixtureTag).toBeInViewport({ timeout: 1_000 });
|
|
await fixtureTag.click();
|
|
await expect(groupSelect).toContainText("Fixture tag", { timeout: 1_000 });
|
|
}).toPass({ timeout: 10_000 });
|
|
|
|
const section = testPage.getByTestId("tasks-list-section");
|
|
await expect(section).toHaveCount(1);
|
|
await expect(section).toContainText("Alpha");
|
|
await expect(section).toContainText("Mobile facet task");
|
|
expect(
|
|
await testPage.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth),
|
|
).toBe(true);
|
|
});
|
|
});
|