fix: stabilize release e2e flows

This commit is contained in:
ajnart committed 2026-08-14 12:11:33 +02:00
1 parent 81fdc5856b
commit c4f6d98300
5 files changed
+14 -2246

No files matched your search

@@ -1,6 +1,6 @@
"use client"; "use client";
import { startTransition, useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useEffect, useRef, useState } from "react";
import dynamic from "next/dynamic"; import dynamic from "next/dynamic";
import { useRouter, useSearchParams } from "next/navigation"; import { useRouter, useSearchParams } from "next/navigation";
import { Box, Center, Loader, Menu, ScrollArea } from "@mantine/core"; import { Box, Center, Loader, Menu, ScrollArea } from "@mantine/core";
@@ -161,7 +161,7 @@ const EditModeMenu = ({ demoReadOnly }: { demoReadOnly: boolean }) => {
setIsEnteringEditMode(true); setIsEnteringEditMode(true);
try { try {
await prepareEditorAsync(); await prepareEditorAsync();
startTransition(open); open();
} catch { } catch {
showErrorNotification({ showErrorNotification({
title: t("notification.loadError.title"), title: t("notification.loadError.title"),
@@ -2,7 +2,6 @@
import { useState } from "react"; import { useState } from "react";
import type { Dispatch, SetStateAction } from "react"; import type { Dispatch, SetStateAction } from "react";
import { useRouter } from "next/navigation";
import type { UseFormReturnType } from "@mantine/form"; import type { UseFormReturnType } from "@mantine/form";
import { clientApi } from "@homarr/api/client"; import { clientApi } from "@homarr/api/client";
@@ -37,7 +36,6 @@ interface FormActionsInput {
} }
export function useCustomWidgetFormActions(input: FormActionsInput) { export function useCustomWidgetFormActions(input: FormActionsInput) {
const router = useRouter();
const t = useScopedI18n("customWidget"); const t = useScopedI18n("customWidget");
const w = useScopedI18n("customWidget.workbench"); const w = useScopedI18n("customWidget.workbench");
const utils = clientApi.useUtils(); const utils = clientApi.useUtils();
@@ -70,7 +68,10 @@ export function useCustomWidgetFormActions(input: FormActionsInput) {
title: t("action.create"), title: t("action.create"),
message: t("notification.created", { name: values.name }), message: t("notification.created", { name: values.name }),
}); });
router.push(`/manage/custom-widgets/edit/${result.id}`); input.form.setInitialValues(values);
input.form.resetDirty();
await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));
window.location.assign(result.managementPath);
} else if (input.definitionId) { } else if (input.definitionId) {
await updateMutation.mutateAsync({ await updateMutation.mutateAsync({
id: input.definitionId, id: input.definitionId,
File diff suppressed because it is too large. Load diff
+7 -6
View File
@@ -70,9 +70,9 @@ describe("Custom JSX v2 workbench", () => {
timeout: 15_000, timeout: 15_000,
}); });
const editPage = page.waitForURL("**/manage/custom-widgets/edit/**", { timeout: 15_000, waitUntil: "commit" });
await page.getByRole("button", { name: "Create", exact: true }).last().click(); await page.getByRole("button", { name: "Create", exact: true }).last().click();
await expect(page.getByText('Widget "E2E Custom JSX v2" created successfully.')).toBeVisible({ timeout: 15_000 }); await editPage;
await page.waitForURL("**/manage/custom-widgets/edit/**", { timeout: 15_000 });
await page.locator("#jsx-editor").fill(updatedTemplate); await page.locator("#jsx-editor").fill(updatedTemplate);
await page.getByRole("button", { name: "Save", exact: true }).last().click(); await page.getByRole("button", { name: "Save", exact: true }).last().click();
@@ -92,11 +92,12 @@ describe("Custom JSX v2 workbench", () => {
await editToggle.click(); await editToggle.click();
await expect(editToggle).toHaveAttribute("aria-pressed", "true", { timeout: 15_000 }); await expect(editToggle).toHaveAttribute("aria-pressed", "true", { timeout: 15_000 });
await page.getByRole("button", { name: "Add board content", exact: true }).click(); await page.getByRole("button", { name: "Add board content", exact: true }).click();
await page.getByRole("menuitem", { name: "New item", exact: true }).click(); await page
.getByRole("dialog", { name: "Create" })
.getByRole("button", { name: /^Add widget / })
.click();
const picker = page.getByRole("dialog").last(); const picker = page.getByRole("dialog").last();
const customWidgetCard = picker.getByText("E2E Custom JSX v2", { exact: true }).locator("xpath=../../.."); await picker.getByRole("button", { name: /^E2E Custom JSX v2,/ }).click();
await customWidgetCard.hover();
await customWidgetCard.getByRole("button", { name: "Add to board" }).click();
const addDialog = page.getByRole("dialog").last(); const addDialog = page.getByRole("dialog").last();
await expect(addDialog.getByText("E2E Custom JSX v2")).toBeVisible(); await expect(addDialog.getByText("E2E Custom JSX v2")).toBeVisible();
await addDialog.getByRole("button", { name: "Save changes", exact: true }).click(); await addDialog.getByRole("button", { name: "Save changes", exact: true }).click();
+1 -1
View File
@@ -101,7 +101,7 @@ describe("Onboarding", () => {
await page.locator("css=button[type='submit']").click(); await page.locator("css=button[type='submit']").click();
await page.getByRole("heading", { name: "Start with familiar defaults" }).waitFor({ timeout: 30_000 }); await page.getByRole("heading", { name: "Start with familiar defaults" }).waitFor({ timeout: 30_000 });
const serverOrigin = page.getByLabel("Usual server address"); const serverOrigin = page.getByRole("textbox", { name: "Usual server address" });
await serverOrigin.fill("https://home.example/homarr"); await serverOrigin.fill("https://home.example/homarr");
await page.getByLabel("Default language").click(); await page.getByLabel("Default language").click();
await page.getByRole("option", { name: /Français/ }).click(); await page.getByRole("option", { name: /Français/ }).click();