From 0de3b486807e57aff5c7c081ac482ba8fc3daf0a Mon Sep 17 00:00:00 2001 From: Michael Geers Date: Tue, 24 Jun 2025 14:00:56 +0200 Subject: [PATCH] chore: fix MQTT test skip mechanism if remote server is down (#22019) --- tests/config-mqtt.spec.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/config-mqtt.spec.ts b/tests/config-mqtt.spec.ts index dc611cfc7..fa0fc880a 100644 --- a/tests/config-mqtt.spec.ts +++ b/tests/config-mqtt.spec.ts @@ -26,18 +26,17 @@ const VALID_USERNAME = "rw"; const VALID_PASSWORD = "readwrite"; test.describe("mqtt", async () => { - let mqttReachable = true; - test.beforeAll(async () => { - mqttReachable = await isMqttReachable(VALID_BROKER, VALID_USERNAME, VALID_PASSWORD); - }); - test.skip(!mqttReachable, `MQTT broker ${VALID_BROKER} is not reachable, skipping tests`); - test("mqtt not configured", async ({ page }) => { await expect(page.getByTestId("mqtt")).toBeVisible(); await expect(page.getByTestId("mqtt")).toContainText(["Configured", "no"].join("")); }); test("mqtt via ui", async ({ page }) => { + test.skip( + !(await isMqttReachable(VALID_BROKER, VALID_USERNAME, VALID_PASSWORD)), + `MQTT broker ${VALID_BROKER} is not reachable, skipping tests` + ); + await page.getByTestId("mqtt").getByRole("button", { name: "edit" }).click(); const modal = await page.getByTestId("mqtt-modal"); await expectModalVisible(modal);