Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMM-7 fixed portal toast #675

Merged
merged 25 commits into from
Aug 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading