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
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
},
"playwright/e2e/Features/DataQuality/TestDefinitionPermissions.spec.ts": {
"om-playwright/no-positional-locator": {
"count": 5
"count": 3
}
},
"playwright/e2e/Features/DataQuality/TestLibrary.spec.ts": {
Expand Down Expand Up @@ -953,11 +953,6 @@
"count": 2
}
},
"playwright/e2e/Pages/SearchIndexApplication.spec.ts": {
"om-playwright/no-positional-locator": {
"count": 2
}
},
"playwright/e2e/Pages/SearchSettings.spec.ts": {
"om-playwright/justified-rule-disable": {
"count": 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,19 @@
await afterAction();
},
dataConsumerPage: async ({ browser }, use) => {
const page = await browser.newPage();

Check warning on line 96 in openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/DataQuality/TestDefinitionPermissions.spec.ts

View workflow job for this annotation

GitHub Actions / checkstyle

Prefer the `page` fixture (test.use({ storageState })) over browser.newPage() + manual login for single-user admin tests. For multi-user tests that need a second non-admin page, this warning is expected — no action needed
await dataConsumerUser.login(page);
await use(page);
await page.close();
},
dataStewardPage: async ({ browser }, use) => {
const page = await browser.newPage();

Check warning on line 102 in openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/DataQuality/TestDefinitionPermissions.spec.ts

View workflow job for this annotation

GitHub Actions / checkstyle

Prefer the `page` fixture (test.use({ storageState })) over browser.newPage() + manual login for single-user admin tests. For multi-user tests that need a second non-admin page, this warning is expected — no action needed
await dataStewardUser.login(page);
await use(page);
await page.close();
},
viewOnlyPage: async ({ browser }, use) => {
const page = await browser.newPage();

Check warning on line 108 in openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/DataQuality/TestDefinitionPermissions.spec.ts

View workflow job for this annotation

GitHub Actions / checkstyle

Prefer the `page` fixture (test.use({ storageState })) over browser.newPage() + manual login for single-user admin tests. For multi-user tests that need a second non-admin page, this warning is expected — no action needed
await viewOnlyUser.login(page);
await use(page);
await page.close();
Expand Down Expand Up @@ -267,16 +267,44 @@
'Test Definition Permissions - Data Steward',
{ tag: `${DOMAIN_TAGS.OBSERVABILITY}:Rules_Library` },
() => {
// Target the definition this spec creates rather than whichever row sorts
// first. The Test Library is shared across the whole run, and specs seed
// definitions named to sort to the top (TestLibrary.spec.ts creates
// `AaaaExternalTest*`); an external definition's toggle is disabled by
// design, so a positional locator asserts on a row this spec never owned.
const stewardDefinitionName = `aaaColumnTestDefinition-${uuid()}`;
let stewardDefinitionId: string | undefined;

test.beforeAll(async ({ browser }) => {
const { apiContext, afterAction } = await performAdminLogin(browser);
await apiContext.post('/api/v1/dataQuality/testDefinitions', {
data: {
name: `aaaColumnTestDefinition-${uuid()}`,
description: `A Column test definition`,
entityType: 'COLUMN',
testPlatforms: ['OpenMetadata'],
},
});
const response = await apiContext.post(
'/api/v1/dataQuality/testDefinitions',
{
data: {
name: stewardDefinitionName,
description: `A Column test definition`,
entityType: 'COLUMN',
testPlatforms: ['OpenMetadata'],
},
}
);
stewardDefinitionId = (await response.json())?.id;
await afterAction();
});

// Without this the definition outlives the run. The Test Library is
// paginated with no search, and every worker adds another `aaa*` row that
// sorts alongside this one, so leaked definitions eventually push the row
// this spec targets off the first page.
test.afterAll(async ({ browser }) => {
if (!stewardDefinitionId) {
return;
}

const { apiContext, afterAction } = await performAdminLogin(browser);
await apiContext.delete(
`/api/v1/dataQuality/testDefinitions/${stewardDefinitionId}?hardDelete=true`
);
await afterAction();
});

Expand Down Expand Up @@ -306,9 +334,11 @@
await expect(addButton).not.toBeVisible();

// Data Steward should be able to toggle enabled/disabled switches (EditAll permission)
const firstSwitch = dataStewardPage.getByRole('switch').first();
const stewardSwitch = dataStewardPage.getByTestId(
`enable-switch-${stewardDefinitionName}`
);

await expect(firstSwitch).toBeEnabled();
await expect(stewardSwitch).toBeEnabled();

// Wait for API call
const response = dataStewardPage.waitForResponse(
Expand All @@ -318,11 +348,11 @@
);

// Try to toggle the switch
await firstSwitch.click();
await stewardSwitch.click();
await response;

// Verify switch state changed
await expect(firstSwitch).toHaveAttribute(
await expect(stewardSwitch).toHaveAttribute(
'aria-checked',
String('false')
);
Expand All @@ -333,16 +363,20 @@
response.request().method() === 'PATCH'
);
// Toggle back to original state
await firstSwitch.click();
await stewardSwitch.click();
await response2;

await expect(firstSwitch).toHaveAttribute('aria-checked', String('true'));
await expect(stewardSwitch).toHaveAttribute(
'aria-checked',
String('true')
);

// Data Steward should NOT see delete buttons (no Delete permission)
const deleteButtons = dataStewardPage.getByTestId(
/delete-test-definition-/
);
await expect(deleteButtons.first()).toBeDisabled();
await expect(
dataStewardPage.getByTestId(
`delete-test-definition-${stewardDefinitionName}`
)
).toBeDisabled();
});

test('should not be able to edit system test definitions', async ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
*/
import test, { expect } from '@playwright/test';
import { GlobalSettingOptions } from '../../constant/settings';
import {
findApplicationCard,
openApplicationDetails,
} from '../../utils/applications';
import { getApiContext, redirectToHomePage } from '../../utils/common';
import { settingClick } from '../../utils/sidebar';

Expand Down Expand Up @@ -50,7 +54,7 @@
() => {
test.beforeAll('Seed retry queue records', async ({ browser }) => {
const { apiContext, afterAction } = await getApiContext(
await browser.newPage()

Check warning on line 57 in openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/LiveIndexingTab.spec.ts

View workflow job for this annotation

GitHub Actions / checkstyle

Prefer the `page` fixture (test.use({ storageState })) over browser.newPage() + manual login for single-user admin tests. For multi-user tests that need a second non-admin page, this warning is expected — no action needed
);

for (const record of SAMPLE_RETRY_RECORDS) {
Expand All @@ -68,7 +72,7 @@

test.afterAll('Clean up retry queue records', async ({ browser }) => {
const { apiContext, afterAction } = await getApiContext(
await browser.newPage()

Check warning on line 75 in openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/LiveIndexingTab.spec.ts

View workflow job for this annotation

GitHub Actions / checkstyle

Prefer the `page` fixture (test.use({ storageState })) over browser.newPage() + manual login for single-user admin tests. For multi-user tests that need a second non-admin page, this warning is expected — no action needed
);

for (const record of SAMPLE_RETRY_RECORDS) {
Expand All @@ -93,11 +97,7 @@
await redirectToHomePage(page);
await settingClick(page, GlobalSettingOptions.APPLICATIONS);

await page
.locator(
'[data-testid="search-indexing-application-card"] [data-testid="config-btn"]'
)
.click();
await openApplicationDetails(page, 'search-indexing-application-card');
});

await test.step('Click Live Indexing tab', async () => {
Expand Down Expand Up @@ -144,11 +144,7 @@
await redirectToHomePage(page);
await settingClick(page, GlobalSettingOptions.APPLICATIONS);

await page
.locator(
'[data-testid="search-indexing-application-card"] [data-testid="config-btn"]'
)
.click();
await openApplicationDetails(page, 'search-indexing-application-card');
});

await test.step('Verify empty state message when queue is empty', async () => {
Expand Down Expand Up @@ -214,11 +210,7 @@
await redirectToHomePage(page);
await settingClick(page, GlobalSettingOptions.APPLICATIONS);

await page
.locator(
'[data-testid="search-indexing-application-card"] [data-testid="config-btn"]'
)
.click();
await openApplicationDetails(page, 'search-indexing-application-card');
});

await test.step('Mock and verify retry queue data', async () => {
Expand Down Expand Up @@ -278,13 +270,15 @@
});

await test.step('Verify Live Indexing tab is absent on non-search apps', async () => {
// Check if DataInsightsReportApplication card exists
const diCard = page.locator(
'[data-testid="data-insights-report-application-card"] [data-testid="config-btn"]'
);

if (await diCard.isVisible()) {
await diCard.click();
// DataInsightsReportApplication is not installed on every deployment,
// so treat "not on any page" as nothing to assert rather than a failure.
const diCard = await findApplicationCard(
page,
'data-insights-report-application-card'
).catch(() => null);

if (diCard) {
await diCard.getByTestId('config-btn').click();

const liveIndexingTab = page.getByRole('tab', {
name: 'Live Indexing',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
import test, { expect, Page, Response } from '@playwright/test';
import { PLAYWRIGHT_BASIC_TEST_TAG_OBJ } from '../../constant/config';
import { GlobalSettingOptions } from '../../constant/settings';
import {
APPLICATION_LIST,
expectApplicationInstalled,
expectApplicationNotInstalled,
findApplicationCard,
openApplicationDetails,
} from '../../utils/applications';
import {
clickOutside,
getApiContext,
Expand Down Expand Up @@ -47,47 +54,13 @@ const installSearchIndexApplication = async (page: Page) => {

expect(response.status()).toBe(200);

// Wait for at least one app card to be rendered before polling.
await page
.locator('[data-testid$="-application-card"]')
.first()
.waitFor({ state: 'visible' });

// Paginate through marketplace pages until the card is found.
let cardFound = await page
.locator('[data-testid="search-indexing-application-card"]')
.isVisible();

while (!cardFound) {
const nextButton = page.locator('[data-testid="next"]');

const isNextButtonVisible = await nextButton.isVisible();

if (!isNextButtonVisible || (await nextButton.isDisabled())) {
throw new Error(
'search-indexing-application-card not found in marketplace and next button is disabled'
);
}

const nextPageResponse = page.waitForResponse('/api/v1/apps/marketplace*');
await nextButton.click();
await nextPageResponse;

// Wait for the next page's cards to render before re-checking.
await page
.locator('[data-testid$="-application-card"]')
.first()
.waitFor({ state: 'visible' });

cardFound = await page
.locator('[data-testid="search-indexing-application-card"]')
.isVisible();
}
const marketplaceCard = await findApplicationCard(
page,
'search-indexing-application-card',
APPLICATION_LIST.marketplace
);

await page
.getByTestId('search-indexing-application-card')
.getByTestId('config-btn')
.click();
await marketplaceCard.getByTestId('config-btn').click();

await page.getByTestId('install-application').waitFor({ state: 'visible' });
await page.getByTestId('install-application').click();
Expand Down Expand Up @@ -117,9 +90,7 @@ const installSearchIndexApplication = async (page: Page) => {

await getApplications;

await expect(
page.getByTestId('search-indexing-application-card')
).toBeVisible();
await expectApplicationInstalled(page, 'search-indexing-application-card');
};

const verifyLastExecutionStatus = async (page: Page) => {
Expand Down Expand Up @@ -291,11 +262,7 @@ test.describe('Search Index Application', PLAYWRIGHT_BASIC_TEST_TAG_OBJ, () => {
const statusAPI = page.waitForResponse(
'/api/v1/apps/name/SearchIndexingApplication/status?offset=0&limit=1'
);
await page
.locator(
'[data-testid="search-indexing-application-card"] [data-testid="config-btn"]'
)
.click();
await openApplicationDetails(page, 'search-indexing-application-card');
const statusResponse = await statusAPI;

expect(statusResponse.status()).toBe(200);
Expand Down Expand Up @@ -431,11 +398,10 @@ test.describe('Search Index Application', PLAYWRIGHT_BASIC_TEST_TAG_OBJ, () => {

await toastNotification(page, 'Application uninstalled successfully');

const card1 = page.locator(
'[data-testid="search-indexing-application-card"]'
await expectApplicationNotInstalled(
page,
'search-indexing-application-card'
);

await expect(card1).toBeHidden();
});

await test.step('Install application', async () => {
Expand All @@ -446,9 +412,7 @@ test.describe('Search Index Application', PLAYWRIGHT_BASIC_TEST_TAG_OBJ, () => {
await test.step('Run application and rerun with table-only config', async () => {
test.slow(true); // Test time shouldn't exceed while re-fetching the history API.

await page.click(
'[data-testid="search-indexing-application-card"] [data-testid="config-btn"]'
);
await openApplicationDetails(page, 'search-indexing-application-card');

const previousRunStartTime = await getLatestRunStartTime(page);
const triggerPipelineResponse = page.waitForResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ test('the suppressions baseline matches its recorded state exactly', () => {
const EXPECTED = {
'om-playwright/justified-rule-disable': 12,
'om-playwright/no-blanket-test-slow': 83,
'om-playwright/no-positional-locator': 1328,
'om-playwright/no-positional-locator': 1324,
'om-playwright/require-assertion-per-test': 1,
'playwright/no-force-option': 11,
'playwright/no-skipped-test': 4,
Expand Down
Loading
Loading