Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/tests/e2e/telephony-aircall-interim.smoke.spec.ts
T

59 lines
2.6 KiB
TypeScript

// AK-P15a interim-UI smoke (AD-28): login -> open the tenant call list ->
// trigger a safe loader revalidation -> keep the current call result visible.
// The probe does not require live Aircall credentials and never mutates data.
import { expect, test } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH;
const callsPath = dashboardPath?.replace(/\/dashboard\/?$/u, "/calls");
test.describe("AK-P15a Aircall telephony interim smoke", () => {
test.beforeEach(() => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_DASHBOARD_PATH"], "Aircall telephony smoke inputs not configured");
if (!callsPath || callsPath === dashboardPath) {
skipOrFailWhenE2eFixtureMissing("Tenant call-list path could not be derived from E2E_TENANT_DASHBOARD_PATH");
}
});
test("opens the call list and refreshes the visible result without mutating data", async ({ page }) => {
await loginAsTenantUser(page, credentials!);
const response = await page.goto(callsPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `Telephony call-list path ${callsPath}`);
expect(response?.ok(), `Telephony call list returned ${response?.status() ?? "no response"}`).toBe(true);
const screen = page.locator('[data-ui-id="ui.telephony.calls.page"]').first();
await expect(screen).toBeVisible();
const refresh = page.getByRole("button", { name: /^(Aktualisieren|Refresh)$/iu }).first();
await expect(refresh).toBeVisible();
await expect(refresh).toBeEnabled();
const routePath = new URL(callsPath!, page.url()).pathname;
const refreshResponse = page.waitForResponse((candidate) => {
const url = new URL(candidate.url());
return (
candidate.request().method() === "GET" &&
(url.pathname === routePath || url.pathname === `${routePath}.data`) &&
candidate.request().resourceType() === "fetch"
);
});
await refresh.click();
expect((await refreshResponse).ok(), "Call-list refresh returned a successful loader response").toBe(true);
await expect(screen).toBeVisible();
await expect(refresh).toBeEnabled();
await expect(
page
.locator('[data-ui-id="ui.telephony.calls.table"]')
.or(page.getByText(/^(Noch keine Anrufe synchronisiert|No calls synchronized yet)$/iu))
.first()
).toBeVisible();
});
});