mirror of
https://github.com/mattermost/mattermost.git
synced 2026-05-28 04:35:04 -04:00
Fix: Playwright e2e tests (#29768)
This commit is contained in:
parent
22856b4d64
commit
e6b4764e0d
4 changed files with 16 additions and 5 deletions
|
|
@ -10,6 +10,7 @@ export default class SystemUsers {
|
|||
readonly container: Locator;
|
||||
|
||||
readonly searchInput: Locator;
|
||||
readonly saveRoleChange: Locator;
|
||||
readonly columnToggleMenuButton: Locator;
|
||||
readonly dateRangeSelectorMenuButton: Locator;
|
||||
readonly exportButton: Locator;
|
||||
|
|
@ -22,6 +23,7 @@ export default class SystemUsers {
|
|||
this.container = container;
|
||||
|
||||
this.searchInput = this.container.getByLabel('Search users');
|
||||
this.saveRoleChange = this.container.locator('button.btn-primary:has-text("Save")');
|
||||
this.columnToggleMenuButton = this.container.locator('#systemUsersColumnTogglerMenuButton');
|
||||
this.dateRangeSelectorMenuButton = this.container.locator('#systemUsersDateRangeSelectorMenuButton');
|
||||
this.exportButton = this.container.getByText('Export');
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ class SystemConsolePage {
|
|||
readonly systemUsersDateRangeMenu;
|
||||
readonly systemUsersColumnToggleMenu;
|
||||
readonly systemUsersActionMenus;
|
||||
readonly saveChangesModal;
|
||||
|
||||
constructor(page: Page) {
|
||||
this.page = page;
|
||||
|
|
@ -46,6 +47,7 @@ class SystemConsolePage {
|
|||
this.systemUsersActionMenus = Array.from(Array(10).keys()).map(
|
||||
(index) => new components.SystemUsersFilterMenu(page.locator(`#actionMenu-systemUsersTable-${index}`)),
|
||||
);
|
||||
this.saveChangesModal = new components.SystemUsers(page.locator('div.modal-content'));
|
||||
}
|
||||
|
||||
async toBeVisible() {
|
||||
|
|
@ -58,6 +60,14 @@ class SystemConsolePage {
|
|||
async goto() {
|
||||
await this.page.goto('/admin_console');
|
||||
}
|
||||
|
||||
async saveRoleChange() {
|
||||
await this.saveChangesModal.container.locator('button.btn-primary:has-text("Save")').click();
|
||||
}
|
||||
|
||||
async clickResetButton() {
|
||||
await this.saveChangesModal.container.locator('button.btn-primary:has-text("Reset")').click();
|
||||
}
|
||||
}
|
||||
|
||||
export {SystemConsolePage};
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ test('MM-T53377 Profile popover should show correct fields after at-mention auto
|
|||
|
||||
// * Verify only username is visible for other user
|
||||
await expect(popover.container.getByText(`@${testUser2.username}`)).toBeVisible();
|
||||
await expect(popover.container.getByText(`${testUser2.first_name} ${testUser2.last_name}`)).not.toBeVisible();
|
||||
await expect(popover.container.getByText(testUser2.email)).not.toBeVisible();
|
||||
|
||||
// # Close profile popover
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ test('MM-T5520-2 should change user roles', async ({pw, pages}) => {
|
|||
const systemAdmin = systemConsolePage.page.locator('input[name="systemadmin"]');
|
||||
await systemAdmin.waitFor();
|
||||
await systemAdmin.click();
|
||||
await systemConsolePage.page.locator('button.btn-primary').click();
|
||||
systemConsolePage.saveRoleChange();
|
||||
|
||||
// * Verify that the modal closed and no error showed
|
||||
await systemAdmin.waitFor({state: 'detached'});
|
||||
|
|
@ -111,7 +111,7 @@ test('MM-T5520-2 should change user roles', async ({pw, pages}) => {
|
|||
const systemMember = systemConsolePage.page.locator('input[name="systemmember"]');
|
||||
await systemMember.waitFor();
|
||||
await systemMember.click();
|
||||
await systemConsolePage.page.locator('button.btn-primary').click();
|
||||
await systemConsolePage.saveRoleChange();
|
||||
|
||||
// * Verify that the modal closed and no error showed
|
||||
await systemMember.waitFor({state: 'detached'});
|
||||
|
|
@ -168,7 +168,7 @@ test('MM-T5520-4 should reset the users password', async ({pw, pages}) => {
|
|||
// # Enter a random password and click Save
|
||||
const passwordInput = systemConsolePage.page.locator('input[type="password"]');
|
||||
await passwordInput.fill(getRandomId());
|
||||
await systemConsolePage.page.locator('button.btn-primary').click();
|
||||
await systemConsolePage.clickResetButton();
|
||||
|
||||
// * Verify that the modal closed and no error showed
|
||||
await passwordInput.waitFor({state: 'detached'});
|
||||
|
|
@ -186,7 +186,7 @@ test('MM-T5520-5 should change the users email', async ({pw, pages}) => {
|
|||
// # Enter a random password and click Save
|
||||
const emailInput = await systemConsolePage.page.locator('input[type="email"]');
|
||||
await emailInput.fill(newEmail);
|
||||
await systemConsolePage.page.locator('button.btn-primary').click();
|
||||
await systemConsolePage.clickResetButton();
|
||||
|
||||
// * Verify that the modal closed
|
||||
await emailInput.waitFor({state: 'detached'});
|
||||
|
|
|
|||
Loading…
Reference in a new issue