End to End test for Admin Reporting for Users, new User Management screen (#26077)

https://mattermost.atlassian.net/browse/MM-56672
https://mattermost.atlassian.net/browse/MM-56666
https://mattermost.atlassian.net/browse/MM-56673
Этот коммит содержится в:
M-ZubairAhmed
2024-02-12 08:28:47 +00:00
коммит произвёл GitHub
родитель 4c8a134659
Коммит 90b21cad33
19 изменённых файлов: 1371 добавлений и 1 удалений

Просмотреть файл

@@ -0,0 +1,46 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {expect, Locator, Page} from '@playwright/test';
/**
* This is the generic confirm modal that is used in the app.
* It has optional cancel button, optional checkbox and confirm button along with title and message body.
* It can present in different parts of the app such as channel, system console, etc and hence its constructor
* should be able to accept the page object of the app and an optional id to uniquely identify the modal.
*/
export default class GenericConfirmModal {
readonly container: Locator;
readonly confirmButton: Locator;
readonly cancelButton: Locator;
constructor(page: Page, id?: string) {
const modalId = `#confirmModal ${id}`.trim();
this.container = page.locator(modalId);
this.confirmButton = page.locator('#confirmModalButton');
this.cancelButton = page.locator('#cancelModalButton');
}
async toBeVisible() {
await expect(this.container).toBeVisible();
}
async confirm() {
await this.confirmButton.waitFor();
await this.confirmButton.click();
// Wait for the modal to disappear
await expect(this.container).not.toBeVisible();
}
async cancel() {
await this.cancelButton.waitFor();
await this.cancelButton.click();
// Wait for the modal to disappear
await expect(this.container).not.toBeVisible();
}
}
export {GenericConfirmModal};