Skip to content

Commit

Permalink
Merge branch 'main' into PMM-T1791-Regress
Browse files Browse the repository at this point in the history
  • Loading branch information
saikumar-vs authored Aug 28, 2023
2 parents 7754bd0 + a89453f commit 501cfab
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions playwright-tests/pages/page-components/toast-message-modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,12 @@ import Wait from '@helpers/enums/wait';
export default class ToastMessage {
constructor(readonly page: Page) { }

toast = this.page.locator('//div[contains(@data-testid, "Alert") or contains(@aria-label, "Alert")]');
toastSuccess = this.page.locator('//div[@data-testid="data-testid Alert success" or @aria-label="Alert success"]');
toastWarning = this.page.locator('//div[@data-testid="data-testid Alert warning" or @aria-label="Alert warning"]');
toastError = this.page.locator('//div[@data-testid="data-testid Alert error" or @aria-label="Alert error"]');

messageText = this.page.locator('.page-alert-list div[data-testid^="data-testid Alert"] > div');
messageText = this.page.locator('.page-alert-list div[data-testid^="data-testid Alert"] div[id]');
closeButton = this.page.locator('.page-alert-list button');

// closeButton = (selectedToast: Locator) => selectedToast.locator('//*[@aria-label="Close alert" or @type="button"]');

private selectToast = (variant?: string) => {
switch (variant) {
case 'success':
return this.toastSuccess;
case 'warning':
return this.toastWarning;
case 'error':
return this.toastError;
default:
return this.toast;
}
};

waitForMessage = async (message: string, timeout?: number) => {
await this.messageText.waitFor({ state: 'visible', timeout: timeout || Wait.ToastMessage });
await expect(this.messageText, `Waiting for Toast message with text "${message}"`)
Expand Down

0 comments on commit 501cfab

Please sign in to comment.