From 89fdc666aa322ff784395ec5b92c7e8055f5fe35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Tue, 14 Nov 2023 11:26:41 -0600 Subject: [PATCH 1/6] test(update): unskipping attachment chats tests --- .../reusable-accounts/06-chat-topbar.spec.ts | 19 +++---------------- tests/suites/Chats/01-Chats.suite.ts | 2 +- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/tests/specs/reusable-accounts/06-chat-topbar.spec.ts b/tests/specs/reusable-accounts/06-chat-topbar.spec.ts index 390df1b0cb8..e67abc33014 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; @@ -99,11 +87,10 @@ export default async function chatTopbarTests() { await pinnedMessagesFirstUser.validateFirstPinnedMessageImageProfileIsShown(); await pinnedMessagesFirstUser.validateFirstPinnedMessageTimestampIsShown(); await pinnedMessagesFirstUser.validateFirstPinnedMessageSender("ChatUserB"); - await pinnedMessagesFirstUser.validateFirstPinnedMessageText("Temp..."); + 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 7f9a9095803..cd6a1916a34 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)); From 6cdcbce4c2f3b4abc146b8c9afef82562a1167e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Tue, 14 Nov 2023 16:48:58 -0600 Subject: [PATCH 2/6] screenobject(update): fix send files button validation --- tests/screenobjects/chats/SendFiles.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/screenobjects/chats/SendFiles.ts b/tests/screenobjects/chats/SendFiles.ts index 0fb3cd18059..93cabeebef2 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"]', @@ -212,8 +213,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 +233,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 +305,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() { From 5252610b56dd8d77d111ac0b74c01a24f9f23073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Wed, 15 Nov 2023 12:10:38 -0600 Subject: [PATCH 3/6] screenobject(update): update ui locators for compose attachment --- .../screenobjects/chats/ComposeAttachment.ts | 54 +++++++++++++++---- 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/tests/screenobjects/chats/ComposeAttachment.ts b/tests/screenobjects/chats/ComposeAttachment.ts index 871c200463c..0b295a6cb05 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,41 @@ 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]; const deleteAttachmentButton = await attachmentToDelete.$( - SELECTORS.COMPOSE_ATTACHMENTS_BUTTON + SELECTORS.COMPOSE_ATTACHMENTS_BUTTON, ); await deleteAttachmentButton.click(); } @@ -116,7 +150,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 +173,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); From 82551ac1f07dec128060b65e390c2a316762d084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Wed, 22 Nov 2023 12:39:24 -0600 Subject: [PATCH 4/6] test(update): updating attachment files --- tests/screenobjects/chats/InputBar.ts | 12 ++++++------ tests/screenobjects/chats/SendFiles.ts | 16 +++++++++++----- .../05-message-attachments.spec.ts | 8 +++----- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/tests/screenobjects/chats/InputBar.ts b/tests/screenobjects/chats/InputBar.ts index c3a423fd1f5..79cc50d79b3 100644 --- a/tests/screenobjects/chats/InputBar.ts +++ b/tests/screenobjects/chats/InputBar.ts @@ -190,12 +190,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/SendFiles.ts b/tests/screenobjects/chats/SendFiles.ts index 93cabeebef2..69175849b6c 100644 --- a/tests/screenobjects/chats/SendFiles.ts +++ b/tests/screenobjects/chats/SendFiles.ts @@ -173,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) { diff --git a/tests/specs/reusable-accounts/05-message-attachments.spec.ts b/tests/specs/reusable-accounts/05-message-attachments.spec.ts index 3eefcedfc13..d2ff199307b 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)"); }); From 3e4d2ab24fea29668a72d11ea42ed18a182aab87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Thu, 23 Nov 2023 13:10:57 -0600 Subject: [PATCH 5/6] test(update): updates for message attachment tests --- tests/screenobjects/chats/ComposeAttachment.ts | 1 + tests/specs/reusable-accounts/05-message-attachments.spec.ts | 2 +- tests/specs/reusable-accounts/06-chat-topbar.spec.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/screenobjects/chats/ComposeAttachment.ts b/tests/screenobjects/chats/ComposeAttachment.ts index 0b295a6cb05..2d4c78203f9 100644 --- a/tests/screenobjects/chats/ComposeAttachment.ts +++ b/tests/screenobjects/chats/ComposeAttachment.ts @@ -135,6 +135,7 @@ export default class ComposeAttachments extends UplinkMainScreen { const attachmentToDelete = await this.instance.$$( SELECTORS.COMPOSE_ATTACHMENTS_FILE_EMBED, )[attachment]; + await this.hoverOnElement(attachmentToDelete); const deleteAttachmentButton = await attachmentToDelete.$( SELECTORS.COMPOSE_ATTACHMENTS_BUTTON, ); diff --git a/tests/specs/reusable-accounts/05-message-attachments.spec.ts b/tests/specs/reusable-accounts/05-message-attachments.spec.ts index d2ff199307b..12b9d81a971 100644 --- a/tests/specs/reusable-accounts/05-message-attachments.spec.ts +++ b/tests/specs/reusable-accounts/05-message-attachments.spec.ts @@ -159,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 e67abc33014..75945c8ab88 100644 --- a/tests/specs/reusable-accounts/06-chat-topbar.spec.ts +++ b/tests/specs/reusable-accounts/06-chat-topbar.spec.ts @@ -70,7 +70,7 @@ 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(); From fd2e80aca6650ccaafc94df06780d3dd1b7f59e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Thu, 23 Nov 2023 17:13:55 -0600 Subject: [PATCH 6/6] test(update): fixing pinned message tests --- tests/screenobjects/chats/PinnedMessages.ts | 3 ++- tests/specs/reusable-accounts/06-chat-topbar.spec.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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/specs/reusable-accounts/06-chat-topbar.spec.ts b/tests/specs/reusable-accounts/06-chat-topbar.spec.ts index 75945c8ab88..78298990ae7 100644 --- a/tests/specs/reusable-accounts/06-chat-topbar.spec.ts +++ b/tests/specs/reusable-accounts/06-chat-topbar.spec.ts @@ -75,7 +75,7 @@ export default async function chatTopbarTests() { 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 () => { @@ -86,7 +86,7 @@ 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.validateFirstPinnedMessageSender("ChatUserA"); await pinnedMessagesFirstUser.validateFirstPinnedMessageText("Attached2"); });