test: Tests erfolgreich mit base url von playwright.config.ts

This commit is contained in:
ISA
2025-09-11 10:11:11 +02:00
parent 74880d9ccc
commit 5ef7e648eb
17 changed files with 504 additions and 484 deletions

View File

@@ -0,0 +1,104 @@
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("System", async ({ page }) => {
await page.goto("/system");
// Gemeinsame Layout-Checks
await headerTest(page);
await navTest(page);
await footerTest(page);
await expect(
page.getByRole("heading", { name: "System Spannungen &" })
).toBeVisible();
await expect(page.getByRole("heading", { name: "+15V" })).toBeVisible();
await expect(page.getByText("15.06 VDetailansicht")).toBeVisible();
await expect(page.getByRole("heading", { name: "+5V" })).toBeVisible();
await expect(page.getByText("4.98 VDetailansicht")).toBeVisible();
await expect(page.getByRole("heading", { name: "-15V" })).toBeVisible();
await expect(page.getByText("-15.09 VDetailansicht")).toBeVisible();
await expect(page.getByRole("heading", { name: "-98V" })).toBeVisible();
await expect(page.getByText("-96.48 VDetailansicht")).toBeVisible();
await expect(page.getByRole("heading", { name: "ADC Temp" })).toBeVisible();
await expect(page.getByText("59.78 °CDetailansicht")).toBeVisible();
await expect(page.getByRole("heading", { name: "CPU Temp" })).toBeVisible();
await expect(page.getByText("56.92 °CDetailansicht")).toBeVisible();
await expect(page.getByRole("img").nth(2)).toBeVisible();
await expect(page.getByRole("img").nth(3)).toBeVisible();
await page
.getByRole("paragraph")
.filter({ hasText: "15.06 VDetailansicht" })
.getByRole("button")
.click();
await expect(page.getByRole("dialog")).toMatchAriaSnapshot(`
- 'heading "Detailansicht: +15V" [level=2]'
- button "Vollbild"
- button "Modal schließen"
`);
await expect(page.getByRole("dialog")).toMatchAriaSnapshot(`
- text: Von
- textbox: /\\d+\\.\\d+\\.\\d+/
- text: Bis
- textbox: /\\d+\\.\\d+\\.\\d+/
- text: "Zeitraum:"
- button "Alle Messwerte":
- img
- button "Daten laden"
`);
await expect(page.getByRole("dialog")).toMatchAriaSnapshot(`
- text: Von
- textbox: /\\d+\\.\\d+\\.\\d+/
- text: Bis
- textbox: /\\d+\\.\\d+\\.\\d+/
- text: "Zeitraum:"
- button "Alle Messwerte":
- img
- button "Daten laden"
- img
`);
await page.getByRole("button", { name: "Alle Messwerte" }).click();
await page.getByRole("option", { name: "Stündlich" }).click();
await expect(page.getByRole("button", { name: "Stündlich" })).toBeVisible();
await page.getByRole("button", { name: "Stündlich" }).click();
await page.getByRole("option", { name: "Täglich" }).click();
await expect(page.getByRole("button", { name: "Täglich" })).toBeVisible();
await page
.locator("div")
.filter({ hasText: /^Von$/ })
.getByRole("textbox")
.click();
await expect(page.getByLabel("Sunday", { exact: true })).toBeVisible();
await expect(page.getByLabel("Monday", { exact: true })).toBeVisible();
await expect(page.getByLabel("Tuesday", { exact: true })).toBeVisible();
await expect(page.getByLabel("Wednesday", { exact: true })).toBeVisible();
await expect(page.getByLabel("Thursday", { exact: true })).toBeVisible();
await expect(page.getByLabel("Friday", { exact: true })).toBeVisible();
await expect(page.getByLabel("Saturday", { exact: true })).toBeVisible();
await page
.locator("div")
.filter({ hasText: /^Bis$/ })
.getByRole("textbox")
.click();
await expect(page.getByLabel("Sunday", { exact: true })).toBeVisible();
await expect(page.getByLabel("Monday", { exact: true })).toBeVisible();
await expect(page.getByLabel("Tuesday", { exact: true })).toBeVisible();
await expect(page.getByLabel("Wednesday", { exact: true })).toBeVisible();
await expect(page.getByLabel("Thursday", { exact: true })).toBeVisible();
await expect(page.getByLabel("Friday", { exact: true })).toBeVisible();
await expect(page.getByLabel("Saturday", { exact: true })).toBeVisible();
await page
.locator("header")
.filter({ hasText: "Detailansicht: +15V" })
.click();
await page.getByRole("button", { name: "Vollbild" }).click();
await page.getByRole("button", { name: "Vollbild verlassen" }).click();
await page.getByRole("button", { name: "Modal schließen" }).click();
});

View File

@@ -1,109 +0,0 @@
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 runSystemTest(page: Page) {
await page.goto("/system");
//----------------------
await headerTest(page);
await navTest(page);
await footerTest(page);
await page.waitForTimeout(400);
//----------------------
// System Spannungen &
const systemSpannung = page.getByRole("heading", {
name: "System Spannungen &",
});
await highlightAndExpectVisible(page, systemSpannung);
await systemSpannung.click();
await page.waitForTimeout(100);
// +15V
const plus15V = page.getByRole("heading", { name: "+15V" });
await highlightAndExpectVisible(page, plus15V);
await plus15V.click();
await page.waitForTimeout(100);
// 15.06 VDetailansicht
const v15Detail = page.getByText("15.06 VDetailansicht");
await highlightAndExpectVisible(page, v15Detail);
await v15Detail.click();
await page.waitForTimeout(100);
// +5V
const plus5V = page.getByRole("heading", { name: "+5V" });
await highlightAndExpectVisible(page, plus5V);
await plus5V.click();
await page.waitForTimeout(100);
// 4.98 VDetailansicht
const v5Detail = page.getByText("4.98 VDetailansicht");
await highlightAndExpectVisible(page, v5Detail);
await v5Detail.click();
await page.waitForTimeout(100);
// -15V
const minus15V = page.getByRole("heading", { name: "-15V" });
await highlightAndExpectVisible(page, minus15V);
await minus15V.click();
await page.waitForTimeout(100);
// -15.09 VDetailansicht
const vMinus15Detail = page.getByText("-15.09 VDetailansicht");
await highlightAndExpectVisible(page, vMinus15Detail);
await vMinus15Detail.click();
await page.waitForTimeout(100);
// -98V
const minus98V = page.getByRole("heading", { name: "-98V" });
await highlightAndExpectVisible(page, minus98V);
await minus98V.click();
await page.waitForTimeout(100);
// -96.48 VDetailansicht
const vMinus98Detail = page.getByText("-96.48 VDetailansicht");
await highlightAndExpectVisible(page, vMinus98Detail);
await vMinus98Detail.click();
await page.waitForTimeout(100);
// ADC Temp
const adcTemp = page.getByRole("heading", { name: "ADC Temp" });
await highlightAndExpectVisible(page, adcTemp);
await adcTemp.click();
await page.waitForTimeout(100);
// 59.78 °CDetailansicht
const adcTempDetail = page.getByText("59.78 °CDetailansicht");
await highlightAndExpectVisible(page, adcTempDetail);
await adcTempDetail.click();
await page.waitForTimeout(100);
// CPU Temp
const cpuTemp = page.getByRole("heading", { name: "CPU Temp" });
await highlightAndExpectVisible(page, cpuTemp);
await cpuTemp.click();
await page.waitForTimeout(100);
await highlightAndExpectVisible(page, cpuTemp);
await cpuTemp.click();
await page.waitForTimeout(100);
// 56.92 °CDetailansicht
const cpuTempDetail = page.getByText("56.92 °CDetailansicht");
await highlightAndExpectVisible(page, cpuTempDetail);
await cpuTempDetail.click();
await page.waitForTimeout(100);
// img nth(2)
const img2 = page.getByRole("img").nth(2);
await highlightAndExpectVisible(page, img2);
await img2.click({ position: { x: 72, y: 53 } });
await page.waitForTimeout(100);
// img nth(3)
const img3 = page.getByRole("img").nth(3);
await highlightAndExpectVisible(page, img3);
await img3.click({ position: { x: 272, y: 93 } });
await page.waitForTimeout(100);
}