fix: stabilize release e2e flows
This commit is contained in:
1 parent
81fdc5856b
commit
c4f6d98300
5 files changed
+14
-2246
No files matched your search
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { startTransition, useCallback, useEffect, useRef, useState } from "react";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import dynamic from "next/dynamic";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { Box, Center, Loader, Menu, ScrollArea } from "@mantine/core";
|
||||
@@ -161,7 +161,7 @@ const EditModeMenu = ({ demoReadOnly }: { demoReadOnly: boolean }) => {
|
||||
setIsEnteringEditMode(true);
|
||||
try {
|
||||
await prepareEditorAsync();
|
||||
startTransition(open);
|
||||
open();
|
||||
} catch {
|
||||
showErrorNotification({
|
||||
title: t("notification.loadError.title"),
|
||||
|
||||
+4
-3
@@ -2,7 +2,6 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import type { Dispatch, SetStateAction } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import type { UseFormReturnType } from "@mantine/form";
|
||||
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
@@ -37,7 +36,6 @@ interface FormActionsInput {
|
||||
}
|
||||
|
||||
export function useCustomWidgetFormActions(input: FormActionsInput) {
|
||||
const router = useRouter();
|
||||
const t = useScopedI18n("customWidget");
|
||||
const w = useScopedI18n("customWidget.workbench");
|
||||
const utils = clientApi.useUtils();
|
||||
@@ -70,7 +68,10 @@ export function useCustomWidgetFormActions(input: FormActionsInput) {
|
||||
title: t("action.create"),
|
||||
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) {
|
||||
await updateMutation.mutateAsync({
|
||||
id: input.definitionId,
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -70,9 +70,9 @@ describe("Custom JSX v2 workbench", () => {
|
||||
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 expect(page.getByText('Widget "E2E Custom JSX v2" created successfully.')).toBeVisible({ timeout: 15_000 });
|
||||
await page.waitForURL("**/manage/custom-widgets/edit/**", { timeout: 15_000 });
|
||||
await editPage;
|
||||
|
||||
await page.locator("#jsx-editor").fill(updatedTemplate);
|
||||
await page.getByRole("button", { name: "Save", exact: true }).last().click();
|
||||
@@ -92,11 +92,12 @@ describe("Custom JSX v2 workbench", () => {
|
||||
await editToggle.click();
|
||||
await expect(editToggle).toHaveAttribute("aria-pressed", "true", { timeout: 15_000 });
|
||||
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 customWidgetCard = picker.getByText("E2E Custom JSX v2", { exact: true }).locator("xpath=../../..");
|
||||
await customWidgetCard.hover();
|
||||
await customWidgetCard.getByRole("button", { name: "Add to board" }).click();
|
||||
await picker.getByRole("button", { name: /^E2E Custom JSX v2,/ }).click();
|
||||
const addDialog = page.getByRole("dialog").last();
|
||||
await expect(addDialog.getByText("E2E Custom JSX v2")).toBeVisible();
|
||||
await addDialog.getByRole("button", { name: "Save changes", exact: true }).click();
|
||||
|
||||
@@ -101,7 +101,7 @@ describe("Onboarding", () => {
|
||||
await page.locator("css=button[type='submit']").click();
|
||||
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 page.getByLabel("Default language").click();
|
||||
await page.getByRole("option", { name: /Français/ }).click();
|
||||
|
||||
Reference in new issue
Block a user