Skip to content

Commit dfceac3

Browse files
test(block): overhaul regression tests based on updated specs
This commit completely reworks the 'Block User' regression tests to align with the latest Testiny specifications. Key changes include: - Team Context: Implement setup logic to distinguish between users in the same team vs. different teams. - New Test Case: Add @TC-8778 to verify that users cannot block members of their own team. - Updated Logic: Refactor existing tests (@TC-140, @TC-142, @TC-148) to reflect strict blocking behavior and UI changes. - POM Updates: - Added `UnblockWarningModal`. - Updated `ConversationListPage` and `ConversationDetailsPage` with new locators for blocking/unblocking controls and status indicators. - Updated `userActions` helpers to support optional UI connection steps. Refs: WPB-19940
1 parent 43b9dd9 commit dfceac3

File tree

6 files changed

+235
-149
lines changed

6 files changed

+235
-149
lines changed

test/e2e_tests/pageManager/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import {importBackupModal} from './webapp/modals/importBackup.modal';
5050
import {LeaveConversationModal} from './webapp/modals/leaveConversation.modal';
5151
import {RemoveMemberModal} from './webapp/modals/removeMember.modal';
5252
import {UnableToOpenConversationModal} from './webapp/modals/unableToOpenConversation.modal';
53+
import {UnblockWarningModal} from './webapp/modals/unblockWarning.modal';
5354
import {UserProfileModal} from './webapp/modals/userProfile.modal';
5455
import {VerifyEmailModal} from './webapp/modals/verifyEmail.modal';
5556
import {AccountPage} from './webapp/pages/account.page';
@@ -116,7 +117,11 @@ export class PageManager {
116117
return this.page.goto(teamManagementPath, {waitUntil: 'networkidle'});
117118
};
118119

119-
refreshPage = (options: {waitUntil?: 'load' | 'domcontentloaded' | 'networkidle'} = {waitUntil: 'networkidle'}) => {
120+
refreshPage = (
121+
options: {
122+
waitUntil?: 'load' | 'domcontentloaded' | 'networkidle';
123+
} = {waitUntil: 'networkidle'},
124+
) => {
120125
return this.page.reload(options);
121126
};
122127

@@ -221,6 +226,8 @@ export class PageManager {
221226
this.getOrCreate('webapp.modals.conversationNotConnected', () => new ConversationNotConnectedModal(this.page)),
222227
createNewFolder: () =>
223228
this.getOrCreate('webapp.modals.createNewFolder', () => new CreateNewFolderModal(this.page)),
229+
unblockWarningModal: () =>
230+
this.getOrCreate('webapp.modals.unblockWarningModal', () => new UnblockWarningModal(this.page)),
224231
},
225232
components: {
226233
contactList: () => this.getOrCreate('webapp.components.ContactList', () => new ContactList(this.page)),
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Wire
3+
* Copyright (C) 2025 Wire Swiss GmbH
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see http://www.gnu.org/licenses/.
17+
*
18+
*/
19+
20+
import {Locator, Page} from '@playwright/test';
21+
22+
export class UnblockWarningModal {
23+
readonly page: Page;
24+
25+
readonly modal: Locator;
26+
readonly modalTitle: Locator;
27+
readonly modalText: Locator;
28+
readonly unblockButton: Locator;
29+
readonly cancelButton: Locator;
30+
31+
constructor(page: Page) {
32+
this.page = page;
33+
34+
this.modal = page.locator("[data-uie-name='primary-modals-container'][aria-label*='Unblock?']");
35+
this.modalTitle = this.modal.locator("[data-uie-name='status-modal-title']");
36+
this.modalText = this.modal.locator("[data-uie-name='status-modal-text']");
37+
this.unblockButton = this.modal.locator("[data-uie-name='do-action']");
38+
this.cancelButton = this.modal.locator("[data-uie-name='do-secondary']");
39+
}
40+
41+
async isModalPresent() {
42+
return await this.modal.isVisible();
43+
}
44+
45+
async getModalTitle() {
46+
return (await this.modalTitle.textContent()) ?? '';
47+
}
48+
49+
async getModalText() {
50+
return (await this.modalText.textContent()) ?? '';
51+
}
52+
53+
async isBlockButtonVisible() {
54+
return await this.unblockButton.isVisible();
55+
}
56+
57+
async clickCancel() {
58+
await this.cancelButton.click();
59+
}
60+
61+
async clickUnblock() {
62+
await this.unblockButton.click();
63+
}
64+
}

test/e2e_tests/pageManager/webapp/pages/conversationDetails.page.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class ConversationDetailsPage {
2828
readonly conversationDetails: Locator;
2929
readonly guestOptionsButton: Locator;
3030
readonly archiveButton: Locator;
31+
readonly blockConversationButton: Locator;
3132

3233
constructor(page: Page) {
3334
this.page = page;
@@ -36,6 +37,7 @@ export class ConversationDetailsPage {
3637
this.conversationDetails = page.locator('#conversation-details');
3738
this.guestOptionsButton = this.conversationDetails.locator('[data-uie-name="go-guest-options"]');
3839
this.archiveButton = this.conversationDetails.locator(selectByDataAttribute('do-archive'));
40+
this.blockConversationButton = this.conversationDetails.locator(selectByDataAttribute('do-block'));
3941
}
4042

4143
async isOpen(conversationName: string) {
@@ -96,4 +98,8 @@ export class ConversationDetailsPage {
9698
async clickArchiveButton() {
9799
await this.archiveButton.click();
98100
}
101+
102+
async clickBlockConversationButton() {
103+
await this.blockConversationButton.click();
104+
}
99105
}

test/e2e_tests/pageManager/webapp/pages/conversationList.page.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import {Locator, Page} from '@playwright/test';
2222
import {selectById, selectByDataAttribute} from 'test/e2e_tests/utils/selector.util';
2323
import {escapeHtml} from 'test/e2e_tests/utils/userDataProcessor';
2424

25+
import {User} from '../../../data/user';
26+
2527
export class ConversationListPage {
2628
readonly page: Page;
2729

@@ -36,6 +38,10 @@ export class ConversationListPage {
3638
readonly moveConversationToFolderButton: Locator;
3739
readonly createNewFolderButton: Locator;
3840
readonly customFolderButton: Locator;
41+
readonly statusLabel: Locator;
42+
readonly blockedChip: Locator;
43+
readonly profilePicture: Locator;
44+
readonly unblockConversationMenuButton: Locator;
3945

4046
constructor(page: Page) {
4147
this.page = page;
@@ -56,6 +62,12 @@ export class ConversationListPage {
5662
this.moveConversationToFolderButton = page.locator(selectById('btn-move-to'));
5763
this.createNewFolderButton = page.locator(selectById('btn-create-new-folder'));
5864
this.customFolderButton = page.locator(selectByDataAttribute('conversation-label-context-menu'));
65+
this.statusLabel = page.locator(selectByDataAttribute('status-label'));
66+
this.blockedChip = page.locator(`span[data-uie-name="status-label"] + span`);
67+
this.profilePicture = page.locator(selectByDataAttribute('element-avatar-user'));
68+
this.unblockConversationMenuButton = page.locator(
69+
`${selectById('btn-unblock')}${selectByDataAttribute('conversation-list-options-menu')}`,
70+
);
5971
}
6072

6173
async isConversationItemVisible(conversationName: string) {
@@ -129,4 +141,15 @@ export class ConversationListPage {
129141
await this.searchConversationsInput.fill(conversationName);
130142
await this.openConversation(conversationName);
131143
}
144+
145+
async getUserAvatarWrapper(user: User): Promise<Locator> {
146+
return this.page
147+
.locator(selectByDataAttribute('item-conversation'))
148+
.filter({has: this.page.locator(selectByDataAttribute('status-label'), {hasText: user.fullName})})
149+
.locator(selectByDataAttribute('element-avatar-user'));
150+
}
151+
152+
async clickUnblockConversation() {
153+
await this.unblockConversationMenuButton.click();
154+
}
132155
}

0 commit comments

Comments
 (0)