Skip to content

Commit 8437eea

Browse files
committed
fixed flaky bulk import
1 parent 54b2d02 commit 8437eea

File tree

3 files changed

+33
-7
lines changed

3 files changed

+33
-7
lines changed

openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/BulkImport.spec.ts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,15 @@ test.describe('Bulk Import Export', () => {
158158
'should import and edit with two additional database',
159159
async () => {
160160
await dbService.visitEntityPage(page);
161-
await page.click('[data-testid="manage-button"] > .anticon');
161+
await page.waitForSelector('[data-testid="loader"]', {
162+
state: 'detached',
163+
});
164+
165+
await page.getByTestId('manage-button').click();
166+
await page.waitForSelector(
167+
'[data-testid="manage-dropdown-list-container"]',
168+
{ state: 'visible' }
169+
);
162170
await page.click('[data-testid="import-button-title"]');
163171
const fileInput = page.getByTestId('upload-file-widget');
164172
await fileInput?.setInputFiles([
@@ -409,15 +417,26 @@ test.describe('Bulk Import Export', () => {
409417
'should import and edit with two additional database schema',
410418
async () => {
411419
await dbEntity.visitEntityPage(page);
412-
await page.click('[data-testid="manage-button"] > .anticon');
420+
421+
await page.waitForSelector('[data-testid="loader"]', {
422+
state: 'detached',
423+
});
424+
425+
await page.getByTestId('manage-button').click();
426+
await page.waitForSelector(
427+
'[data-testid="manage-dropdown-list-container"]',
428+
{ state: 'visible' }
429+
);
413430
await page.click('[data-testid="import-button-title"]');
414431
const fileInput = await page.$('[type="file"]');
415432
await fileInput?.setInputFiles([
416433
'downloads/' + dbEntity.entity.name + '.csv',
417434
]);
418435

419-
// Adding manual wait for the file to load
420-
await page.waitForTimeout(500);
436+
// Wait for upload widget to be hidden indicating file is loaded
437+
await page.waitForSelector('[data-testid="upload-file-widget"]', {
438+
state: 'hidden',
439+
});
421440

422441
// Adding some assertion to make sure that CSV loaded correctly
423442
await expect(page.locator('.rdg-header-row')).toBeVisible();

openmetadata-ui/src/main/resources/ui/playwright/support/entity/DatabaseSchemaClass.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,18 @@ export class DatabaseSchemaClass extends EntityClass {
152152
await page.getByTestId(this.database.name).click();
153153
await databaseResponse;
154154

155-
// Wait for database schema to be visible
156-
await page.getByTestId(this.entity.name).waitFor({ state: 'visible' });
155+
// Wait for page to fully load after navigation
156+
await page.waitForLoadState('networkidle');
157+
158+
// Target schema specifically within the table container to avoid clicking breadcrumbs or other elements
159+
const schemaLocator = page.getByTestId(this.entity.name);
160+
161+
await schemaLocator.waitFor({ state: 'visible' });
157162

158163
const databaseSchemaResponse = page.waitForResponse(
159164
`/api/v1/databaseSchemas/name/*${this.entity.name}?*`
160165
);
161-
await page.getByTestId(this.entity.name).click();
166+
await schemaLocator.click();
162167
await databaseSchemaResponse;
163168
}
164169

openmetadata-ui/src/main/resources/ui/playwright/utils/importUtils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ export const fillOwnerDetails = async (page: Page, owners: string[]) => {
103103
const userListResponse = page.waitForResponse(
104104
'/api/v1/search/query?q=&index=user_search_index&*'
105105
);
106+
//wait for small duration to stablize the page
107+
page.waitForTimeout(500)
106108
await page.getByRole('tab', { name: 'Users' }).click();
107109
await userListResponse;
108110

0 commit comments

Comments
 (0)