mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-02 19:48:17 +00:00
chore(test): fix ingestion bot tests (#23439)
This commit is contained in:
parent
f8f57fc4af
commit
075b4ea6d6
@ -13,9 +13,8 @@
|
||||
import { test as base, expect, Page } from '@playwright/test';
|
||||
import { SidebarItem } from '../../constant/sidebar';
|
||||
import { Domain } from '../../support/domain/Domain';
|
||||
import { AdminClass } from '../../support/user/AdminClass';
|
||||
import { performAdminLogin } from '../../utils/admin';
|
||||
import { getApiContext, redirectToHomePage } from '../../utils/common';
|
||||
import { redirectToHomePage } from '../../utils/common';
|
||||
import {
|
||||
addAssetsToDomain,
|
||||
addServicesToDomain,
|
||||
@ -31,21 +30,16 @@ const test = base.extend<{
|
||||
ingestionBotPage: Page;
|
||||
}>({
|
||||
page: async ({ browser }, use) => {
|
||||
const adminUser = new AdminClass();
|
||||
const adminPage = await browser.newPage();
|
||||
await adminUser.login(adminPage);
|
||||
await use(adminPage);
|
||||
await adminPage.close();
|
||||
const { afterAction, page } = await performAdminLogin(browser);
|
||||
|
||||
await use(page);
|
||||
await afterAction();
|
||||
},
|
||||
ingestionBotPage: async ({ browser }, use) => {
|
||||
const admin = new AdminClass();
|
||||
const { apiContext, afterAction } = await performAdminLogin(browser);
|
||||
|
||||
const page = await browser.newPage();
|
||||
|
||||
// login with admin user
|
||||
await admin.login(page);
|
||||
await page.waitForURL('**/my-data');
|
||||
|
||||
const { apiContext } = await getApiContext(page);
|
||||
await page.goto('/');
|
||||
|
||||
const bot = await apiContext
|
||||
.get('/api/v1/bots/name/ingestion-bot')
|
||||
@ -55,10 +49,15 @@ const test = base.extend<{
|
||||
.then((response) => response.json());
|
||||
|
||||
await setToken(page, tokenData.config.JWTToken);
|
||||
await redirectToHomePage(page);
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.waitForSelector('loader', { state: 'hidden' });
|
||||
|
||||
await expect(page.getByTestId('nav-user-name')).toHaveText('ingestion-bot');
|
||||
|
||||
// await afterAction();
|
||||
await use(page);
|
||||
await page.close();
|
||||
await afterAction();
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@ -186,6 +186,10 @@ setup('authenticate all users', async ({ browser }) => {
|
||||
.storageState({ path: ownerFile, indexedDB: true });
|
||||
|
||||
await afterAction();
|
||||
|
||||
if (newAdminPage) {
|
||||
await newAdminPage.close();
|
||||
}
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Error during authentication setup:', error);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user