Skip to content

Commit

Permalink
Playwright: Remove the flakiness (#19757)
Browse files Browse the repository at this point in the history
* Remove the flakiness for AdvancedSearch and AutoClassification tests

* Fix the failing tests

* fixed failing data quality test

---------

Co-authored-by: Shailesh Parmar <[email protected]>
(cherry picked from commit 84719b6)
  • Loading branch information
aniketkatkar97 authored and OpenMetadata Release Bot committed Feb 14, 2025
1 parent 0b1cab9 commit 6f8f426
Show file tree
Hide file tree
Showing 12 changed files with 156 additions and 144 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ test.describe('Advanced Search', { tag: '@advanced-search' }, () => {
EntityDataClass.table1.schema.name,
EntityDataClass.table2.schema.name,
],
'columns.name.keyword': ['email', 'shop_id'],
'columns.name.keyword': [
EntityDataClass.table1.entity.columns[2].name,
EntityDataClass.table2.entity.columns[3].name,
],
'displayName.keyword': [
EntityDataClass.table1.entity.displayName,
EntityDataClass.table2.entity.displayName,
Expand All @@ -175,7 +178,7 @@ test.describe('Advanced Search', { tag: '@advanced-search' }, () => {
],
'messageSchema.schemaFields.name.keyword': [
EntityDataClass.topic1.entity.messageSchema.schemaFields[0].name,
EntityDataClass.topic1.entity.messageSchema.schemaFields[1].name,
EntityDataClass.topic2.entity.messageSchema.schemaFields[1].name,
],
'dataModel.columns.name.keyword': [
EntityDataClass.container1.entity.dataModel.columns[0].name,
Expand All @@ -187,11 +190,11 @@ test.describe('Advanced Search', { tag: '@advanced-search' }, () => {
],
'fields.name.keyword': [
EntityDataClass.searchIndex1.entity.fields[1].name,
EntityDataClass.searchIndex1.entity.fields[3].name,
EntityDataClass.searchIndex2.entity.fields[3].name,
],
'tasks.displayName.keyword': [
EntityDataClass.pipeline1.entity.tasks[0].displayName,
EntityDataClass.pipeline1.entity.tasks[1].displayName,
EntityDataClass.pipeline2.entity.tasks[1].displayName,
],
'domain.displayName.keyword': [
EntityDataClass.domain1.data.displayName,
Expand All @@ -200,12 +203,14 @@ test.describe('Advanced Search', { tag: '@advanced-search' }, () => {
'responseSchema.schemaFields.name.keyword': [
EntityDataClass.apiCollection1.apiEndpoint.responseSchema
.schemaFields[0].name,
'errors',
EntityDataClass.apiCollection2.apiEndpoint.responseSchema
.schemaFields[1].name,
],
'requestSchema.schemaFields.name.keyword': [
EntityDataClass.apiCollection1.apiEndpoint.requestSchema.schemaFields[0]
.name,
'photoUrls',
EntityDataClass.apiCollection2.apiEndpoint.requestSchema.schemaFields[1]
.name,
],
'name.keyword': [
EntityDataClass.table1.entity.name,
Expand All @@ -216,8 +221,8 @@ test.describe('Advanced Search', { tag: '@advanced-search' }, () => {
EntityDataClass.dashboardDataModel2.entity.project,
],
status: ['Approved', 'In Review'],
tableType: ['View', 'Regular'],
entityType: ['dashboard', 'pipeline'],
tableType: [table.entity.tableType, 'MaterializedView'],
entityType: ['dashboard', 'mlmodel'],
'charts.displayName.keyword': [
EntityDataClass.dashboard1.charts.displayName,
EntityDataClass.dashboard2.charts.displayName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ test.use({ storageState: 'playwright/.auth/admin.json' });
const table = new TableClass();

test.describe('Table Constraints', {}, () => {
const columnName1 = table.children[0].name;
const columnName2 = table.children[1].name;
const columnName3 = table.children[2].name;
const columnName4 = table.children[3].name;

test.beforeAll('Prerequisite', async ({ browser }) => {
const { apiContext, afterAction } = await createNewPage(browser);
await table.create(apiContext);
Expand Down Expand Up @@ -76,31 +81,29 @@ test.describe('Table Constraints', {}, () => {

await page
.getByTestId('primary-constraint-type-select')
.locator('div')
.nth(1)
.type('user_id');
.getByRole('combobox')
.fill(columnName1, { force: true });

// select 1st value from dropdown
const firstPrimaryKeyColumn = page.getByTitle('user_id');
const firstPrimaryKeyColumn = page.getByTitle(columnName1);
await firstPrimaryKeyColumn.hover();
await firstPrimaryKeyColumn.click();

// select 2nd value from dropdown
await page
.getByTestId('primary-constraint-type-select')
.locator('div')
.nth(1)
.type('shop_id');
.getByRole('combobox')
.fill(columnName2, { force: true });

const secondPrimaryKeyColumn = page.getByTitle('shop_id');
const secondPrimaryKeyColumn = page.getByTitle(columnName2);
await secondPrimaryKeyColumn.hover();
await secondPrimaryKeyColumn.click();
await clickOutside(page);

await expect(
page
.getByTestId('primary-constraint-type-select')
.getByText('user_idshop_id')
.getByText(`${columnName1}${columnName2}`)
).toBeVisible();

// Foreign Key Constraint Section
Expand Down Expand Up @@ -170,29 +173,31 @@ test.describe('Table Constraints', {}, () => {

await page
.getByTestId('unique-constraint-type-select')
.locator('div')
.nth(1)
.type('name');
.getByRole('combobox')
.fill(columnName3, { force: true });

// select 1st value from dropdown
const firstUniqueKeyColumn = page.getByTitle('name', { exact: true });
const firstUniqueKeyColumn = page.getByTitle(columnName3, {
exact: true,
});
await firstUniqueKeyColumn.hover();
await firstUniqueKeyColumn.click();

// select 2nd value from dropdown
await page
.getByTestId('unique-constraint-type-select')
.locator('div')
.nth(1)
.type('email');
.getByRole('combobox')
.fill(columnName4, { force: true });

const secondUniqueKeyColumn = page.getByTitle('email');
const secondUniqueKeyColumn = page.getByTitle(columnName4);
await secondUniqueKeyColumn.hover();
await secondUniqueKeyColumn.click();
await clickOutside(page);

await expect(
page.getByTestId('unique-constraint-type-select').getByText('nameemail')
page
.getByTestId('unique-constraint-type-select')
.getByText(`${columnName3}${columnName4}`)
).toBeVisible();

// Dist Constraint Section
Expand All @@ -206,31 +211,29 @@ test.describe('Table Constraints', {}, () => {

await page
.getByTestId('dist-constraint-type-select')
.locator('div')
.nth(1)
.type('user_id');
.getByRole('combobox')
.fill(columnName1, { force: true });

// select 1st value from dropdown
const firstDistKeyColumn = page.getByTitle('user_id');
const firstDistKeyColumn = page.getByTitle(columnName1);
await firstDistKeyColumn.hover();
await firstDistKeyColumn.click();

// select 2nd value from dropdown
await page
.getByTestId('dist-constraint-type-select')
.locator('div')
.nth(1)
.type('shop_id');
.getByRole('combobox')
.fill(columnName2, { force: true });

const secondDistKeyColumn = page.getByTitle('shop_id');
const secondDistKeyColumn = page.getByTitle(columnName2);
await secondDistKeyColumn.hover();
await secondDistKeyColumn.click();
await clickOutside(page);

await expect(
page
.getByTestId('dist-constraint-type-select')
.getByText('user_idshop_id')
.getByText(`${columnName1}${columnName2}`)
).toBeVisible();

// Sort Constraint Section
Expand All @@ -244,29 +247,29 @@ test.describe('Table Constraints', {}, () => {

await page
.getByTestId('sort-constraint-type-select')
.locator('div')
.nth(1)
.type('name');
.getByRole('combobox')
.fill(columnName3, { force: true });

// select 1st value from dropdown
const firstSortKeyColumn = page.getByTitle('name', { exact: true });
const firstSortKeyColumn = page.getByTitle(columnName3, { exact: true });
await firstSortKeyColumn.hover();
await firstSortKeyColumn.click();

// select 2nd value from dropdown
await page
.getByTestId('sort-constraint-type-select')
.locator('div')
.nth(1)
.type('email');
.getByRole('combobox')
.fill(columnName4, { force: true });

const secondSortKeyColumn = page.getByTitle('email');
const secondSortKeyColumn = page.getByTitle(columnName4);
await secondSortKeyColumn.hover();
await secondSortKeyColumn.click();
await clickOutside(page);

await expect(
page.getByTestId('sort-constraint-type-select').getByText('nameemail')
page
.getByTestId('sort-constraint-type-select')
.getByText(`${columnName3}${columnName4}`)
).toBeVisible();

const saveResponse = page.waitForResponse('/api/v1/tables/*');
Expand All @@ -288,31 +291,31 @@ test.describe('Table Constraints', {}, () => {

// Verify Primary Key
await expect(page.getByTestId('PRIMARY_KEY-container')).toContainText(
'shop_iduser_id'
`${columnName2}${columnName1}`
);
await expect(page.getByTestId('PRIMARY_KEY-icon')).toBeVisible();

// Verify Foreign Key
await expect(page.getByTestId('FOREIGN_KEY-container')).toContainText(
`user_id${table.additionalEntityTableResponseData[0]?.['columns'][1].fullyQualifiedName}`
`${columnName1}${table.additionalEntityTableResponseData[0]?.['columns'][1].fullyQualifiedName}`
);
await expect(page.getByTestId('FOREIGN_KEY-icon')).toBeVisible();

// Verify Unique Key
await expect(page.getByTestId('UNIQUE-container')).toContainText(
'emailname'
`${columnName4}${columnName3}`
);
await expect(page.getByTestId('UNIQUE-icon')).toBeVisible();

// Verify Sort Key
await expect(page.getByTestId('SORT_KEY-container')).toContainText(
'emailname'
`${columnName4}${columnName3}`
);
await expect(page.getByTestId('SORT_KEY-icon')).toBeVisible();

// Verify Dist Key
await expect(page.getByTestId('DIST_KEY-container')).toContainText(
'shop_iduser_id'
`${columnName2}${columnName1}`
);
await expect(page.getByTestId('DIST_KEY-icon')).toBeVisible();
});
Expand Down Expand Up @@ -345,11 +348,11 @@ test.describe('Table Constraints', {}, () => {

// Verify Sort and Dist Key to be available
await expect(page.getByTestId('SORT_KEY-container')).toContainText(
'emailname'
`${columnName4}${columnName3}`
);
await expect(page.getByTestId('SORT_KEY-icon')).toBeVisible();
await expect(page.getByTestId('DIST_KEY-container')).toContainText(
'shop_iduser_id'
`${columnName2}${columnName1}`
);

// Remove the pending constraints
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test.beforeAll(async ({ browser }) => {
);
await table2.createTestCase(apiContext, {
name: `email_column_values_to_be_in_set_${uuid()}`,
entityLink: `<#E::table::${table2.entityResponseData?.['fullyQualifiedName']}::columns::email>`,
entityLink: `<#E::table::${table2.entityResponseData?.['fullyQualifiedName']}::columns::${table2.entity?.columns[3].name}>`,
parameterValues: [
{ name: 'allowedValues', value: '["gmail","yahoo","collate"]' },
],
Expand Down Expand Up @@ -170,7 +170,7 @@ test('Column test case', PLAYWRIGHT_INGESTION_TAG_OBJ, async ({ page }) => {

const NEW_COLUMN_TEST_CASE = {
name: 'email_column_value_lengths_to_be_between',
column: 'email',
column: table1.entity?.columns[3].name,
type: 'columnValueLengthsToBeBetween',
label: 'Column Value Lengths To Be Between',
min: '3',
Expand Down Expand Up @@ -365,7 +365,9 @@ test(
await expect(page.locator('#tableTestForm_table')).toHaveValue(
table2.entityResponseData?.['name']
);
await expect(page.locator('#tableTestForm_column')).toHaveValue('email');
await expect(page.locator('#tableTestForm_column')).toHaveValue(
table2.entity?.columns[3].name
);
await expect(page.locator('#tableTestForm_name')).toHaveValue(
testCaseName
);
Expand Down Expand Up @@ -486,9 +488,9 @@ test(
profileSample: '60',
sampleDataCount: '100',
profileQuery: 'select * from table',
excludeColumns: 'user_id',
includeColumns: 'shop_id',
partitionColumnName: 'name',
excludeColumns: table1.entity?.columns[0].name,
includeColumns: table1.entity?.columns[1].name,
partitionColumnName: table1.entity?.columns[2].name,
partitionIntervalType: 'COLUMN-VALUE',
partitionValues: 'test',
};
Expand Down Expand Up @@ -561,13 +563,13 @@ test(

expect(requestBody).toEqual(
JSON.stringify({
excludeColumns: ['user_id'],
excludeColumns: [table1.entity?.columns[0].name],
profileQuery: 'select * from table',
profileSample: 60,
profileSampleType: 'PERCENTAGE',
includeColumns: [{ columnName: 'shop_id' }],
includeColumns: [{ columnName: table1.entity?.columns[1].name }],
partitioning: {
partitionColumnName: 'name',
partitionColumnName: table1.entity?.columns[2].name,
partitionIntervalType: 'COLUMN-VALUE',
partitionValues: ['test'],
enablePartitioning: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ test('Classification Page', async ({ page }) => {
tagDisplayName: displayName,
tableId: table.entityResponseData?.['id'],
columnNumber: 0,
rowName: 'user_id numeric',
rowName: `${table.entity?.columns[0].name} numeric`,
});
});

Expand Down
Loading

0 comments on commit 6f8f426

Please sign in to comment.