diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/CustomizeDetailPage.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/CustomizeDetailPage.spec.ts index 65e86d77f77..1fc33370ee9 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/CustomizeDetailPage.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/CustomizeDetailPage.spec.ts @@ -10,7 +10,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { expect, Page, test as base } from '@playwright/test'; +import { test as base, expect, Page } from '@playwright/test'; import { ECustomizedDataAssets, ECustomizedGovernance, @@ -32,6 +32,7 @@ import { checkDefaultStateForNavigationTree, validateLeftSidebarWithHiddenItems, } from '../../utils/customizeNavigation'; +import { navigateToPersonaWithPagination } from '../../utils/persona'; import { settingClick } from '../../utils/sidebar'; const persona = new PersonaClass(); @@ -345,11 +346,19 @@ test.describe('Persona customization', () => { await test.step( `should show all the tabs & widget as default when no customization is done`, async () => { + const personaListResponse = + adminPage.waitForResponse(`/api/v1/personas?*`); await settingClick(adminPage, GlobalSettingOptions.PERSONA); - await adminPage.waitForLoadState('networkidle'); - await adminPage - .getByTestId(`persona-details-card-${persona.data.name}`) - .click(); + await personaListResponse; + + // Need to find persona card and click as the list might get paginated + await navigateToPersonaWithPagination( + adminPage, + persona.data.name, + true, + 3 + ); + await adminPage.getByRole('tab', { name: 'Customize UI' }).click(); await adminPage.waitForLoadState('networkidle'); await adminPage.getByText('Data Assets').click(); @@ -447,11 +456,18 @@ test.describe('Persona customization', () => { await test.step( `should show all the tabs & widget as default when no customization is done`, async () => { + const personaListResponse = + adminPage.waitForResponse(`/api/v1/personas?*`); await settingClick(adminPage, GlobalSettingOptions.PERSONA); - await adminPage.waitForLoadState('networkidle'); - await adminPage - .getByTestId(`persona-details-card-${persona.data.name}`) - .click(); + await personaListResponse; + + // Need to find persona card and click as the list might get paginated + await navigateToPersonaWithPagination( + adminPage, + persona.data.name, + true, + 3 + ); await adminPage.getByRole('tab', { name: 'Customize UI' }).click(); await adminPage.waitForLoadState('networkidle'); await adminPage.getByText('Governance').click(); @@ -542,11 +558,18 @@ test.describe('Persona customization', () => { test.slow(); await test.step('apply customization', async () => { + const personaListResponse = + adminPage.waitForResponse(`/api/v1/personas?*`); await settingClick(adminPage, GlobalSettingOptions.PERSONA); - await adminPage.waitForLoadState('networkidle'); - await adminPage - .getByTestId(`persona-details-card-${persona.data.name}`) - .click(); + await personaListResponse; + + // Need to find persona card and click as the list might get paginated + await navigateToPersonaWithPagination( + adminPage, + persona.data.name, + true, + 3 + ); await adminPage.getByRole('tab', { name: 'Customize UI' }).click(); await adminPage.waitForLoadState('networkidle'); await adminPage.getByText('Governance').click(); @@ -608,11 +631,18 @@ test.describe('Persona customization', () => { userPage, }) => { await test.step('apply tab label customization for Table', async () => { + const personaListResponse = + adminPage.waitForResponse(`/api/v1/personas?*`); await settingClick(adminPage, GlobalSettingOptions.PERSONA); - await adminPage.waitForLoadState('networkidle'); - await adminPage - .getByTestId(`persona-details-card-${persona.data.name}`) - .click(); + await personaListResponse; + + // Need to find persona card and click as the list might get paginated + await navigateToPersonaWithPagination( + adminPage, + persona.data.name, + true, + 3 + ); await adminPage.getByRole('tab', { name: 'Customize UI' }).click(); await adminPage.waitForLoadState('networkidle'); await adminPage.getByText('Data Assets').click(); diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Users.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Users.spec.ts index 903b6bb28e0..28afab92149 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Users.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Users.spec.ts @@ -1117,11 +1117,12 @@ test.describe('User Profile Persona Interactions', () => { await persona2OptionTestId.click(); + const personaEditResponse = adminPage.waitForResponse('/api/v1/users/*'); // Save the changes await adminPage .locator('[data-testid="user-profile-persona-edit-save"]') .click(); - await adminPage.waitForResponse('/api/v1/users/*'); + await personaEditResponse; }); // Test adding default persona diff --git a/openmetadata-ui/src/main/resources/ui/playwright/support/domain/Domain.ts b/openmetadata-ui/src/main/resources/ui/playwright/support/domain/Domain.ts index 85c4f698d11..a8fe957e7ad 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/support/domain/Domain.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/support/domain/Domain.ts @@ -38,14 +38,20 @@ type ResponseDataType = { }; export class Domain extends EntityClass { - id: string; - data: ResponseDataType; + id: string = uuid(); + data: ResponseDataType = { + name: `PW%domain.${this.id}`, + displayName: `PW Domain ${this.id}`, + description: 'playwright domain description', + domainType: 'Aggregate', + // eslint-disable-next-line no-useless-escape + fullyQualifiedName: `\"PW%domain.${this.id}\"`, + }; responseData: ResponseDataType = {} as ResponseDataType; constructor(data?: ResponseDataType) { super(EntityTypeEndpoint.Domain); - this.id = uuid(); this.data = data ?? { name: `PW%domain.${this.id}`, displayName: `PW Domain ${this.id}`, diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/persona.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/persona.ts index 1cf093060be..d9457939c8a 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/persona.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/persona.ts @@ -112,3 +112,30 @@ export const removePersonaDefault = async ( await removeDefaultConfirmationModal.getByText('Yes').click(); await removeDefaultResponse; }; + + +export const navigateToPersonaWithPagination = async ( + page: Page, + personaName: string, + click = true, + maxPages = 15 +) => { + for (let currentPage = 0; currentPage < maxPages; currentPage++) { + const locator = page.getByTestId(`persona-details-card-${personaName}`); + + // Check if element is visible on current page + if (await locator.isVisible()) { + if (click) { + await locator.click(); + } + + return; + } + + const nextBtn = page.locator('[data-testid="next"]'); + await nextBtn.waitFor({ state: 'visible' }); + + await nextBtn.click(); + await page.waitForLoadState('networkidle'); + } +}; \ No newline at end of file