Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(add): allow invited users to edit group name and users #659

Merged
merged 3 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/screenobjects/chats/GroupSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,9 @@ export default class GroupSettings extends UplinkMainScreen {
await clickOnSwitchMacOS(allowMembersToAddOthersSwitch);
}
}

async validateGroupSettingsIsShown() {
const groupSettingsModal = await this.groupSettingsModal;
await groupSettingsModal.waitForExist();
}
}
25 changes: 25 additions & 0 deletions tests/screenobjects/chats/Topbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -427,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() {
Expand Down
57 changes: 57 additions & 0 deletions tests/specs/reusable-accounts/10-group-chats-edit.spec.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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();
Expand Down Expand Up @@ -188,6 +190,61 @@ 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();
await chatsTopbar.openGroupSettings();
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 () => {
// 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();
Expand Down
36 changes: 18 additions & 18 deletions tests/specs/reusable-accounts/11-group-chats-sidebar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 () => {
Expand All @@ -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");
Expand All @@ -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");
Expand All @@ -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 () => {
Expand All @@ -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 () => {
Expand All @@ -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;
Expand Down Expand Up @@ -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 () => {
Expand Down
Loading