diff --git a/tests/screenobjects/chats/ComposeAttachment.ts b/tests/screenobjects/chats/ComposeAttachment.ts index 871c200463c..2d4c78203f9 100644 --- a/tests/screenobjects/chats/ComposeAttachment.ts +++ b/tests/screenobjects/chats/ComposeAttachment.ts @@ -12,12 +12,17 @@ const SELECTORS_WINDOWS = { COMPOSE_ATTACHMENTS_BUTTON: '[name="attachment-button"]', COMPOSE_ATTACHMENTS_FILE_EMBED: '[name="file-embed"]', COMPOSE_ATTACHMENTS_FILE_ICON: '[name="file-icon"]', + COMPOSE_ATTACHMENTS_FILE_ICON_VALUE: "//Group/Text", COMPOSE_ATTACHMENTS_FILE_INFO: '[name="file-info"]', COMPOSE_ATTACHMENTS_FILE_META: '[name="file-meta"]', COMPOSE_ATTACHMENTS_FILE_NAME: '[name="file-name"]', COMPOSE_ATTACHMENTS_FILE_NAME_TEXT: "", + COMPOSE_ATTACHMENTS_IMAGE_PREVIEW_MODAL: '[name="image-preview-modal"]', COMPOSE_ATTACHMENTS_INPUT_ERROR: '[name="input-error"]', COMPOSE_ATTACHMENTS_INPUT_ERROR_TEXT: "", + COMPOSE_ATTACHMENTS_MESSAGE_IMAGE: '[name="message-image"]', + COMPOSE_ATTACHMENTS_MESSAGE_IMAGE_CONTAINER: + '[name="message-image-container"]', }; const SELECTORS_MACOS = { @@ -25,14 +30,19 @@ const SELECTORS_MACOS = { COMPOSE_ATTACHMENTS_BUTTON: "~attachment-button", COMPOSE_ATTACHMENTS_FILE_EMBED: "~file-embed", COMPOSE_ATTACHMENTS_FILE_ICON: "~file-icon", + COMPOSE_ATTACHMENTS_FILE_ICON_VALUE: + "-ios class chain:**/XCUIElementTypeGroup/XCUIElementTypeStaticText/XCUIElementTypeStaticText", COMPOSE_ATTACHMENTS_FILE_INFO: "~file-info", COMPOSE_ATTACHMENTS_FILE_META: "~file-meta", COMPOSE_ATTACHMENTS_FILE_NAME: "~file-name", COMPOSE_ATTACHMENTS_FILE_NAME_TEXT: "-ios class chain:**/XCUIElementTypeStaticText", + COMPOSE_ATTACHMENTS_IMAGE_PREVIEW_MODAL: "~image-preview-modal", COMPOSE_ATTACHMENTS_INPUT_ERROR: "~input-error", COMPOSE_ATTACHMENTS_INPUT_ERROR_TEXT: "-ios class chain:**/XCUIElementTypeStaticText", + COMPOSE_ATTACHMENTS_MESSAGE_IMAGE: "~message-image", + COMPOSE_ATTACHMENTS_MESSAGE_IMAGE_CONTAINER: "~message-image-container", }; currentOS === WINDOWS_DRIVER @@ -58,25 +68,31 @@ export default class ComposeAttachments extends UplinkMainScreen { get composeAttachmentsFileIcon() { return this.composeAttachmentsFileEmbed.$( - SELECTORS.COMPOSE_ATTACHMENTS_FILE_ICON + SELECTORS.COMPOSE_ATTACHMENTS_FILE_ICON, + ); + } + + get composeAttachmentsFileIconValue() { + return this.composeAttachmentsFileIcon.$( + SELECTORS.COMPOSE_ATTACHMENTS_FILE_ICON_VALUE, ); } get composeAttachmentsFileInfo() { return this.composeAttachmentsFileEmbed.$( - SELECTORS.COMPOSE_ATTACHMENTS_FILE_INFO + SELECTORS.COMPOSE_ATTACHMENTS_FILE_INFO, ); } get composeAttachmentsFileMeta() { return this.composeAttachmentsFileEmbed.$( - SELECTORS.COMPOSE_ATTACHMENTS_FILE_META + SELECTORS.COMPOSE_ATTACHMENTS_FILE_META, ); } get composeAttachmentsFileName() { return this.composeAttachmentsFileEmbed.$( - SELECTORS.COMPOSE_ATTACHMENTS_FILE_NAME + SELECTORS.COMPOSE_ATTACHMENTS_FILE_NAME, ); } @@ -86,23 +102,42 @@ export default class ComposeAttachments extends UplinkMainScreen { .$(SELECTORS.COMPOSE_ATTACHMENTS_FILE_NAME_TEXT); } + get composeAttachmentsImagePreviewModal() { + return this.composeAttachmentsFileEmbed.$( + SELECTORS.COMPOSE_ATTACHMENTS_IMAGE_PREVIEW_MODAL, + ); + } + get composeAttachmentsInputError() { return this.composeAttachments.$(SELECTORS.COMPOSE_ATTACHMENTS_INPUT_ERROR); } get composeAttachmentsInputErrorText() { return this.composeAttachmentsInputError.$( - SELECTORS.COMPOSE_ATTACHMENTS_INPUT_ERROR_TEXT + SELECTORS.COMPOSE_ATTACHMENTS_INPUT_ERROR_TEXT, + ); + } + + get composeAttachmentsMessageImage() { + return this.composeAttachmentsMessageImageContainer.$( + SELECTORS.COMPOSE_ATTACHMENTS_MESSAGE_IMAGE, + ); + } + + get composeAttachmentsMessageImageContainer() { + return this.composeAttachmentsFileEmbed.$( + SELECTORS.COMPOSE_ATTACHMENTS_MESSAGE_IMAGE_CONTAINER, ); } async clickOnDeleteAttachment(attachment: number) { // Get the locator of attachment to delete by passing the index const attachmentToDelete = await this.instance.$$( - SELECTORS.COMPOSE_ATTACHMENTS_FILE_EMBED + SELECTORS.COMPOSE_ATTACHMENTS_FILE_EMBED, )[attachment]; + await this.hoverOnElement(attachmentToDelete); const deleteAttachmentButton = await attachmentToDelete.$( - SELECTORS.COMPOSE_ATTACHMENTS_BUTTON + SELECTORS.COMPOSE_ATTACHMENTS_BUTTON, ); await deleteAttachmentButton.click(); } @@ -116,7 +151,7 @@ export default class ComposeAttachments extends UplinkMainScreen { const composeAttachments = await this.composeAttachments; await composeAttachments.waitForExist(); const filesAttached = await this.instance.$$( - SELECTORS.COMPOSE_ATTACHMENTS_FILE_EMBED + SELECTORS.COMPOSE_ATTACHMENTS_FILE_EMBED, ); let results = []; for (let fileAttached of filesAttached) { @@ -139,13 +174,13 @@ export default class ComposeAttachments extends UplinkMainScreen { { timeout: 15000, timeoutMsg: "Attachment file was not added after 15 seconds", - } + }, ); } async validateAttachmentWithFileNameIsAdded( fileName: string, - expectedAssertion: boolean + expectedAssertion: boolean, ) { const attachmentsList = await this.getListOfAttachmentsEmbed(); const includesAttachment = await attachmentsList.includes(fileName); diff --git a/tests/screenobjects/chats/InputBar.ts b/tests/screenobjects/chats/InputBar.ts index 81a89ab9670..b7f1fc81968 100644 --- a/tests/screenobjects/chats/InputBar.ts +++ b/tests/screenobjects/chats/InputBar.ts @@ -196,12 +196,12 @@ export default class InputBar extends UplinkMainScreen { async pressEnterKeyOnInputBar() { const currentDriver = await this.getCurrentDriver(); - let enterValue; - currentDriver === WINDOWS_DRIVER - ? (enterValue = "\uE007") - : (enterValue = "\n"); - const inputText = await this.inputText; - await inputText.addValue(enterValue); + if (currentDriver === WINDOWS_DRIVER) { + const inputText = await this.inputText; + await inputText.addValue("\uE007"); + } else { + await this.clickOnSendMessage(); + } } async selectUploadFromLocalDisk() { diff --git a/tests/screenobjects/chats/PinnedMessages.ts b/tests/screenobjects/chats/PinnedMessages.ts index cc33a617088..32161506dcd 100644 --- a/tests/screenobjects/chats/PinnedMessages.ts +++ b/tests/screenobjects/chats/PinnedMessages.ts @@ -46,7 +46,8 @@ const SELECTORS_MACOS = { "-ios class chain:**/XCUIElementTypeStaticText/XCUIElementTypeStaticText", PINNED_MESSAGE_ATTACHMENTS_FILE_INFO: "~file-info", PINNED_MESSAGE_ATTACHMENTS_FILE_META: "~file-meta", - PINNED_MESSAGE_ATTACHMENTS_FILE_META_TEXT: "", + PINNED_MESSAGE_ATTACHMENTS_FILE_META_TEXT: + "-ios class chain:**/XCUIElementTypeStaticText", PINNED_MESSAGE_ATTACHMENTS_FILE_NAME: "~file-name", PINNED_MESSAGE_ATTACHMENTS_FILE_NAME_TEXT: "-ios class chain:**/XCUIElementTypeStaticText", diff --git a/tests/screenobjects/chats/SendFiles.ts b/tests/screenobjects/chats/SendFiles.ts index 0fb3cd18059..69175849b6c 100644 --- a/tests/screenobjects/chats/SendFiles.ts +++ b/tests/screenobjects/chats/SendFiles.ts @@ -54,7 +54,8 @@ const SELECTORS_MACOS = { FILES_LIST: "~files-list", GO_TO_FILES_BUTTON: "~go_to_files_btn", HOME_DIR: "~home-dir", - HOME_DIR_TEXT: "~Home", + HOME_DIR_TEXT: + '-ios class chain:**/XCUIElementTypeStaticText[`value == "Home"`]', INPUT_ERROR: "~input-error", INPUT_ERROR_TEXT: "-ios class chain:**/XCUIElementTypeStaticText", INPUT_FILE_NAME: '[name="file-name-input"]', @@ -172,12 +173,18 @@ export default class SendFiles extends UplinkMainScreen { await closeButton.click(); } - async clickOnFileOrFolder(locator: string) { - const fileOrFolderLocator = await this.getLocatorOfFolderFile(locator); - const fileOrFolderElement = await this.instance - .$(fileOrFolderLocator) + async clickOnFile(locator: string) { + const fileLocator = await this.getLocatorOfFolderFile(locator); + const fileElement = await this.instance + .$(fileLocator) .$(SELECTORS.FILE_THUMBNAIL); - await fileOrFolderElement.click(); + await fileElement.click(); + } + + async clickOnFolder(locator: string) { + const folderLocator = await this.getLocatorOfFolderFile(locator); + const folderElement = await this.instance.$(folderLocator); + await folderElement.click(); } async clickOnFolderCrumb(folderName: string) { @@ -212,8 +219,6 @@ export default class SendFiles extends UplinkMainScreen { let result; if (currentDriver === WINDOWS_DRIVER) { result = await sendFilesModalSendButton.getAttribute("HelpText"); - } else { - result = await sendFilesModalSendButton.getAttribute("placeholderValue"); } return result.toString(); } @@ -234,7 +239,7 @@ export default class SendFiles extends UplinkMainScreen { const folders = await this.filesCrumb; const treeLength = folders.length - 1; const currentFolderName = await folders[treeLength].$( - SELECTORS.FILES_CRUMB_TEXT + SELECTORS.FILES_CRUMB_TEXT, ); const currentFolderNameText = await currentFolderName.getText(); return currentFolderNameText; @@ -306,9 +311,12 @@ export default class SendFiles extends UplinkMainScreen { } async validateSendFilesButtonText(expectedText: string) { - await this.getValueFromSendFilesButton().then((value) => { - expect(value).toEqual(expectedText); - }); + const currentDriver = await this.getCurrentDriver(); + if (currentDriver === WINDOWS_DRIVER) { + await this.getValueFromSendFilesButton().then((value) => { + expect(value).toEqual(expectedText); + }); + } } async validateSendFilesModalIsShown() { diff --git a/tests/specs/reusable-accounts/05-message-attachments.spec.ts b/tests/specs/reusable-accounts/05-message-attachments.spec.ts index 3eefcedfc13..12b9d81a971 100644 --- a/tests/specs/reusable-accounts/05-message-attachments.spec.ts +++ b/tests/specs/reusable-accounts/05-message-attachments.spec.ts @@ -59,12 +59,10 @@ export default async function messageAttachmentsTests() { await sendFilesFirstUser.validateThumbnailIsShown("banner.jpg"); }); - // Skipping test because it takes too much time for execution - xit("Send files from Browse Files - User can navigate through folders and to home", async () => { + it("Send files from Browse Files - User can navigate through folders and to home", async () => { // Navigate to testfolder01 and ensure thumbnail from testfile.txt is shown - await sendFilesFirstUser.clickOnFileOrFolder("testfolder01"); + await sendFilesFirstUser.clickOnFolder("testfolder01"); await filesScreenFirstUser.validateFileOrFolderExist("testfile.txt"); - await sendFilesFirstUser.validateThumbnailIsShown("testfile.txt"); // Navigate to home folder and ensure thumbnail from banner.jpg is shown await sendFilesFirstUser.clickOnHomeFolderCrumb(); @@ -98,7 +96,7 @@ export default async function messageAttachmentsTests() { it("Send files from Browse Files - Send files counter is updated", async () => { // Select one file from root folder and ensure Send Files button displays 1/8 File(s) - await sendFilesFirstUser.clickOnFileOrFolder("banner.jpg"); + await sendFilesFirstUser.clickOnFile("banner.jpg"); await sendFilesFirstUser.validateSendFilesButtonText("Send 1/8 File(s)"); }); @@ -161,7 +159,7 @@ export default async function messageAttachmentsTests() { it("Send Files on Chats - Delete attachment before sending the message", async () => { // Click on upload button and attach a file to compose attachment - await chatsAttachmentFirstUser.deleteFileOnComposeAttachment(); + await chatsAttachmentFirstUser.clickOnDeleteAttachment(0); }); it("Send File from Add Files - Select a file and send message with attachment", async () => { diff --git a/tests/specs/reusable-accounts/06-chat-topbar.spec.ts b/tests/specs/reusable-accounts/06-chat-topbar.spec.ts index 390df1b0cb8..78298990ae7 100644 --- a/tests/specs/reusable-accounts/06-chat-topbar.spec.ts +++ b/tests/specs/reusable-accounts/06-chat-topbar.spec.ts @@ -15,21 +15,9 @@ let chatsTopbarFirstUser = new Topbar(USER_A_INSTANCE); let pinnedMessagesFirstUser = new PinnedMessages(USER_A_INSTANCE); export default async function chatTopbarTests() { - it("Chat User B - Send a message to Chat User A", async () => { - // Send a message to Chat User A - await chatsInputFirstUser.typeMessageOnInput("Temp..."); - await chatsInputFirstUser.clickOnSendMessage(); - await chatsMessagesFirstUser.waitForMessageSentToExist("Temp..."); - }); - - it("Chat User A - Receive message from Chat User B", async () => { - // Assert message received from Chat User A - await activateFirstApplication(); - await chatsMessagesFirstUser.waitForReceivingMessage("Temp..."); - }); - it("Chat User A - Validate Chat Screen tooltips are displayed", async () => { // Validate Favorites button tooltip + await activateFirstApplication(); await chatsTopbarFirstUser.hoverOnFavoritesButton(); const favoritesAddTooltipText = await chatsTopbarFirstUser.topbarAddToFavoritesTooltipText; @@ -82,12 +70,12 @@ export default async function chatTopbarTests() { it("Pinned Messages - Pin a message with attachments", async () => { // Look for the latest message received by User A, open context menu and pin message - await chatsMessagesFirstUser.openContextMenuOnLastReceived(); + await chatsMessagesFirstUser.openContextMenuOnLastSent(); await chatsContextMenuFirstUser.validateContextMenuIsOpen(); await chatsContextMenuFirstUser.selectContextOptionPin(); // Ensure that message shows a pin indicator - await chatsMessageGroupsFirstUser.validateLastMessageReceivedHasPinIndicator(); + await chatsMessageGroupsFirstUser.validateLastMessageSentHasPinIndicator(); }); it("Pinned Messages - Pinned message shows timestamp, sender and message", async () => { @@ -98,12 +86,11 @@ export default async function chatTopbarTests() { // Validate pinned message shows timestamp, sender and message await pinnedMessagesFirstUser.validateFirstPinnedMessageImageProfileIsShown(); await pinnedMessagesFirstUser.validateFirstPinnedMessageTimestampIsShown(); - await pinnedMessagesFirstUser.validateFirstPinnedMessageSender("ChatUserB"); - await pinnedMessagesFirstUser.validateFirstPinnedMessageText("Temp..."); + await pinnedMessagesFirstUser.validateFirstPinnedMessageSender("ChatUserA"); + await pinnedMessagesFirstUser.validateFirstPinnedMessageText("Attached2"); }); - // Skipping due to issue with Upload files button - xit("Pinned Messages - Pinned message with attachment shows icon, extension, filename and metadata", async () => { + it("Pinned Messages - Pinned message with attachment shows icon, extension, filename and metadata", async () => { // Validate attachment elements are shown in pinned message await pinnedMessagesFirstUser.validateFirstPinnedMessageAttachmentFileIcon(); await pinnedMessagesFirstUser.validateFirstPinnedMessageAttachmentFileIconExtension( diff --git a/tests/suites/Chats/01-Chats.suite.ts b/tests/suites/Chats/01-Chats.suite.ts index e6ee48a4ce7..aeeb2bb46dd 100644 --- a/tests/suites/Chats/01-Chats.suite.ts +++ b/tests/suites/Chats/01-Chats.suite.ts @@ -19,7 +19,7 @@ describe("MacOS Chats Tests", function () { describe("Chat Replies Tests", repliesTests.bind(this)); describe("Message Context Menu Tests", messageContextMenuTests.bind(this)); describe("Message Input Tests", messageInputTests.bind(this)); - xdescribe("Message Attachments Tests", messageAttachmentsTests.bind(this)); + describe("Message Attachments Tests", messageAttachmentsTests.bind(this)); describe("Chat Topbar Tests", chatTopbarTests.bind(this)); describe("Quick Profile Tests", quickProfileTests.bind(this)); describe("Sidebar Chats Tests", sidebarChatsTests.bind(this));