Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/playwright/impact-map.generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
"specs": [
"playwright/e2e/Features/AIMode/AppModeSidebarPersonaCustomization.spec.ts",
"playwright/e2e/Features/AIMode/ConnectionServiceDetails.spec.ts",
"playwright/e2e/Features/AIMode/HomePageCustomizeExit.spec.ts",
"playwright/e2e/Features/AIMode/InboxActivity.spec.ts",
"playwright/e2e/Features/AIMode/InboxTaskMatrix.spec.ts",
"playwright/e2e/Features/AIMode/InboxTasks.spec.ts",
Expand Down Expand Up @@ -753,6 +754,7 @@
"playwright/e2e/Features/AIMode/AppModeSidebarPersonaCustomization.spec.ts",
"playwright/e2e/Features/AIMode/ConnectionServiceDetails.spec.ts",
"playwright/e2e/Features/AIMode/CustomPropertiesPanel.spec.ts",
"playwright/e2e/Features/AIMode/HomePageCustomizeExit.spec.ts",
"playwright/e2e/Features/AIMode/IncidentGroups.spec.ts",
"playwright/e2e/Features/AIMode/Observability.spec.ts",
"playwright/e2e/Features/AIMode/ObservabilityClickPaths.spec.ts",
Expand Down Expand Up @@ -2473,6 +2475,7 @@
"openmetadata-ui/src/main/resources/ui/playwright/support/fixtures/isolatedUser.ts"
],
"specs": [
"playwright/e2e/Features/AIMode/HomePageCustomizeExit.spec.ts",
"playwright/e2e/Features/AIMode/InboxActivity.spec.ts",
"playwright/e2e/Features/AIMode/InboxTaskMatrix.spec.ts",
"playwright/e2e/Features/AIMode/InboxTasks.spec.ts",
Expand Down Expand Up @@ -2721,6 +2724,7 @@
],
"specs": [
"playwright/e2e/Features/AIMode/AppModeSidebarPersonaCustomization.spec.ts",
"playwright/e2e/Features/AIMode/HomePageCustomizeExit.spec.ts",
"playwright/e2e/Features/AIMode/PersonaSettings.spec.ts",
"playwright/e2e/Features/AppMode/AppModeAiPersonaLandsAtRoot.spec.ts",
"playwright/e2e/Features/AppMode/AppModePrecedence.spec.ts",
Expand Down Expand Up @@ -3536,6 +3540,7 @@
"playwright/e2e/Features/AIMode/AppModeSidebarPersonaCustomization.spec.ts",
"playwright/e2e/Features/AIMode/ConnectionServiceDetails.spec.ts",
"playwright/e2e/Features/AIMode/CustomPropertiesPanel.spec.ts",
"playwright/e2e/Features/AIMode/HomePageCustomizeExit.spec.ts",
"playwright/e2e/Features/AIMode/InboxActivity.spec.ts",
"playwright/e2e/Features/AIMode/InboxTaskMatrix.spec.ts",
"playwright/e2e/Features/AIMode/InboxTasks.spec.ts",
Expand Down Expand Up @@ -5459,6 +5464,7 @@
"playwright/e2e/Features/AIMode/AiAlertSeveralSources.spec.ts",
"playwright/e2e/Features/AIMode/ConnectionServiceDetails.spec.ts",
"playwright/e2e/Features/AIMode/CustomPropertiesPanel.spec.ts",
"playwright/e2e/Features/AIMode/HomePageCustomizeExit.spec.ts",
"playwright/e2e/Features/AIMode/InboxActivity.spec.ts",
"playwright/e2e/Features/AIMode/InboxTaskMatrix.spec.ts",
"playwright/e2e/Features/AIMode/InboxTasks.spec.ts",
Expand Down Expand Up @@ -8019,6 +8025,7 @@
"openmetadata-ui/src/main/resources/ui/src/components/Modals/UnsavedChangesModal/UnsavedChangesModal.component.tsx"
],
"specs": [
"playwright/e2e/Features/AIMode/HomePageCustomizeExit.spec.ts",
"playwright/e2e/Features/AIMode/PersonaSettings.spec.ts",
"playwright/e2e/Features/CustomizeNavigationNewItems.spec.ts",
"playwright/e2e/Features/NavigationBlocker.spec.ts",
Expand Down Expand Up @@ -8120,6 +8127,7 @@
"openmetadata-ui/src/main/resources/ui/src/components/MyData/HomeLandingPage/HomeLandingPage.tsx"
],
"specs": [
"playwright/e2e/Features/AIMode/HomePageCustomizeExit.spec.ts",
"playwright/e2e/Features/AppMode/AppModeUrlHandling.spec.ts",
"playwright/e2e/Features/LandingPageWidgets/LandingPage.spec.ts",
"playwright/e2e/Features/LandingPageWidgets/LandingPageTopicWidgets.spec.ts",
Expand All @@ -8140,6 +8148,7 @@
"openmetadata-ui/src/main/resources/ui/src/components/MyData/HomeLandingPage/TopicsSectionHeader.tsx"
],
"specs": [
"playwright/e2e/Features/AIMode/HomePageCustomizeExit.spec.ts",
"playwright/e2e/Features/LandingPageWidgets/LandingPage.spec.ts",
"playwright/e2e/Features/LandingPageWidgets/LandingPageTopicWidgets.spec.ts"
]
Expand Down Expand Up @@ -10746,6 +10755,7 @@
"specs": [
"playwright/e2e/Features/AIMode/AiNotificationAlerts.spec.ts",
"playwright/e2e/Features/AIMode/CustomPropertiesPanel.spec.ts",
"playwright/e2e/Features/AIMode/HomePageCustomizeExit.spec.ts",
"playwright/e2e/Features/AIMode/PersonaSettings.spec.ts",
"playwright/e2e/Features/AppMode/AppModeUrlHandling.spec.ts",
"playwright/e2e/Features/ApplicationsSettingsModal.spec.ts",
Expand Down Expand Up @@ -12976,6 +12986,7 @@
"playwright/e2e/Features/AIMode/AppModeSidebarPersonaCustomization.spec.ts",
"playwright/e2e/Features/AIMode/ConnectionServiceDetails.spec.ts",
"playwright/e2e/Features/AIMode/CustomPropertiesPanel.spec.ts",
"playwright/e2e/Features/AIMode/HomePageCustomizeExit.spec.ts",
"playwright/e2e/Features/AIMode/InboxActivity.spec.ts",
"playwright/e2e/Features/AIMode/InboxTaskMatrix.spec.ts",
"playwright/e2e/Features/AIMode/InboxTasks.spec.ts",
Expand Down
22 changes: 22 additions & 0 deletions .github/playwright/impact-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,28 @@
"playwright/e2e/Features/CustomizeNavigationNewItems.spec.ts"
]
},
{
"_comment": "TagsUtils builds the classification page's tag table actions (edit / delete / enable) and shared tag helpers used by the tag pages.",
"sources": [
"openmetadata-ui/src/main/resources/ui/src/utils/TagsUtils.tsx"
],
"projects": ["chromium"],
"specs": [
"playwright/e2e/Pages/Tags.spec.ts",
"playwright/e2e/Pages/Tag.spec.ts",
"playwright/e2e/Pages/ClassificationConditionalRendering.spec.ts"
]
},
{
"_comment": "In AI mode the home page's Customize button opens the standalone customize route; its header owns where closing (with or without unsaved changes) lands.",
"sources": [
"openmetadata-ui/src/main/resources/ui/src/components/MyData/CustomizableComponents/CustomizablePageHeader/**"
],
"projects": ["chromium"],
"specs": [
"playwright/e2e/Features/AIMode/HomePageCustomizeExit.spec.ts"
]
},
{
"_comment": "Default glossary and glossary-term page layouts and their widget registry. Persona customization edits these layouts, and the glossary pages render them.",
"sources": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,22 @@ describe('ConfirmPopover', () => {
).toHaveAttribute('aria-expanded', 'true');
});

it('omits Cancel when showCancel is false and still dismisses on Escape', async () => {
const onCancel = vi.fn();
renderWithTrigger({ onCancel, showCancel: false });

await userEvent.click(screen.getByRole('button', { name: 'Trash' }));

expect(screen.queryByTestId('confirm-popover-cancel')).toBeNull();

await userEvent.keyboard('{Escape}');

await waitFor(() =>
expect(screen.queryByTestId('confirm-popover')).toBeNull()
);
expect(onCancel).toHaveBeenCalledTimes(1);
});

it('closes after an async confirm resolves', async () => {
let resolve: () => void = () => undefined;
const onConfirm = vi.fn(() => new Promise<void>((r) => (resolve = r)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ export interface ConfirmPopoverProps {
onCancel?: () => void;
confirmText?: ReactNode;
cancelText?: ReactNode;
/**
* Hide the Cancel button when every footer action moves forward (e.g.
* Discard / Save before leaving); Escape and an outside click still cancel,
* and the remaining buttons split the width.
* @default true
*/
showCancel?: boolean;
/** @default 'destructive' */
variant?: 'destructive' | 'primary';
isConfirmDisabled?: boolean;
Expand Down Expand Up @@ -108,6 +115,7 @@ export const ConfirmPopover = ({
onCancel,
confirmText,
cancelText,
showCancel = true,
variant = 'destructive',
isConfirmDisabled,
actions = [],
Expand All @@ -121,6 +129,7 @@ export const ConfirmPopover = ({
const isOpen = controlledOpen ?? uncontrolledOpen;
const isPending = pendingKey !== undefined;
const titleId = useId();
const footerButtonClass = showCancel ? undefined : 'tw:flex-1';

const setOpen = (open: boolean) => {
// An action in flight can't be cancelled, so nothing may close the popover.
Expand Down Expand Up @@ -185,16 +194,19 @@ export const ConfirmPopover = ({
</div>
{content}
<div className="tw:flex tw:flex-wrap tw:justify-end tw:gap-2">
<Button
color="secondary"
data-testid={`${dataTestId}-cancel`}
isDisabled={isPending}
size="sm"
onPress={() => setOpen(false)}>
{cancelText ?? t('label.cancel')}
</Button>
{showCancel && (
<Button
color="secondary"
data-testid={`${dataTestId}-cancel`}
isDisabled={isPending}
size="sm"
onPress={() => setOpen(false)}>
{cancelText ?? t('label.cancel')}
</Button>
)}
{actions.map((action) => (
<Button
className={footerButtonClass}
color={action.color ?? 'secondary'}
data-testid={action['data-testid']}
isDisabled={action.isDisabled || isPending}
Expand All @@ -206,6 +218,7 @@ export const ConfirmPopover = ({
</Button>
))}
<Button
className={footerButtonClass}
color={variant === 'destructive' ? 'primary-destructive' : 'primary'}
data-testid={`${dataTestId}-confirm`}
isDisabled={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,21 @@ export const AnchoredToRef: StoryObj = {
return <ControlledExample />;
},
};

export const SaveBeforeLeaving: StoryObj = {
render: () => (
<ConfirmPopover
actions={[
{ key: 'discard', label: 'Discard & go', onPress: () => undefined },
]}
confirmText="Save & go"
showCancel={false}
title="Save your changes first?"
variant="primary"
onConfirm={wait}>
<Button color="secondary" size="sm">
Cancel
</Button>
</ConfirmPopover>
),
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
/*
* Copyright 2026 Collate.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* In AI mode the home page's Customize button opens the standalone
* `/customize-page/<persona>/LandingPage` route. Closing it must return to the
* home page — asking first when there are unsaved changes — and must never
* open the settings modal over the editor.
*/

import { expect, Page, Response } from '@playwright/test';
import { DOMAIN_TAGS } from '../../../constant/config';
import { test as isolatedUserTest } from '../../../support/fixtures/isolatedUser';
import { PersonaClass } from '../../../support/persona/PersonaClass';
import { getWorkerAdminAPIContext, uuid } from '../../../utils/common';
import { waitForResponseWithStatus } from '../../../utils/waitHelpers';
import { redirectToAiModeHomePage } from '../../Utils/appMode';

const toPersonaReference = (persona: PersonaClass) => ({
id: persona.responseData.id,
name: persona.responseData.name,
displayName: persona.responseData.displayName,
fullyQualifiedName: persona.responseData.fullyQualifiedName,
type: 'persona',
});

// The home page offers Customize only to a user with a default persona, and
// that persona is server-side state on the user, so the user is the worker's
// isolated admin rather than the shared one.
const test = isolatedUserTest.extend<{ defaultPersona: PersonaClass }>({
defaultPersona: async ({ isolatedUser }, use) => {
const apiContext = await getWorkerAdminAPIContext();
const id = uuid();
const defaultPersona = new PersonaClass({
name: `pw-home-exit-${id}`,
displayName: `PW home exit ${id}`,
description: 'playwright home customize exit',
users: [],
});
await defaultPersona.create(apiContext);
await isolatedUser.patch({
apiContext,
patchData: [
{
op: 'add',
path: '/personas/0',
value: toPersonaReference(defaultPersona),
},
{
op: 'add',
path: '/defaultPersona',
value: toPersonaReference(defaultPersona),
},
],
});

await use(defaultPersona);

await defaultPersona.delete(apiContext);
},
});

test.use({ isolatedUserOptions: { isAdmin: true } });

// The landing-page editor's widgets load before Save reflects the layout.
const CUSTOMIZE_BOOT_TIMEOUT = 60_000;

const isLayoutSave = (response: Response) =>
response.url().includes('/api/v1/docStore') &&
['POST', 'PATCH'].includes(response.request().method());

const openHomeCustomize = async (page: Page, persona: PersonaClass) => {
await redirectToAiModeHomePage(page);
await page.getByTestId('customize-home-page').click();

await expect(page).toHaveURL(
new RegExp(`/customize-page/${persona.data.name}/LandingPage`)
);
// A fresh persona has no saved layout, so the seeded default is unsaved.
await expect(page.getByTestId('save-button')).toBeEnabled({
timeout: CUSTOMIZE_BOOT_TIMEOUT,
});
};

const expectOnHomeWithoutSettings = async (page: Page) => {
await expect(page.getByTestId('topics-to-catch-up-on')).toBeVisible();
await expect(page).toHaveURL((url) => url.pathname === '/');
await expect(page.getByTestId('ai-profile-page')).not.toBeVisible();
await expect(page.getByTestId('unsaved-changes-modal')).not.toBeVisible();
};

test.describe(
'Home page customize — closing returns to the home page',
{ tag: [DOMAIN_TAGS.PLATFORM] },
() => {
test('close without changes goes straight home', async ({
isolatedUserPage: page,
defaultPersona,
}) => {
test.slow();
await openHomeCustomize(page, defaultPersona);

// Save the seeded layout so the page has nothing left to lose.
const saveResponse = waitForResponseWithStatus(
page,
isLayoutSave,
[200, 201]
);
await page.getByTestId('save-button').click();
await saveResponse;

await expect(page.getByTestId('save-button')).toBeDisabled();

await page.getByTestId('cancel-button').click();

await expectOnHomeWithoutSettings(page);
});

test('close with unsaved changes asks, and Discard goes home', async ({
isolatedUserPage: page,
defaultPersona,
}) => {
test.slow();
await openHomeCustomize(page, defaultPersona);

await page.getByTestId('cancel-button').click();

await expect(page.getByTestId('unsaved-changes-modal')).toBeVisible();
await expect(page.getByTestId('ai-profile-page')).not.toBeVisible();

await page.getByTestId('unsaved-changes-modal-discard').click();

await expectOnHomeWithoutSettings(page);
});
}
);
Loading
Loading