Skip to content

Commit 1a7dfa1

Browse files
committed
test: align TC-1089 deletion flow with Testiny updates
1 parent c204299 commit 1a7dfa1

1 file changed

Lines changed: 32 additions & 29 deletions

File tree

apps/webapp/test/e2e_tests/specs/GroupConversation/groupConversation.spec.ts

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -93,38 +93,41 @@ test.describe('Group Conversation', () => {
9393
},
9494
);
9595

96-
test(
97-
'I want to delete a group as the Group Creator',
98-
{tag: ['@TC-1089', '@TC-1090', '@TC-1090', '@regression']},
99-
async ({createPage}) => {
100-
const {pages, modals} = PageManager.from(
101-
await createPage(withLogin(userA), withConnectedUser(userB), withConnectedUser(userC)),
102-
).webapp;
103-
104-
await createGroup(pages, groupName, [userB, userC]);
105-
const conversation = pages.conversationList().list.filter({hasText: groupName});
106-
107-
await pages.conversationList().openConversation(groupName);
108-
await pages.conversation().clickConversationInfoButton();
109-
await pages.conversationDetails().deleteGroupButton.click();
110-
111-
// User sees a confirmation dialog with explanation when he initiates delete group
112-
await expect(modals.confirm().modalText).toContainText(
113-
'This will delete the conversation and all content for all participants on all devices',
114-
);
96+
test('I want to delete a group as the Group Creator', {tag: ['@TC-1089', '@regression']}, async ({createPage}) => {
97+
const [userAPage, userBPage] = await Promise.all([createPage(withLogin(userA)), createPage(withLogin(userB))]);
98+
const {pages: userAPages, modals: userAModals} = PageManager.from(userAPage).webapp;
99+
const userBPages = PageManager.from(userBPage).webapp.pages;
115100

116-
// User can cancel the delete group from the confirmation dialog
117-
await modals.confirm().cancelButton.click();
118-
await expect(conversation).toBeVisible();
101+
await createGroup(userAPages, groupName, [userB, userC]);
102+
const adminGroupLocator = userAPages.conversationList().list.filter({hasText: groupName});
103+
const memberGroupLocator = userBPages.conversationList().list.filter({hasText: groupName});
119104

120-
// User can delete group as the group creator
121-
await pages.conversationDetails().deleteGroupButton.click();
122-
await modals.confirm().actionButton.click();
105+
// Pre-condition: Ensure the member can see the group before the creator deletes it
106+
await expect(memberGroupLocator).toBeVisible();
123107

124-
await conversation.waitFor({state: 'detached'});
125-
await expect(conversation).not.toBeVisible();
126-
},
127-
);
108+
// User A initiate group deletion
109+
await userAPages.conversationList().openConversation(groupName);
110+
await userAPages.conversation().clickConversationInfoButton();
111+
await userAPages.conversationDetails().deleteGroupButton.click();
112+
113+
// User sees a confirmation dialog with explanation when he initiates delete group
114+
await expect(userAModals.confirm().modalText).toContainText(
115+
'This will delete the conversation and all content for all participants on all devices',
116+
);
117+
118+
// User can cancel the delete group from the confirmation dialog
119+
await userAModals.confirm().cancelButton.click();
120+
await expect(adminGroupLocator).toBeVisible();
121+
122+
// User can delete group as the group creator
123+
await userAPages.conversationDetails().deleteGroupButton.click();
124+
await userAModals.confirm().actionButton.click();
125+
126+
// Verify the group no longer exists for any user
127+
await adminGroupLocator.waitFor({state: 'detached'});
128+
await expect(adminGroupLocator).toBeHidden();
129+
await expect(memberGroupLocator).toBeHidden();
130+
});
128131

129132
test(
130133
'I want to be notified about the group deletion when app is in background',

0 commit comments

Comments
 (0)