From e58ea33f15dfe6719e35e3aaafe47f1f97f099c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Wed, 13 Mar 2024 10:31:15 -0600 Subject: [PATCH 1/3] test(add): allow invited users to edit group name and users --- tests/screenobjects/chats/GroupSettings.ts | 5 +++++ tests/screenobjects/chats/Topbar.ts | 21 +++++++++++++++++++ .../10-group-chats-edit.spec.ts | 11 ++++++++++ 3 files changed, 37 insertions(+) diff --git a/tests/screenobjects/chats/GroupSettings.ts b/tests/screenobjects/chats/GroupSettings.ts index c9550dee33..54dd546199 100644 --- a/tests/screenobjects/chats/GroupSettings.ts +++ b/tests/screenobjects/chats/GroupSettings.ts @@ -121,4 +121,9 @@ export default class GroupSettings extends UplinkMainScreen { await clickOnSwitchMacOS(allowMembersToAddOthersSwitch); } } + + async validateGroupSettingsIsShown() { + const groupSettingsModal = await this.groupSettingsModal; + await groupSettingsModal.waitForExist(); + } } diff --git a/tests/screenobjects/chats/Topbar.ts b/tests/screenobjects/chats/Topbar.ts index 3a54f9b5a3..671974df14 100644 --- a/tests/screenobjects/chats/Topbar.ts +++ b/tests/screenobjects/chats/Topbar.ts @@ -295,6 +295,16 @@ export default class Topbar extends UplinkMainScreen { await topbarUserImage.click(); } + async exitGroupSettings() { + const groupSettingsButton = await this.topbarGroupSettings; + const currentDriver = await this.getCurrentDriver(); + if (currentDriver === MACOS_DRIVER) { + await leftClickOnMacOS(groupSettingsButton); + } else if (currentDriver === WINDOWS_DRIVER) { + await leftClickOnWindows(groupSettingsButton); + } + } + async exitManageMembers() { const manageMembersButton = await this.topbarManageMembers; const currentDriver = await this.getCurrentDriver(); @@ -305,6 +315,12 @@ export default class Topbar extends UplinkMainScreen { } } + async openGroupSettings() { + await this.hoverOnGroupSettingsButton(); + const groupSettings = await this.topbarGroupSettings; + await groupSettings.click(); + } + async openManageMembers() { await this.hoverOnManageMembersButton(); const manageMembers = await this.topbarManageMembers; @@ -331,6 +347,11 @@ export default class Topbar extends UplinkMainScreen { await this.hoverOnElement(favoritesRemoveButton); } + async hoverOnGroupSettingsButton() { + const groupSettingsButton = await this.topbarGroupSettings; + await this.hoverOnElement(groupSettingsButton); + } + async hoverOnPinnedMessagesButton() { const pinnedMessagesButton = await this.topbarPinnedMessages; await this.hoverOnElement(pinnedMessagesButton); diff --git a/tests/specs/reusable-accounts/10-group-chats-edit.spec.ts b/tests/specs/reusable-accounts/10-group-chats-edit.spec.ts index fdb70bd712..6a2d7379f1 100644 --- a/tests/specs/reusable-accounts/10-group-chats-edit.spec.ts +++ b/tests/specs/reusable-accounts/10-group-chats-edit.spec.ts @@ -1,4 +1,5 @@ require("module-alias/register"); +import GroupSettings from "@screenobjects/chats/GroupSettings"; import ManageMembers from "@screenobjects/chats/ManageMembers"; import ChatsSidebar from "@screenobjects/chats/ChatsSidebar"; import FilesScreen from "@screenobjects/files/FilesScreen"; @@ -14,6 +15,7 @@ import { } from "@helpers/commands"; const chatsSidebar = new ChatsSidebar(); const chatsTopbar = new Topbar(); +const groupSettings = new GroupSettings(); const manageMembers = new ManageMembers(); const filesScreen = new FilesScreen(); const welcomeScreen = new WelcomeScreen(); @@ -188,6 +190,15 @@ export default async function groupChatEditTests() { await expect(topbarUserStatus).toHaveText("Members (2)"); }); + it("Group Chat Creator - Can add permissions to invited users to change name and add/remove users", async () => { + // Open Manage Members modal and validate that invited user has permissions to change name and add/remove users + await activateFirstApplication(); + await chatsTopbar.openGroupSettings(); + await groupSettings.validateGroupSettingsIsShown(); + await groupSettings.clickOnAllowMembersToAddOthersSwitch(); + await groupSettings.clickOnAllowMembersToAddEditNameSwitch(); + }); + after(async () => { await closeFirstApplication(); await closeSecondApplication(); From 85bedfb30dda80257296f15859df48f332a4aec6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Wed, 13 Mar 2024 16:51:39 -0600 Subject: [PATCH 2/3] test(add): add tests for renaming group by invited user --- tests/screenobjects/chats/Topbar.ts | 4 ++ .../10-group-chats-edit.spec.ts | 45 +++++++++++++++++++ .../11-group-chats-sidebar.spec.ts | 36 +++++++-------- 3 files changed, 67 insertions(+), 18 deletions(-) diff --git a/tests/screenobjects/chats/Topbar.ts b/tests/screenobjects/chats/Topbar.ts index 671974df14..ded049b4f7 100644 --- a/tests/screenobjects/chats/Topbar.ts +++ b/tests/screenobjects/chats/Topbar.ts @@ -448,6 +448,10 @@ export default class Topbar extends UplinkMainScreen { await groupNameInput.waitForExist(); } + async validateManageMembersButtonIsNotShown() { + await this.topbarManageMembers.waitForExist({ reverse: true }); + } + // Open Context Menu async openNameContextMenu() { diff --git a/tests/specs/reusable-accounts/10-group-chats-edit.spec.ts b/tests/specs/reusable-accounts/10-group-chats-edit.spec.ts index 6a2d7379f1..5c8bedfdfb 100644 --- a/tests/specs/reusable-accounts/10-group-chats-edit.spec.ts +++ b/tests/specs/reusable-accounts/10-group-chats-edit.spec.ts @@ -190,6 +190,11 @@ export default async function groupChatEditTests() { await expect(topbarUserStatus).toHaveText("Members (2)"); }); + it("Group Chat Invited User - Manage Members is not displayed by default", async () => { + // Validate Manage Members is not shown by default on invited user + await chatsTopbar.validateManageMembersButtonIsNotShown(); + }); + it("Group Chat Creator - Can add permissions to invited users to change name and add/remove users", async () => { // Open Manage Members modal and validate that invited user has permissions to change name and add/remove users await activateFirstApplication(); @@ -199,6 +204,46 @@ export default async function groupChatEditTests() { await groupSettings.clickOnAllowMembersToAddEditNameSwitch(); }); + it("Group Chat Invited User - Manage Members is displayed after enabling allow to add users", async () => { + // Validate that User B was added back to the group chat + await activateSecondApplication(); + + // Validate Manage Members is visible on invited user now + await chatsTopbar.openManageMembers(); + await manageMembers.validateManageMembersIsShown(); + await manageMembers.validateManageMembersUserInputIsShown(); + + // Close Manage Members modal + await chatsTopbar.exitManageMembers(); + await chatsSidebar.validateNoModalIsOpen(); + }); + + it("Group Chat Invited User - Can rename group after enabling allow to rename group", async () => { + // Open Context Menu to Rename Group + await chatsTopbar.openNameContextMenu(); + await chatsTopbar.selectRenameGroup(); + + // Type on group name input a valid name and validate group name is changed correctly + await chatsTopbar.typeOnGroupNameInput("renamed"); + await chatsTopbar.closeGroupNameInput(); + await chatsSidebar.waitForGroupToBeCreated("renamed"); + + // Validate group name was changed correctly on local side + const topbarFirstUserName = await chatsTopbar.topbarUserNameValue; + await expect(topbarFirstUserName).toHaveText("renamed"); + await chatsSidebar.waitForGroupToBeCreated("renamed"); + }); + + it("Group Chat Creator - Validate group name was changed correctly on remote side", async () => { + // Switch control to first user + await activateFirstApplication(); + + // Validate group name was changed correctly on group creator side + await chatsSidebar.waitForGroupToBeCreated("renamed"); + const topbarFirstUserName = await chatsTopbar.topbarUserNameValue; + await expect(topbarFirstUserName).toHaveText("renamed"); + }); + after(async () => { await closeFirstApplication(); await closeSecondApplication(); diff --git a/tests/specs/reusable-accounts/11-group-chats-sidebar.spec.ts b/tests/specs/reusable-accounts/11-group-chats-sidebar.spec.ts index 7fb9112f58..e7f185c090 100644 --- a/tests/specs/reusable-accounts/11-group-chats-sidebar.spec.ts +++ b/tests/specs/reusable-accounts/11-group-chats-sidebar.spec.ts @@ -34,7 +34,7 @@ export default async function groupChatSidebarTests() { it("Group Chat - Add group to favorites", async () => { // Return control of execution to User A and leave Participants List screen - await chatsSidebar.goToSidebarGroupChat("X"); + await chatsSidebar.goToSidebarGroupChat("renamed"); await chatsTopbar.clickOnTopbar(); // Click on Favorites button for Group Chat @@ -43,7 +43,7 @@ export default async function groupChatSidebarTests() { // Favorites Sidebar should be displayed and showing the name of the group added to Favorites // Favorites Sidebar User bubble should be displayed - await favoritesSidebar.validateFavoritesUserImage("X"); + await favoritesSidebar.validateFavoritesUserImage("renamed"); }); it("Group Chat - Remove group from favorites", async () => { @@ -64,7 +64,7 @@ export default async function groupChatSidebarTests() { it("Group Chat - Send message to the group with User B", async () => { // Switch test execution control to User B and send message to the group await activateSecondApplication(); - await chatsSidebar.goToSidebarGroupChat("X"); + await chatsSidebar.goToSidebarGroupChat("renamed"); await chatsInput.typeMessageOnInput("HelloGroup"); await chatsInput.clickOnSendMessage(); await messageLocal.waitForMessageSentToExist("HelloGroup"); @@ -75,7 +75,7 @@ export default async function groupChatSidebarTests() { await activateFirstApplication(); // Validate Sidebar shows Group Name - await chatsSidebar.validateUsernameDisplayed("X"); + await chatsSidebar.validateUsernameDisplayed("renamed"); // Validate last message content from group is displayed on sidebar await chatsSidebar.validateLastMessageDisplayed("HelloGroup"); @@ -89,16 +89,16 @@ export default async function groupChatSidebarTests() { it("Group Chat - Sidebar - Context Menu - Clear Unreads", async () => { // Open context menu on group chat and select Clear Unreads - await chatsSidebar.openContextMenuOnGroupChat("X"); + await chatsSidebar.openContextMenuOnGroupChat("renamed"); await contextMenuSidebar.selectChatsClearUnreads(); await chatsSidebar.validateNoUnreadMessages(); }); it("Group Chat - Sidebar - Context Menu - Hide chat", async () => { // Open context menu on group chat and select Hide Chat - await chatsSidebar.openContextMenuOnGroupChat("X"); + await chatsSidebar.openContextMenuOnGroupChat("renamed"); await contextMenuSidebar.selectChatsHideChat(); - await chatsSidebar.validateSidebarChatIsNotDisplayed("X"); + await chatsSidebar.validateSidebarChatIsNotDisplayed("renamed"); }); it("Group Chat - Send another message to show again the group chat", async () => { @@ -112,17 +112,17 @@ export default async function groupChatSidebarTests() { it("Group Chat - Validate remote user received the message", async () => { // Switch control to User A and validate that message was received await activateFirstApplication(); - await chatsSidebar.waitForGroupToBeCreated("X"); - await chatsSidebar.goToSidebarGroupChat("X"); + await chatsSidebar.waitForGroupToBeCreated("renamed"); + await chatsSidebar.goToSidebarGroupChat("renamed"); await chatsTopbar.validateTopbarExists(); }); it("Group Chat - Sidebar - Leave group", async () => { // Switch control to User B and leave group chat await activateSecondApplication(); - await chatsSidebar.openContextMenuOnGroupChat("X"); + await chatsSidebar.openContextMenuOnGroupChat("renamed"); await contextMenuSidebar.selectChatsLeaveGroup(); - await chatsSidebar.validateSidebarChatIsNotDisplayed("X"); + await chatsSidebar.validateSidebarChatIsNotDisplayed("renamed"); }); it("Group Chat - Sidebar - If a user leaves a group, remote user will see the number of group members decreased", async () => { @@ -134,7 +134,7 @@ export default async function groupChatSidebarTests() { // Validate topbar contents has correct name const topbarUserName = await chatsTopbar.topbarUserNameValue; - await expect(topbarUserName).toHaveText("X"); + await expect(topbarUserName).toHaveText("renamed"); // Validate topbar contents has correct number of participants const topbarUserStatus = await chatsTopbar.topbarUserStatusValue; @@ -169,29 +169,29 @@ export default async function groupChatSidebarTests() { await filesScreen.validateFilesScreenIsShown(); await filesScreen.goToMainScreen(); await chatsSidebar.validateSidebarChatsIsShown(); - await chatsSidebar.waitForGroupToBeCreated("X"); - await chatsSidebar.goToSidebarGroupChat("X"); + await chatsSidebar.waitForGroupToBeCreated("renamed"); + await chatsSidebar.goToSidebarGroupChat("renamed"); await chatsTopbar.validateTopbarExists(); // Validate topbar contents has correct name const topbarUserName = await chatsTopbar.topbarUserNameValue; - await expect(topbarUserName).toHaveText("X"); + await expect(topbarUserName).toHaveText("renamed"); }); it("Group Chat - Sidebar - Delete group", async () => { // Switch execution to User A and delete the group await activateFirstApplication(); - await chatsSidebar.openContextMenuOnGroupChat("X"); + await chatsSidebar.openContextMenuOnGroupChat("renamed"); await contextMenuSidebar.selectChatsDeleteGroup(); // Ensure that group was removed on local side - await chatsSidebar.validateSidebarChatIsNotDisplayed("X"); + await chatsSidebar.validateSidebarChatIsNotDisplayed("renamed"); }); it("Group Chat - Sidebar - Deleted group is not shown on remote side", async () => { // Switch execution to remote user and ensure that group was removed on this side too await activateSecondApplication(); - await chatsSidebar.validateSidebarChatIsNotDisplayed("X"); + await chatsSidebar.validateSidebarChatIsNotDisplayed("renamed"); }); after(async () => { From a320e50bd69fa1ec1e0e2e65602d59dc97338da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Thu, 14 Mar 2024 00:09:23 -0600 Subject: [PATCH 3/3] test(update): add missing step on closing settings modal --- tests/specs/reusable-accounts/10-group-chats-edit.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/specs/reusable-accounts/10-group-chats-edit.spec.ts b/tests/specs/reusable-accounts/10-group-chats-edit.spec.ts index 5c8bedfdfb..bca0dad83d 100644 --- a/tests/specs/reusable-accounts/10-group-chats-edit.spec.ts +++ b/tests/specs/reusable-accounts/10-group-chats-edit.spec.ts @@ -202,6 +202,7 @@ export default async function groupChatEditTests() { await groupSettings.validateGroupSettingsIsShown(); await groupSettings.clickOnAllowMembersToAddOthersSwitch(); await groupSettings.clickOnAllowMembersToAddEditNameSwitch(); + await chatsTopbar.exitGroupSettings(); }); it("Group Chat Invited User - Manage Members is displayed after enabling allow to add users", async () => {