Files
CPLv4.0/playwright/tests/pages/settingsPage/settingsPage.test.ts

142 lines
4.8 KiB
TypeScript

import { test, expect } from "@playwright/test";
import { headerTest } from "@/playwright/tests/components/header/headerTest";
import { navTest } from "@/playwright/tests/components/navigation/navTest";
import { footerTest } from "@/playwright/tests/components/footer/footerTest";
test.use({
viewport: {
height: 800,
width: 1280,
},
});
test("Einstellungen", async ({ page }) => {
await page.goto("/einstellungen");
// Gemeinsame Layout-Checks
await headerTest(page);
await navTest(page);
await footerTest(page);
await page.getByRole("button", { name: "Allgemeine Einstellungen" }).click();
await expect(
page.getByRole("heading", { name: "Allgemeine Einstellungen" })
).toBeVisible();
await expect(page.getByText("Name:")).toBeVisible();
await expect(
page
.locator("div")
.filter({ hasText: /^Name:$/ })
.getByRole("textbox")
).toBeVisible();
await expect(page.getByText("MAC Adresse 1:")).toBeVisible();
await expect(
page
.locator("div")
.filter({ hasText: /^MAC Adresse 1:$/ })
.getByRole("textbox")
).toHaveValue("0 48 86 81 46 143");
await expect(page.getByText("Systemzeit:")).toBeVisible();
await expect(
page
.locator("div")
.filter({ hasText: /^Systemzeit übernehmen$/ })
.getByRole("textbox")
).toHaveValue("23.10.24 15:10:28");
await expect(
page.getByRole("button", { name: "Systemzeit übernehmen" })
).toBeVisible();
await expect(page.getByText("IP:")).toBeVisible();
await expect(
page.locator("div").filter({ hasText: /^IP:$/ }).getByRole("textbox")
).toBeVisible();
await expect(page.getByText("Subnet:")).toBeVisible();
await expect(
page
.locator("div")
.filter({ hasText: /^Subnet:$/ })
.getByRole("textbox")
).toBeVisible();
await expect(page.getByText("Gateway:")).toBeVisible();
await expect(
page
.locator("div")
.filter({ hasText: /^Gateway:$/ })
.getByRole("textbox")
).toBeVisible();
await expect(
page.getByRole("button", { name: "Neustart CPL" })
).toBeVisible();
await expect(page.getByRole("button", { name: "Speichern" })).toBeVisible();
await page.getByRole("button", { name: "OPCUA" }).click();
await expect(
page.getByRole("img", { name: "OPCUA Logo" }).first()
).toBeVisible();
await expect(
page.getByRole("img", { name: "OPCUA Logo" }).nth(1)
).toBeVisible();
await expect(page.getByText("Server Status:")).toBeVisible();
await expect(page.getByRole("button", { name: "Aktiviert" })).toBeVisible();
await expect(page.getByText("1")).toBeVisible();
await expect(page.getByText("Nodeset Name")).toBeVisible();
await expect(page.getByText("OPCUA Zustand")).toBeVisible();
await expect(page.getByRole("textbox")).toHaveValue(
"CPL V4 OPC UA Application Deutsche Bahn"
);
await expect(page.getByText("Aktuelle OPC-Clients")).toBeVisible();
await expect(page.getByText("0", { exact: true })).toBeVisible();
await page.getByRole("button", { name: "Datenbank" }).click();
await expect(
page.getByRole("heading", { name: "Datenbank Einstellungen" })
).toBeVisible();
await expect(
page.getByRole("button", { name: "Meldungen löschen" })
).toBeVisible();
await expect(
page.getByRole("button", { name: "Messwerte Logger löschen" })
).toBeVisible();
await page.getByRole("button", { name: "NTP" }).click();
await expect(
page.getByRole("heading", { name: "NTP Einstellungen" })
).toBeVisible();
await expect(page.getByText("NTP Server 1")).toBeVisible();
await expect(
page
.locator("div")
.filter({ hasText: /^NTP Server 1$/ })
.getByRole("textbox")
).toBeVisible();
await expect(page.getByText("NTP Server 2")).toBeVisible();
await expect(
page
.locator("div")
.filter({ hasText: /^NTP Server 2$/ })
.getByRole("textbox")
).toBeVisible();
await expect(page.getByText("NTP Server 3")).toBeVisible();
await expect(
page
.locator("div")
.filter({ hasText: /^NTP Server 3$/ })
.getByRole("textbox")
).toBeVisible();
await expect(page.getByText("Zeitzone")).toBeVisible();
await expect(
page
.locator("div")
.filter({ hasText: /^Zeitzone$/ })
.getByRole("textbox")
).toBeVisible();
await expect(page.getByText("NTP aktiv:")).toBeVisible();
await expect(page.getByRole("button", { name: "Speichern" })).toBeVisible();
await page.getByRole("button", { name: "Benutzerverwaltung" }).click();
await expect(
page.getByRole("heading", { name: "Login Admin-Bereich" })
).toBeVisible();
await expect(
page.getByRole("textbox", { name: "Benutzername" })
).toBeVisible();
await expect(page.getByRole("textbox", { name: "Passwort" })).toBeVisible();
await expect(
page.getByRole("button", { name: "Admin anmelden" })
).toBeVisible();
});