playwright: fix table playwright test failure (#20474)

* playwright: fix table playwright test failure

* added wait

* minor fix

* revert pw config

* testing linage and table spec

* fixed user and table test

* fix link issue

* fixed playwright test in PR's

* fix test

* revert the playwright setup

* fixed alert bar issue

* alert confirmation
This commit is contained in:
Shailesh Parmar 2025-03-31 10:31:19 +05:30 committed by GitHub
parent 4aa8a0c0a1
commit 214ca4205c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 46 additions and 34 deletions

View File

@ -37,14 +37,16 @@ test.describe('Glossary tests', () => {
}
try {
await redirectToHomePage(page);
const glossaryRes = page.waitForResponse('/api/v1/glossaries?*');
await sidebarClick(page, SidebarItem.GLOSSARY);
await glossaryRes;
const glossaryRes = page.waitForResponse(
'/api/v1/glossaryTerms?*directChildrenOf=*'
);
const glossaryAfterRes = page.waitForResponse(
'/api/v1/glossaries?*after=*'
);
await sidebarClick(page, SidebarItem.GLOSSARY);
await glossaryRes;
await page
.getByTestId('glossary-left-panel-scroller')
.scrollIntoViewIfNeeded();

View File

@ -113,7 +113,7 @@ test.describe('Table pagination sorting search scenarios ', () => {
.textContent();
const linkInColumn = getFirstRowColumnLink(page);
await linkInColumn.locator('a').click();
await linkInColumn.click();
await page.waitForURL('**/table/**');
await page.waitForLoadState('networkidle');
@ -134,19 +134,35 @@ test.describe('Table pagination sorting search scenarios ', () => {
test('should persist page size', async ({ page }) => {
page.goto('/databaseSchema/sample_data.ecommerce_db.shopify');
await page.waitForSelector('[data-testid="loader"]', {
state: 'detached',
});
await expect(page.getByTestId('databaseSchema-tables')).toBeVisible();
await page.getByTestId('page-size-selection-dropdown').click();
await expect(
page.getByRole('menuitem', { name: '15 / Page' })
).toBeVisible();
await page.getByRole('menuitem', { name: '15 / Page' }).click();
await page.waitForSelector('[data-testid="loader"]', {
state: 'detached',
});
const linkInColumn = getFirstRowColumnLink(page);
const entityApiResponse = page.waitForResponse(
'/api/v1/permissions/table/name/*'
);
await linkInColumn.click();
await entityApiResponse;
await page.waitForLoadState('networkidle');
await page.waitForSelector('[data-testid="loader"]', {
state: 'detached',
});
await page.goBack();
await page.waitForLoadState('networkidle');
await page.waitForSelector('[data-testid="loader"]', {

View File

@ -242,30 +242,28 @@ test('Verify column lineage between table and topic', async ({ browser }) => {
await visitLineageTab(page);
await verifyColumnLineageInCSV(page, table, topic, sourceCol, targetCol);
await test.step('Verify relation in platform lineage', async () => {
await sidebarClick(page, SidebarItem.LINEAGE);
const searchRes = page.waitForResponse('/api/v1/search/query?*');
// Verify relation in platform lineage
await sidebarClick(page, SidebarItem.LINEAGE);
const searchRes = page.waitForResponse('/api/v1/search/query?*');
await page.click('[data-testid="search-entity-select"]');
await page.keyboard.type(tableServiceFqn);
await searchRes;
await page.click('[data-testid="search-entity-select"]');
await page.keyboard.type(tableServiceFqn);
await searchRes;
await page.click(`[data-testid="node-suggestion-${tableServiceFqn}"]`);
await page.click(`[data-testid="node-suggestion-${tableServiceFqn}"]`);
await page.waitForLoadState('networkidle');
await page.waitForLoadState('networkidle');
const tableServiceNode = page.locator(
`[data-testid="lineage-node-${tableServiceFqn}"]`
);
const topicServiceNode = page.locator(
`[data-testid="lineage-node-${topicServiceFqn}"]`
);
const tableServiceNode = page.locator(
`[data-testid="lineage-node-${tableServiceFqn}"]`
);
const topicServiceNode = page.locator(
`[data-testid="lineage-node-${topicServiceFqn}"]`
);
await expect(tableServiceNode).toBeVisible();
await expect(topicServiceNode).toBeVisible();
});
await expect(tableServiceNode).toBeVisible();
await expect(topicServiceNode).toBeVisible();
await redirectToHomePage(page);
await table.visitEntityPage(page);
await visitLineageTab(page);
await page.click('[data-testid="edit-lineage"]');

View File

@ -1387,6 +1387,6 @@ export const getTextFromHtmlString = (description?: string): string => {
export const getFirstRowColumnLink = (page: Page) => {
return page
.getByTestId('databaseSchema-tables')
.getByTestId('column-name')
.locator('[data-testid="column-name"] a')
.first();
};

View File

@ -19,8 +19,8 @@ import {
import { VISIT_SERVICE_PAGE_DETAILS } from '../constant/service';
import {
GlobalSettingOptions,
SETTINGS_OPTIONS_PATH,
SETTING_CUSTOM_PROPERTIES_PATH,
SETTINGS_OPTIONS_PATH,
} from '../constant/settings';
import { SidebarItem } from '../constant/sidebar';
import { UserClass } from '../support/user/UserClass';
@ -196,20 +196,16 @@ export const hardDeleteUserProfilePage = async (
await page.check('[data-testid="hard-delete"]');
await page.fill('[data-testid="confirmation-text-input"]', 'DELETE');
const toastPromises = [
page.waitForSelector('[data-testid="alert-bar"]'),
page.waitForSelector('[data-testid="alert-icon"]'),
page.waitForSelector('[data-testid="alert-icon-close"]'),
];
const deleteResponse = page.waitForResponse(
'/api/v1/users/*?hardDelete=true&recursive=true'
);
await page.click('[data-testid="confirm-button"]');
// Wait for both the delete response and all toast elements to appear
await Promise.all([deleteResponse, ...toastPromises]);
await page.waitForLoadState('networkidle');
await toastNotification(page, /deleted successfully!/);
await deleteResponse;
await expect(page.getByTestId('alert-bar')).toHaveText(
/deleted successfully!/
);
};
export const editDisplayName = async (page: Page, editedUserName: string) => {