mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-07-30 12:49:58 +00:00
supported util method for toastNotificaton (#16968)
This commit is contained in:
parent
0caa8a8018
commit
ff8acbd23d
@ -13,7 +13,11 @@
|
||||
import test, { expect } from '@playwright/test';
|
||||
import { TableClass } from '../../support/entity/TableClass';
|
||||
import { UserClass } from '../../support/user/UserClass';
|
||||
import { createNewPage, redirectToHomePage } from '../../utils/common';
|
||||
import {
|
||||
createNewPage,
|
||||
redirectToHomePage,
|
||||
toastNotification,
|
||||
} from '../../utils/common';
|
||||
import { clickOnLogo } from '../../utils/sidebar';
|
||||
import {
|
||||
createDescriptionTask,
|
||||
@ -110,21 +114,13 @@ test.describe('Activity feed', () => {
|
||||
|
||||
await page.getByText('Accept Suggestion').click();
|
||||
|
||||
await expect(page.getByRole('alert').first()).toHaveText(
|
||||
/Task resolved successfully/
|
||||
);
|
||||
|
||||
await page.getByLabel('close').first().click();
|
||||
await toastNotification(page, /Task resolved successfully/);
|
||||
|
||||
// Task 1 - Request to update tag to be resolved
|
||||
|
||||
await page.getByText('Accept Suggestion').click();
|
||||
|
||||
await expect(page.getByRole('alert').first()).toHaveText(
|
||||
/Task resolved successfully/
|
||||
);
|
||||
|
||||
await page.getByLabel('close').first().click();
|
||||
await toastNotification(page, /Task resolved successfully/);
|
||||
|
||||
const closedTask = await page.getByTestId('closed-task').textContent();
|
||||
|
||||
|
@ -21,6 +21,7 @@ import {
|
||||
performAdminLogin,
|
||||
performUserLogin,
|
||||
redirectToHomePage,
|
||||
toastNotification,
|
||||
} from '../../utils/common';
|
||||
import {
|
||||
approveGlossaryTermTask,
|
||||
@ -228,12 +229,11 @@ test.describe('Glossary tests', () => {
|
||||
await page.getByTestId('saveAssociatedTag').click();
|
||||
await patchRequest;
|
||||
|
||||
await expect(page.getByRole('alert').first()).toContainText(
|
||||
"mutually exclusive and can't be assigned together"
|
||||
await toastNotification(
|
||||
page,
|
||||
/mutually exclusive and can't be assigned together/
|
||||
);
|
||||
|
||||
await page.getByLabel('close').first().click();
|
||||
|
||||
// Add non mutually exclusive tags
|
||||
await page.click(
|
||||
'[data-testid="entity-right-panel"] [data-testid="glossary-container"] [data-testid="add-tag"]'
|
||||
|
@ -12,20 +12,16 @@
|
||||
*/
|
||||
import test, { expect, Page } from '@playwright/test';
|
||||
import { GlobalSettingOptions } from '../../constant/settings';
|
||||
import { getApiContext, redirectToHomePage } from '../../utils/common';
|
||||
import {
|
||||
getApiContext,
|
||||
redirectToHomePage,
|
||||
toastNotification,
|
||||
} from '../../utils/common';
|
||||
import { settingClick } from '../../utils/sidebar';
|
||||
|
||||
// use the admin user to login
|
||||
test.use({ storageState: 'playwright/.auth/admin.json' });
|
||||
|
||||
const verifyApplicationTriggerToastData = async (page: Page) => {
|
||||
await expect(page.getByRole('alert').first()).toHaveText(
|
||||
/Application triggered successfully/
|
||||
);
|
||||
|
||||
await page.getByLabel('close').first().click();
|
||||
};
|
||||
|
||||
const verifyLastExecutionStatus = async (page: Page) => {
|
||||
const { apiContext } = await getApiContext(page);
|
||||
|
||||
@ -100,11 +96,7 @@ test('Search Index Application', async ({ page }) => {
|
||||
await page.click('.ant-modal-body [data-testid="deploy-button"]');
|
||||
await deployResponse;
|
||||
|
||||
await expect(page.getByRole('alert').first()).toHaveText(
|
||||
/Schedule saved successfully/
|
||||
);
|
||||
|
||||
await page.getByLabel('close').first().click();
|
||||
await toastNotification(page, 'Schedule saved successfully');
|
||||
|
||||
expect(await page.innerText('[data-testid="schedule-type"]')).toContain(
|
||||
'None'
|
||||
@ -124,11 +116,7 @@ test('Search Index Application', async ({ page }) => {
|
||||
await page.click('[data-testid="submit-btn"]');
|
||||
await responseAfterSubmit;
|
||||
|
||||
await expect(page.getByRole('alert').first()).toHaveText(
|
||||
/Configuration saved successfully/
|
||||
);
|
||||
|
||||
await page.getByLabel('close').first().click();
|
||||
await toastNotification(page, 'Configuration saved successfully');
|
||||
});
|
||||
|
||||
await test.step('Uninstall application', async () => {
|
||||
@ -141,11 +129,7 @@ test('Search Index Application', async ({ page }) => {
|
||||
await page.click('[data-testid="save-button"]');
|
||||
await deleteRequest;
|
||||
|
||||
await expect(page.getByRole('alert').first()).toHaveText(
|
||||
/Application uninstalled/
|
||||
);
|
||||
|
||||
await page.getByLabel('close').first().click();
|
||||
await toastNotification(page, 'Application uninstalled successfully');
|
||||
|
||||
const card1 = page.locator(
|
||||
'[data-testid="search-indexing-application-card"]'
|
||||
@ -179,11 +163,7 @@ test('Search Index Application', async ({ page }) => {
|
||||
await page.click('[data-testid="deploy-button"]');
|
||||
await installApplicationResponse;
|
||||
|
||||
await expect(page.getByRole('alert').first()).toHaveText(
|
||||
/Application installed successfully/
|
||||
);
|
||||
|
||||
await page.getByLabel('close').first().click();
|
||||
await toastNotification(page, 'Application installed successfully');
|
||||
|
||||
const card = page.locator(
|
||||
'[data-testid="search-indexing-application-card"]'
|
||||
@ -207,7 +187,7 @@ test('Search Index Application', async ({ page }) => {
|
||||
|
||||
await triggerPipelineResponse;
|
||||
|
||||
await verifyApplicationTriggerToastData(page);
|
||||
await toastNotification(page, 'Application triggered successfully');
|
||||
|
||||
await page.reload();
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Browser, Page, request } from '@playwright/test';
|
||||
import { Browser, expect, Page, request } from '@playwright/test';
|
||||
import { randomUUID } from 'crypto';
|
||||
import { AdminClass } from '../support/user/AdminClass';
|
||||
import { UserClass } from '../support/user/UserClass';
|
||||
@ -129,6 +129,15 @@ export const performUserLogin = async (browser, user: UserClass) => {
|
||||
return { page, apiContext, afterAction };
|
||||
};
|
||||
|
||||
export const toastNotification = async (
|
||||
page: Page,
|
||||
message: string | RegExp
|
||||
) => {
|
||||
await expect(page.getByRole('alert').first()).toHaveText(message);
|
||||
|
||||
await page.getByLabel('close').first().click();
|
||||
};
|
||||
|
||||
export const clickOutside = async (page: Page) => {
|
||||
await page.locator('body').click({
|
||||
position: {
|
||||
|
@ -12,7 +12,7 @@
|
||||
*/
|
||||
import { expect, Page } from '@playwright/test';
|
||||
import { isUndefined } from 'lodash';
|
||||
import { descriptionBox } from './common';
|
||||
import { descriptionBox, toastNotification } from './common';
|
||||
|
||||
export type TaskDetails = {
|
||||
term: string;
|
||||
@ -65,11 +65,7 @@ export const createDescriptionTask = async (
|
||||
await page.locator(descriptionBox).fill('Updated description');
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
await expect(page.getByRole('alert').first()).toHaveText(
|
||||
/Task created successfully./
|
||||
);
|
||||
|
||||
await page.getByLabel('close').first().click();
|
||||
await toastNotification(page, /Task created successfully./);
|
||||
};
|
||||
|
||||
export const createTagTask = async (
|
||||
@ -133,9 +129,5 @@ export const createTagTask = async (
|
||||
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
await expect(page.getByRole('alert').first()).toHaveText(
|
||||
/Task created successfully./
|
||||
);
|
||||
|
||||
await page.getByLabel('close').first().click();
|
||||
await toastNotification(page, /Task created successfully./);
|
||||
};
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
import { expect, Page } from '@playwright/test';
|
||||
import { adjectives, nouns } from '../constant/user';
|
||||
import { uuid } from './common';
|
||||
import { toastNotification, uuid } from './common';
|
||||
|
||||
export const getRandomFirstName = () => {
|
||||
return `${
|
||||
@ -143,11 +143,7 @@ export const restoreUserProfilePage = async (page: Page, fqn: string) => {
|
||||
|
||||
await restoreResponse;
|
||||
|
||||
await expect(page.getByRole('alert').first()).toHaveText(
|
||||
/User restored successfully/
|
||||
);
|
||||
|
||||
await page.getByLabel('close').first().click();
|
||||
await toastNotification(page, /User restored successfully/);
|
||||
|
||||
await nonDeletedUserChecks(page);
|
||||
};
|
||||
@ -175,9 +171,5 @@ export const hardDeleteUserProfilePage = async (
|
||||
|
||||
await deleteResponse;
|
||||
|
||||
await expect(page.getByRole('alert').first()).toHaveText(
|
||||
/deleted successfully!/
|
||||
);
|
||||
|
||||
await page.getByLabel('close').first().click();
|
||||
await toastNotification(page, /deleted successfully!/);
|
||||
};
|
||||
|
@ -533,6 +533,7 @@ a[href].link-text-grey,
|
||||
// beta tag for service page
|
||||
.service-beta-tag {
|
||||
sup {
|
||||
height: auto;
|
||||
padding: 0 4px;
|
||||
margin-left: 2px;
|
||||
font-size: 10px;
|
||||
|
Loading…
x
Reference in New Issue
Block a user