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