Skip to content
Closed
  •  
  •  
  •  
6 changes: 5 additions & 1 deletion openmetadata-ui/src/main/resources/ui/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -454,16 +454,20 @@ export default [
},
},

// Test setup files
// Test, spec, and mock files: these contain no user-facing strings, so the
// i18n literal-string rule does not apply to them.
{
files: [
'src/setupTests.js',
'src/**/*.test.{js,jsx,ts,tsx}',
'src/**/*.spec.{js,jsx,ts,tsx}',
'src/**/*.mock.{js,jsx,ts,tsx}',
'src/mocks/**/*.{js,jsx,ts,tsx}',
'playwright/**/*.spec.{js,jsx,ts,tsx}',
],
rules: {
'@typescript-eslint/no-require-imports': 'off',
'i18next/no-literal-string': 'off',
},
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ test.describe('SSO Authentication with Mock OIDC Provider', () => {

// Navigate again — app should handle the error gracefully
await page.goto('/');
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(5000);

const url = page.url();
Expand Down Expand Up @@ -306,6 +307,7 @@ test.describe('SSO Authentication with Mock OIDC Provider', () => {
});

await page.goto('/');
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(5000);

const refreshFlag = await page.evaluate(() => {
Expand All @@ -325,8 +327,10 @@ test.describe('SSO Authentication with Mock OIDC Provider', () => {
localStorage.setItem('refreshInProgress', 'true');
});

// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(2000);
await page.goto('/');
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(5000);

const url = page.url();
Expand All @@ -352,6 +356,7 @@ test.describe('SSO Authentication with Mock OIDC Provider', () => {
// WebKit processes page.route() 401 interceptions with different event
// loop timing — the async logout chain doesn't complete before the page
// settles, so the redirect to /signin doesn't happen reliably.
// eslint-disable-next-line playwright/no-skipped-test -- intentionally skipped
test.skip(
browserName === 'webkit',
'WebKit handles route interception timing differently'
Expand Down Expand Up @@ -422,6 +427,7 @@ test.describe('SSO Authentication with Mock OIDC Provider', () => {

// Navigate to a page that makes multiple parallel API calls
await page.goto('/');
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(10000);

// The refresh should have happened at most once despite multiple 401s
Expand All @@ -439,6 +445,7 @@ test.describe('SSO Authentication with Mock OIDC Provider', () => {
}) => {
// WebKit processes page.route() 401 interceptions with different event
// loop timing — the forced logout redirect doesn't happen reliably.
// eslint-disable-next-line playwright/no-skipped-test -- intentionally skipped
test.skip(
browserName === 'webkit',
'WebKit handles route interception timing differently'
Expand Down Expand Up @@ -493,6 +500,7 @@ test.describe('SSO Authentication with Mock OIDC Provider', () => {
// Navigate — app should not crash even if silent renewal cannot use
// a refresh token (it falls back to iframe/popup)
await page.goto('/');
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(5000);

const url = page.url();
Expand Down Expand Up @@ -533,6 +541,7 @@ test.describe('SSO Authentication with Mock OIDC Provider', () => {

// Allow async IndexedDB cleanup to complete (WebKit needs more time
// because the OIDC logout redirect chain can interrupt pending writes)
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(2000);

// Verify auth state is cleared
Expand Down Expand Up @@ -568,6 +577,7 @@ test.describe('SSO Authentication with Mock OIDC Provider', () => {
// Open a second tab
const page2 = await context.newPage();
await page2.goto('/');
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page2.waitForTimeout(3000);

const tab2TokenBefore = await getStoredToken(page2);
Expand Down Expand Up @@ -596,10 +606,12 @@ test.describe('SSO Authentication with Mock OIDC Provider', () => {

// Trigger the 401 in tab 1
await page.goto('/activity-feed');
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(10000);

// Check that tab 2 can still access the app
await page2.goto('/');
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page2.waitForTimeout(5000);

const tab2TokenAfter = await getStoredToken(page2);
Expand Down Expand Up @@ -638,10 +650,12 @@ test.describe('SSO Authentication with Mock OIDC Provider', () => {
await resetMetrics(request);

// Wait for the token to expire and proactive renewal to trigger
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(8000);

// Hard reload — this forces the app to read from IndexedDB (no in-memory cache)
await page.reload({ waitUntil: 'networkidle' });
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(3000);

const url = page.url();
Expand Down Expand Up @@ -681,6 +695,7 @@ test.describe('SSO Authentication with Mock OIDC Provider', () => {
await setTokenExpiry(request, 5);
await resetMetrics(request);

// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(8000);

// Observe the Authorization header on the next API call using waitForRequest
Expand Down Expand Up @@ -736,6 +751,7 @@ test.describe('SSO Authentication with Mock OIDC Provider', () => {
}) => {
await performOidcLogin(page);
await verifyAuthenticated(page);
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(2000);

// Set refreshInProgress BEFORE writing expired token to block the
Expand Down Expand Up @@ -789,6 +805,7 @@ test.describe('SSO Authentication with Mock OIDC Provider', () => {
});

// Wait for TOKEN_UPDATE broadcast to be handled (blocked by flag)
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(1000);

// Remove the lock so visibilitychange handler can trigger refreshToken()
Expand All @@ -805,6 +822,7 @@ test.describe('SSO Authentication with Mock OIDC Provider', () => {
});

// Wait for the async handler to complete
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(3000);

// Verify the handler detected the expired token and attempted refresh.
Expand Down Expand Up @@ -832,6 +850,7 @@ test.describe('SSO Authentication with Mock OIDC Provider', () => {
document.dispatchEvent(new Event('visibilitychange'));
});

// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(2000);

// App should still be authenticated (handler didn't break anything)
Expand Down Expand Up @@ -860,10 +879,12 @@ test.describe('SSO Authentication with Mock OIDC Provider', () => {
expect(initialToken.length).toBeGreaterThan(0);

// Wait 10 seconds to simulate idle period
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(10000);

// Navigate to a different page
await page.goto('/explore/tables');
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(5000);

// Should still be authenticated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const table = new TableClass();

const test = base.extend<{ bulkEditorPage: Page }>({
bulkEditorPage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const page = await browser.newPage();
await editorUser.login(page);
await use(page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ test.describe('Context Center Articles', () => {
url.pathname.includes('/context-center/articles/')
);
await waitForAllLoadersToDisappear(page);
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(500);

await navigateToArticles(page);
Expand Down Expand Up @@ -1190,6 +1191,7 @@ test.describe('Context Center Articles', () => {
.click();
await page.getByTestId('save').click();

// eslint-disable-next-line playwright/no-wait-for-selector -- waiting on dynamic element
await page.waitForSelector(
'[role="dialog"].description-markdown-editor',
{ state: 'hidden' }
Expand Down Expand Up @@ -1437,6 +1439,7 @@ test.describe('Context Center Articles', () => {
.getByTestId('entity-header-display-name')
.fill(newDisplayName);
await page.getByText('Unsaved').waitFor({ state: 'visible' });
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(400);
await page.getByRole('link', { name: 'Articles' }).click();
});
Expand Down Expand Up @@ -1494,6 +1497,7 @@ test.describe('Context Center Articles', () => {
await navigateToArticle(page, draftArticleA.fullyQualifiedName);
await page.fill('.om-block-editor', reloadDescription);
await page.getByText('Unsaved').waitFor({ state: 'visible' });
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(400);
});

Expand Down Expand Up @@ -1573,6 +1577,7 @@ test.describe('Context Center Articles', () => {
await navigateToArticle(page, articleToDelete.fullyQualifiedName);
await page.fill('.om-block-editor', 'This draft should be deleted');
await page.getByText('Unsaved').waitFor({ state: 'visible' });
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(400);
});

Expand Down Expand Up @@ -1621,13 +1626,15 @@ test.describe('Context Center Articles', () => {
await navigateToArticle(page, draftArticleA.fullyQualifiedName);
await page.fill('.om-block-editor', contentA);
await page.getByText('Unsaved').waitFor({ state: 'visible' });
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(400);
});

await test.step('Navigate to draft article B and type without saving', async () => {
await navigateToArticle(page, draftArticleB.fullyQualifiedName);
await page.fill('.om-block-editor', contentB);
await page.getByText('Unsaved').waitFor({ state: 'visible' });
// eslint-disable-next-line playwright/no-wait-for-timeout -- deliberate stabilization wait
await page.waitForTimeout(400);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ test.describe('Context Center - Documents Page', () => {
const clipboardText = await copyAndGetClipboardText(page, copyBtn);
expect(clipboardText).toContain(`document=${doc.id}`);

// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const newTab = await browser.newPage();
await newTab.goto(clipboardText);
await newTab
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const entityTypeToTestEntity: Record<string, TestEntity> = {

const test = base.extend<{ page: Page }>({
page: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const page = await browser.newPage();
await adminUser.login(page);
await use(page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ const test = base.extend<{
userPage: Page;
}>({
adminPage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const adminPage = await browser.newPage();
await adminUser.login(adminPage);
await use(adminPage);
await adminPage.close();
},
userPage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const page = await browser.newPage();
await user.login(page);
await use(page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ const test = base.extend<{
userPage: Page;
}>({
adminPage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const page = await browser.newPage();
await adminUser.login(page);
await use(page);
await page.close();
},
userPage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const page = await browser.newPage();
await user.login(page);
await use(page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ const test = base.extend<{
userPage: Page;
}>({
adminPage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const adminPage = await browser.newPage();
await adminUser.login(adminPage);
await use(adminPage);
await adminPage.close();
},
userPage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const page = await browser.newPage();
await user.login(page);
await use(page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,72 +78,84 @@ const test = base.extend<{
await afterAction();
},
createPage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const page = await browser.newPage();
await createUser.login(page);
await use(page);
await page.close();
},
deletePage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const page = await browser.newPage();
await deleteUser.login(page);
await use(page);
await page.close();
},
suitePage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const page = await browser.newPage();
await suiteUser.login(page);
await use(page);
await page.close();
},
viewBasicPage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const page = await browser.newPage();
await viewBasicUser.login(page);
await use(page);
await page.close();
},
consumerPage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const page = await browser.newPage();
await dataConsumerUser.login(page);
await use(page);
await page.close();
},
stewardPage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const page = await browser.newPage();
await dataStewardUser.login(page);
await use(page);
await page.close();
},
tableCreateTestsPage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const page = await browser.newPage();
await tableCreateTestsUser.login(page);
await use(page);
await page.close();
},
editPage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const page = await browser.newPage();
await editTestCaseUser.login(page);
await use(page);
await page.close();
},
tableEditPage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const page = await browser.newPage();
await tableEditTestsUser.login(page);
await use(page);
await page.close();
},
editTestsPage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const page = await browser.newPage();
await editTestsOnTcUser.login(page);
await use(page);
await page.close();
},
viewAllPage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const page = await browser.newPage();
await viewAllTcUser.login(page);
await use(page);
await page.close();
},
suiteEditOnlyPage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const page = await browser.newPage();
await suiteEditOnlyUser.login(page);
await use(page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const test = base.extend<{
testCaseEditPage: Page;
}>({
testCaseEditPage: async ({ browser }, use) => {
// eslint-disable-next-line no-restricted-syntax -- existing multi-context test pattern
const page = await browser.newPage();
await testCaseEditUser.login(page);
await use(page);
Expand Down
Loading
Loading