Files
CPLv4.0/playwright/tests/pages/settingsPage/settingsPageTest.ts
2025-09-02 11:08:34 +02:00

262 lines
7.9 KiB
TypeScript

import type { Page } from "@playwright/test";
import { highlightAndExpectVisible } from "@playwright/utils/highlight";
export async function runSettingsPageTest(page: Page) {
await page.goto("http://localhost:3000/einstellungen");
await highlightAndExpectVisible(
page,
page.getByRole("heading", { name: "Meldestation" })
);
await highlightAndExpectVisible(
page,
page.getByRole("img", { name: "TALAS Logo" })
);
await highlightAndExpectVisible(
page,
page.getByRole("img", { name: "Logo", exact: true })
);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Übersicht" })
);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Kabelüberwachung" })
);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Meldungseingänge" })
);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Schaltausgänge" })
);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Messwerteingänge" })
);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Berichte" })
);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "System" })
);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Einstellungen" })
);
await highlightAndExpectVisible(
page,
page
.locator("div")
.filter({ hasText: /^Littwin Systemtechnik GmbH & Co\. KG$/ })
.locator("svg")
);
await highlightAndExpectVisible(
page,
page.getByText("Littwin Systemtechnik GmbH &")
);
await highlightAndExpectVisible(
page,
page
.locator("div")
.filter({ hasText: /^Telefon: 04402 972577-0$/ })
.locator("svg")
);
await highlightAndExpectVisible(
page,
page.getByText("Telefon: 04402 972577-")
);
await highlightAndExpectVisible(
page,
page
.locator("div")
.filter({ hasText: /^kontakt@littwin-systemtechnik\.de$/ })
.locator("svg")
);
await highlightAndExpectVisible(
page,
page.getByText("kontakt@littwin-systemtechnik")
);
await highlightAndExpectVisible(
page,
page
.locator("div")
.filter({ hasText: /^Handbücher$/ })
.locator("svg")
);
await highlightAndExpectVisible(
page,
page.getByText("Handbücher", { exact: true })
);
await page.getByText("Handbücher", { exact: true }).click();
await highlightAndExpectVisible(
page,
page.getByRole("heading", { name: "PDF Handbücher" })
);
await highlightAndExpectVisible(page, page.getByText("KUE705FO.PDF"));
//await page.getByRole("button").filter({ hasText: /^$/ }).click();
await page.getByRole("button", { name: "Allgemeine Einstellungen" }).click();
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Allgemeine Einstellungen" })
);
await highlightAndExpectVisible(
page,
page.getByRole("heading", { name: "Allgemeine Einstellungen" })
);
await highlightAndExpectVisible(page, page.getByText("Name:"));
await highlightAndExpectVisible(
page,
page
.locator("div")
.filter({ hasText: /^Name:$/ })
.getByRole("textbox")
);
await highlightAndExpectVisible(page, page.getByText("MAC Adresse 1:"));
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Systemzeit übernehmen" })
);
await highlightAndExpectVisible(page, page.getByText("IP:"));
await highlightAndExpectVisible(
page,
page.locator("div").filter({ hasText: /^IP:$/ }).getByRole("textbox")
);
await highlightAndExpectVisible(page, page.getByText("Subnet:"));
await highlightAndExpectVisible(
page,
page
.locator("div")
.filter({ hasText: /^Subnet:$/ })
.getByRole("textbox")
);
await highlightAndExpectVisible(page, page.getByText("Gateway:"));
await highlightAndExpectVisible(
page,
page
.locator("div")
.filter({ hasText: /^Gateway:$/ })
.getByRole("textbox")
);
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Neustart CPL" })
);
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Speichern" })
);
await page.getByRole("button", { name: "OPCUA" }).click();
await highlightAndExpectVisible(
page,
page.getByRole("img", { name: "OPCUA Logo" }).first()
);
await highlightAndExpectVisible(
page,
page.getByRole("img", { name: "OPCUA Logo" }).nth(1)
);
await highlightAndExpectVisible(page, page.getByText("Server Status:"));
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Aktiviert" })
);
await highlightAndExpectVisible(page, page.getByText("OPCUA Zustand"));
await highlightAndExpectVisible(page, page.getByText("1"));
await highlightAndExpectVisible(page, page.getByText("Nodeset Name"));
await highlightAndExpectVisible(page, page.getByText("Aktuelle OPC-Clients"));
await highlightAndExpectVisible(page, page.getByText("0", { exact: true }));
await page.getByRole("button", { name: "Datenbank" }).click();
await highlightAndExpectVisible(
page,
page.getByRole("heading", { name: "Datenbank Einstellungen" })
);
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Meldungen löschen" })
);
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Messwerte Logger löschen" })
);
await page.getByRole("button", { name: "NTP" }).click();
await highlightAndExpectVisible(
page,
page.getByRole("heading", { name: "NTP Einstellungen" })
);
await highlightAndExpectVisible(page, page.getByText("NTP Server 1"));
await highlightAndExpectVisible(
page,
page
.locator("div")
.filter({ hasText: /^NTP Server 1$/ })
.getByRole("textbox")
);
await highlightAndExpectVisible(page, page.getByText("NTP Server 3"));
await highlightAndExpectVisible(
page,
page
.locator("div")
.filter({ hasText: /^NTP Server 3$/ })
.getByRole("textbox")
);
await highlightAndExpectVisible(page, page.getByText("NTP Server 2"));
await highlightAndExpectVisible(
page,
page
.locator("div")
.filter({ hasText: /^NTP Server 2$/ })
.getByRole("textbox")
);
await highlightAndExpectVisible(page, page.getByText("Zeitzone"));
await highlightAndExpectVisible(
page,
page
.locator("div")
.filter({ hasText: /^Zeitzone$/ })
.getByRole("textbox")
);
await highlightAndExpectVisible(page, page.getByText("NTP aktiv:"));
await highlightAndExpectVisible(page, page.getByRole("checkbox"));
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Speichern" })
);
await page.getByRole("button", { name: "Benutzerverwaltung" }).click();
await highlightAndExpectVisible(
page,
page.getByRole("heading", { name: "Login Admin-Bereich" })
);
await highlightAndExpectVisible(
page,
page.getByRole("textbox", { name: "Benutzername" })
);
await highlightAndExpectVisible(
page,
page.getByRole("textbox", { name: "Passwort" })
);
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Admin anmelden" })
);
await page.getByRole("textbox", { name: "Benutzername" }).click();
await page.getByRole("textbox", { name: "Benutzername" }).fill("admin");
await page.getByRole("textbox", { name: "Passwort" }).click();
await page.getByRole("textbox", { name: "Passwort" }).fill("admin");
await page.getByRole("button", { name: "Admin anmelden" }).click();
await highlightAndExpectVisible(page, page.getByText("Login erfolgreich!"));
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Abmelden" })
);
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Admin anmelden" })
);
}
//---------------------------------------------------------------------