mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-08 15:04:29 +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 { test as base, expect, Page } from '@playwright/test';
|
||||||
import { SidebarItem } from '../../constant/sidebar';
|
import { SidebarItem } from '../../constant/sidebar';
|
||||||
import { Domain } from '../../support/domain/Domain';
|
import { Domain } from '../../support/domain/Domain';
|
||||||
import { AdminClass } from '../../support/user/AdminClass';
|
|
||||||
import { performAdminLogin } from '../../utils/admin';
|
import { performAdminLogin } from '../../utils/admin';
|
||||||
import { getApiContext, redirectToHomePage } from '../../utils/common';
|
import { redirectToHomePage } from '../../utils/common';
|
||||||
import {
|
import {
|
||||||
addAssetsToDomain,
|
addAssetsToDomain,
|
||||||
addServicesToDomain,
|
addServicesToDomain,
|
||||||
@ -31,21 +30,16 @@ const test = base.extend<{
|
|||||||
ingestionBotPage: Page;
|
ingestionBotPage: Page;
|
||||||
}>({
|
}>({
|
||||||
page: async ({ browser }, use) => {
|
page: async ({ browser }, use) => {
|
||||||
const adminUser = new AdminClass();
|
const { afterAction, page } = await performAdminLogin(browser);
|
||||||
const adminPage = await browser.newPage();
|
|
||||||
await adminUser.login(adminPage);
|
await use(page);
|
||||||
await use(adminPage);
|
await afterAction();
|
||||||
await adminPage.close();
|
|
||||||
},
|
},
|
||||||
ingestionBotPage: async ({ browser }, use) => {
|
ingestionBotPage: async ({ browser }, use) => {
|
||||||
const admin = new AdminClass();
|
const { apiContext, afterAction } = await performAdminLogin(browser);
|
||||||
|
|
||||||
const page = await browser.newPage();
|
const page = await browser.newPage();
|
||||||
|
await page.goto('/');
|
||||||
// login with admin user
|
|
||||||
await admin.login(page);
|
|
||||||
await page.waitForURL('**/my-data');
|
|
||||||
|
|
||||||
const { apiContext } = await getApiContext(page);
|
|
||||||
|
|
||||||
const bot = await apiContext
|
const bot = await apiContext
|
||||||
.get('/api/v1/bots/name/ingestion-bot')
|
.get('/api/v1/bots/name/ingestion-bot')
|
||||||
@ -55,10 +49,15 @@ const test = base.extend<{
|
|||||||
.then((response) => response.json());
|
.then((response) => response.json());
|
||||||
|
|
||||||
await setToken(page, tokenData.config.JWTToken);
|
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 use(page);
|
||||||
await page.close();
|
await page.close();
|
||||||
|
await afterAction();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -186,6 +186,10 @@ setup('authenticate all users', async ({ browser }) => {
|
|||||||
.storageState({ path: ownerFile, indexedDB: true });
|
.storageState({ path: ownerFile, indexedDB: true });
|
||||||
|
|
||||||
await afterAction();
|
await afterAction();
|
||||||
|
|
||||||
|
if (newAdminPage) {
|
||||||
|
await newAdminPage.close();
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.error('Error during authentication setup:', error);
|
console.error('Error during authentication setup:', error);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user