import type { Page } from "@playwright/test"; import { highlightAndExpectVisible } from "@playwright/utils/highlight"; import { navTest } from "@/playwright/tests/components/navigation/navTest"; import { headerTest } from "@/playwright/tests/components/header/headerTest"; import { footerTest } from "@/playwright/tests/components/footer/footerTest"; export async function runSettingsPageTest(page: Page) { await page.goto("/einstellungen"); //---------------------- await headerTest(page); await navTest(page); await footerTest(page); await page.waitForTimeout(400); //---------------------- //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" }) ); } //---------------------------------------------------------------------