mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-07 09:19:19 +00:00
test(work-orders): remove query devtools overlay after navigation
Also drops ticket keys from shipped comments and test names. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
050e3f5134
commit
4eb929e1c8
3 changed files with 16 additions and 6 deletions
|
|
@ -16,6 +16,18 @@ async function fulfillJson(route: Route, body: unknown, status = 200) {
|
||||||
await route.fulfill({ status, contentType: "application/json", body: JSON.stringify(body) });
|
await route.fulfill({ status, contentType: "application/json", body: JSON.stringify(body) });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function hideQueryDevtools(page: Page) {
|
||||||
|
await page.addStyleTag({
|
||||||
|
content:
|
||||||
|
".tsqd-parent-container { display: none !important; pointer-events: none !important; }",
|
||||||
|
});
|
||||||
|
await page.locator(".tsqd-parent-container").evaluateAll((nodes) => {
|
||||||
|
for (const node of nodes) {
|
||||||
|
node.remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const REAL_ROW = {
|
const REAL_ROW = {
|
||||||
id: 1000,
|
id: 1000,
|
||||||
woNumber: "12345678901",
|
woNumber: "12345678901",
|
||||||
|
|
@ -58,7 +70,7 @@ async function mockBoard(page: Page, patches: unknown[]) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
test.describe("inline WO number SH placeholder (SH-320)", () => {
|
test.describe("inline WO number SH placeholder", () => {
|
||||||
test.setTimeout(60_000);
|
test.setTimeout(60_000);
|
||||||
|
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
|
|
@ -66,9 +78,6 @@ test.describe("inline WO number SH placeholder (SH-320)", () => {
|
||||||
await page.clock.resume();
|
await page.clock.resume();
|
||||||
await page.addInitScript((user) => {
|
await page.addInitScript((user) => {
|
||||||
localStorage.setItem("auth", JSON.stringify(user));
|
localStorage.setItem("auth", JSON.stringify(user));
|
||||||
const style = document.createElement("style");
|
|
||||||
style.textContent = ".tsqd-parent-container { display: none !important; }";
|
|
||||||
document.documentElement.appendChild(style);
|
|
||||||
}, TEST_USER);
|
}, TEST_USER);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -78,6 +87,7 @@ test.describe("inline WO number SH placeholder (SH-320)", () => {
|
||||||
const mutations: unknown[] = [];
|
const mutations: unknown[] = [];
|
||||||
await mockBoard(page, mutations);
|
await mockBoard(page, mutations);
|
||||||
await page.goto("/workorders");
|
await page.goto("/workorders");
|
||||||
|
await hideQueryDevtools(page);
|
||||||
await expect(page.getByRole("heading", { name: "Work Orders" })).toBeVisible({
|
await expect(page.getByRole("heading", { name: "Work Orders" })).toBeVisible({
|
||||||
timeout: 20_000,
|
timeout: 20_000,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ export function isValidBoardWoNumber(woNumber: string): boolean {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SH-320: only an already-saved real APM number is protected from being replaced by an
|
* Only an already-saved real APM number is protected from being replaced by an
|
||||||
* SH placeholder. A brand-new WO has no saved number, so the rule never applies there.
|
* SH placeholder. A brand-new WO has no saved number, so the rule never applies there.
|
||||||
*/
|
*/
|
||||||
export function isWoNumberDowngrade(savedWoNumber: string, nextWoNumber: string): boolean {
|
export function isWoNumberDowngrade(savedWoNumber: string, nextWoNumber: string): boolean {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ function typeAndCommit(nextValue: string) {
|
||||||
fireEvent.keyDown(input, { key: "Enter" });
|
fireEvent.keyDown(input, { key: "Enter" });
|
||||||
}
|
}
|
||||||
|
|
||||||
describe("EditableWONumberCell SH placeholder numbers (SH-320)", () => {
|
describe("EditableWONumberCell SH placeholder numbers", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.mocked(workOrdersApi.findByWoNumber).mockResolvedValue(null as never);
|
vi.mocked(workOrdersApi.findByWoNumber).mockResolvedValue(null as never);
|
||||||
vi.mocked(toast).mockClear();
|
vi.mocked(toast).mockClear();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue