diff --git a/e2e-playwright/utils/dashboard-helpers.ts b/e2e-playwright/utils/dashboard-helpers.ts index ff73bfe919f..d37d3dee25e 100644 --- a/e2e-playwright/utils/dashboard-helpers.ts +++ b/e2e-playwright/utils/dashboard-helpers.ts @@ -21,7 +21,12 @@ export async function addDashboard(page: Page, title?: string): Promise // Click save const saveAsButton = page.getByTestId('data-testid Save dashboard drawer button'); - await saveAsButton.click(); + // Ensure button is ready and click using the method that works with React + // Doing simply saveAsButton.click doesn't work, even with force: true and when button is enabled + // It stopped working when https://github.com/grafana/grafana/pull/111518 introduced proper title validation + // This should be a an ok alternative since we are checking that the button is enabled first + await expect(saveAsButton).toBeEnabled(); + await saveAsButton.evaluate((btn: HTMLElement) => btn.click()); // Wait for success notification await expect(page.getByText('Dashboard saved')).toBeVisible(); diff --git a/public/app/features/dashboard-scene/saving/SaveDashboardAsForm.tsx b/public/app/features/dashboard-scene/saving/SaveDashboardAsForm.tsx index cc437b74486..aa5c53aa1fa 100644 --- a/public/app/features/dashboard-scene/saving/SaveDashboardAsForm.tsx +++ b/public/app/features/dashboard-scene/saving/SaveDashboardAsForm.tsx @@ -43,7 +43,7 @@ export function SaveDashboardAsForm({ dashboard, changeInfo }: Props) { }, }); - const { errors, isValid } = formState; + const { errors, isValid, validatingFields } = formState; const formValues = watch(); const { state, onSaveDashboard } = useSaveDashboard(false); @@ -85,7 +85,16 @@ export function SaveDashboardAsForm({ dashboard, changeInfo }: Props) { const saveButton = (overwrite: boolean) => { const showSaveButton = !isValid && hasFolderChanged ? true : isValid; - return ; + const isTitleValidating = !!validatingFields.title; + + return ( + + ); }; function renderFooter(error?: Error) { const formValuesMatchContentSent =