fix: DigitalOutputsVies.tsx

This commit is contained in:
ISA
2025-09-03 14:06:35 +02:00
parent a9ccdfc9ab
commit 2c92ca0866
8 changed files with 60 additions and 49 deletions

View File

@@ -6,6 +6,6 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false
NEXT_PUBLIC_EXPORT_STATIC=false NEXT_PUBLIC_EXPORT_STATIC=false
NEXT_PUBLIC_USE_CGI=false NEXT_PUBLIC_USE_CGI=false
# App-Versionsnummer # App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.6.829 NEXT_PUBLIC_APP_VERSION=1.6.830
NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter) NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter)

View File

@@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL
NEXT_PUBLIC_EXPORT_STATIC=true NEXT_PUBLIC_EXPORT_STATIC=true
NEXT_PUBLIC_USE_CGI=true NEXT_PUBLIC_USE_CGI=true
# App-Versionsnummer # App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.6.829 NEXT_PUBLIC_APP_VERSION=1.6.830
NEXT_PUBLIC_CPL_MODE=production NEXT_PUBLIC_CPL_MODE=production

View File

@@ -1,3 +1,8 @@
## [1.6.830] 2025-09-03
- feat: Messverlauf bei Systemwerten (Temperatur und Spannungen) mit Datumsauswahl
---
## [1.6.829] 2025-09-03 ## [1.6.829] 2025-09-03
- feat(mocks): mesages_all.json mock script - feat(mocks): mesages_all.json mock script

View File

@@ -18,6 +18,10 @@ const DigitalOutputsView: React.FC = () => {
const [isOutputModalOpen, setIsOutputModalOpen] = useState(false); const [isOutputModalOpen, setIsOutputModalOpen] = useState(false);
useEffect(() => { useEffect(() => {
// Fetch immediately on mount to ensure data is present without waiting for the first interval
dispatch(getDigitalOutputsThunk());
// Then continue polling periodically
const interval = setInterval(() => { const interval = setInterval(() => {
dispatch(getDigitalOutputsThunk()); dispatch(getDigitalOutputsThunk());
}, 3000); }, 3000);

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "cpl-v4", "name": "cpl-v4",
"version": "1.6.829", "version": "1.6.830",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "cpl-v4", "name": "cpl-v4",
"version": "1.6.829", "version": "1.6.830",
"dependencies": { "dependencies": {
"@fontsource/roboto": "^5.1.0", "@fontsource/roboto": "^5.1.0",
"@headlessui/react": "^2.2.4", "@headlessui/react": "^2.2.4",

View File

@@ -1,6 +1,6 @@
{ {
"name": "cpl-v4", "name": "cpl-v4",
"version": "1.6.829", "version": "1.6.830",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev -p 3000", "dev": "next dev -p 3000",

View File

@@ -1,5 +1,4 @@
import type { Page } from "@playwright/test"; import type { Page } from "@playwright/test";
import { expect } from "@playwright/test";
import { highlightAndExpectVisible } from "@playwright/utils/highlight"; import { highlightAndExpectVisible } from "@playwright/utils/highlight";
import { navTest } from "@playwright/components/navTest"; import { navTest } from "@playwright/components/navTest";
import { headerTest } from "@/playwright/components/header/headerTest"; import { headerTest } from "@/playwright/components/header/headerTest";
@@ -11,6 +10,7 @@ export async function runDigitalOutputsTest(page: Page) {
await headerTest(page); await headerTest(page);
await navTest(page); await navTest(page);
await footerTest(page); await footerTest(page);
// Wait a moment for initial redux fetch and render in slower CI environments
await page.waitForTimeout(400); await page.waitForTimeout(400);
//---------------------- //----------------------
await highlightAndExpectVisible(page, page.locator("h1")); await highlightAndExpectVisible(page, page.locator("h1"));
@@ -26,13 +26,17 @@ export async function runDigitalOutputsTest(page: Page) {
.locator("svg") .locator("svg")
.click(); .click();
page.locator("h2").filter({ hasText: "Schaltausgänge" }).click(); page.locator("h2").filter({ hasText: "Schaltausgänge" }).click();
await highlightAndExpectVisible( // Wait for the outputs table to render and be visible
page, const table = page.locator("table");
page.getByRole("cell", { name: "Ausgang", exact: true }) await table.first().waitFor({ state: "visible", timeout: 15000 });
);
const ausgang2Cell = page.getByRole("cell", { name: "Ausgang2" }).nth(1); // Prefer robust selection: select the row by its first cell text matching the id "2"
await ausgang2Cell.waitFor({ state: "visible", timeout: 15000 }); // bis zu 15 Sekunden warten const rowAusgang2 = table
await ausgang2Cell.click(); .getByRole("row")
.filter({ has: page.getByRole("cell", { name: /^\s*2\s*$/ }) })
.first();
await rowAusgang2.waitFor({ state: "visible", timeout: 15000 });
await rowAusgang2.click();
await highlightAndExpectVisible( await highlightAndExpectVisible(
page, page,
page.getByRole("cell", { name: "Schalter" }) page.getByRole("cell", { name: "Schalter" })
@@ -45,12 +49,16 @@ export async function runDigitalOutputsTest(page: Page) {
page, page,
page.getByRole("cell", { name: "Aktion" }) page.getByRole("cell", { name: "Aktion" })
); );
page.getByRole("cell", { name: "1" }).locator("svg").click(); // Interact with the switch icon within each row deterministically
//page.getByRole("cell", { name: "1" }).click(); for (const id of [1, 2, 3, 4]) {
page.getByRole("cell", { name: "2", exact: true }).locator("svg").click(); const row = table
page.getByRole("cell", { name: "2", exact: true }).click(); .getByRole("row")
page.getByRole("cell", { name: "3", exact: true }).locator("svg").click(); .filter({
page.getByRole("cell", { name: "3", exact: true }).click(); has: page.getByRole("cell", { name: new RegExp(`^\\s*${id}\\s*$`) }),
page.getByRole("cell", { name: "4", exact: true }).locator("svg").click(); })
page.getByRole("cell", { name: "4", exact: true }).click(); .first();
await row.waitFor({ state: "visible", timeout: 10000 });
const switchIcon = row.locator("td >> nth=2").locator("svg");
await switchIcon.first().click();
}
} }

View File

@@ -97,34 +97,28 @@ export async function runMeldungenTest(page: Page) {
await page.waitForTimeout(30); await page.waitForTimeout(30);
} }
// Dynamische Zeilen und Zellen (Beispiel für mehrere Zeitstempel) // Interact with the first few data rows generically instead of hardcoded timestamps
const zeiten = [ const table = page.locator("table");
"11.08.2025, 11:52:44", await table.first().waitFor({ state: "visible", timeout: 15000 });
"11.08.2025, 11:51:14", const rows = table.locator("tbody tr");
"11.08.2025, 11:44:19", const rowCount = await rows.count();
"11.08.2025, 11:43:44", const maxRows = Math.min(5, rowCount);
"11.08.2025, 11:36:42", for (let i = 0; i < maxRows; i++) {
"11.08.2025, 11:35:45", const row = rows.nth(i);
"11.08.2025, 11:21:16", const firstCell = row.locator("td").first();
"11.08.2025, 11:21:05", await highlightAndExpectVisible(page, firstCell);
"11.08.2025, 11:14:01", await firstCell.click();
]; // click a couple of other cells if present
for (const zeit of zeiten) { const secondCell = row.locator("td").nth(1);
const row = page.getByRole("row", { name: zeit }); if (await secondCell.count()) {
await highlightAndExpectVisible(page, row.getByRole("cell").first()); await highlightAndExpectVisible(page, secondCell);
await row.getByRole("cell").first().click(); await secondCell.click();
await page.waitForTimeout(20);
const timeCell = page.getByRole("cell", { name: zeit.split(", ")[1] });
await highlightAndExpectVisible(page, timeCell);
await timeCell.click();
await page.waitForTimeout(20);
for (let i = 2; i <= 4; i++) {
const cell = row.getByRole("cell").nth(i);
await highlightAndExpectVisible(page, cell);
await cell.click();
await page.waitForTimeout(20);
} }
const thirdCell = row.locator("td").nth(2);
if (await thirdCell.count()) {
await highlightAndExpectVisible(page, thirdCell);
await thirdCell.click();
}
await page.waitForTimeout(20);
} }
} }