diff --git a/tests/screenobjects/chats/ComposeAttachment.ts b/tests/screenobjects/chats/ComposeAttachment.ts index 7063831a9df..c671bae4c29 100644 --- a/tests/screenobjects/chats/ComposeAttachment.ts +++ b/tests/screenobjects/chats/ComposeAttachment.ts @@ -16,6 +16,8 @@ const SELECTORS_WINDOWS = { COMPOSE_ATTACHMENTS_FILE_META: '[name="file-meta"]', COMPOSE_ATTACHMENTS_FILE_NAME: '[name="file-name"]', COMPOSE_ATTACHMENTS_FILE_NAME_TEXT: "", + COMPOSE_ATTACHMENTS_INPUT_ERROR: '[name="input-error"]', + COMPOSE_ATTACHMENTS_INPUT_ERROR_TEXT: "", }; const SELECTORS_MACOS = { @@ -28,6 +30,9 @@ const SELECTORS_MACOS = { COMPOSE_ATTACHMENTS_FILE_NAME: "~file-name", COMPOSE_ATTACHMENTS_FILE_NAME_TEXT: "-ios class chain:**/XCUIElementTypeStaticText", + COMPOSE_ATTACHMENTS_INPUT_ERROR: "~input-error", + COMPOSE_ATTACHMENTS_INPUT_ERROR_TEXT: + "-ios class chain:**/XCUIElementTypeStaticText", }; currentOS === WINDOWS_DRIVER @@ -44,58 +49,76 @@ export default class ComposeAttachments extends UplinkMainScreen { } get composeAttachmentsButton() { - return this.instance - .$(SELECTORS.COMPOSE_ATTACHMENTS) - .$(SELECTORS.COMPOSE_ATTACHMENTS_BUTTON); + return this.composeAttachments.$(SELECTORS.COMPOSE_ATTACHMENTS_BUTTON); } get composeAttachmentsFileEmbed() { - return this.instance - .$(SELECTORS.COMPOSE_ATTACHMENTS) - .$(SELECTORS.COMPOSE_ATTACHMENTS_FILE_EMBED); + return this.composeAttachments.$(SELECTORS.COMPOSE_ATTACHMENTS_FILE_EMBED); } get composeAttachmentsFileIcon() { - return this.instance - .$(SELECTORS.COMPOSE_ATTACHMENTS) - .$(SELECTORS.COMPOSE_ATTACHMENTS_FILE_EMBED) - .$(SELECTORS.COMPOSE_ATTACHMENTS_FILE_ICON); + return this.composeAttachmentsFileEmbed.$( + SELECTORS.COMPOSE_ATTACHMENTS_FILE_ICON + ); } get composeAttachmentsFileInfo() { - return this.instance - .$(SELECTORS.COMPOSE_ATTACHMENTS) - .$(SELECTORS.COMPOSE_ATTACHMENTS_FILE_EMBED) - .$(SELECTORS.COMPOSE_ATTACHMENTS_FILE_INFO); + return this.composeAttachmentsFileEmbed.$( + SELECTORS.COMPOSE_ATTACHMENTS_FILE_INFO + ); } get composeAttachmentsFileMeta() { - return this.instance - .$(SELECTORS.COMPOSE_ATTACHMENTS) - .$(SELECTORS.COMPOSE_ATTACHMENTS_FILE_EMBED) - .$(SELECTORS.COMPOSE_ATTACHMENTS_FILE_META); + return this.composeAttachmentsFileEmbed.$( + SELECTORS.COMPOSE_ATTACHMENTS_FILE_META + ); } get composeAttachmentsFileName() { - return this.instance - .$(SELECTORS.COMPOSE_ATTACHMENTS) - .$(SELECTORS.COMPOSE_ATTACHMENTS_FILE_EMBED) - .$(SELECTORS.COMPOSE_ATTACHMENTS_FILE_NAME); + return this.composeAttachmentsFileEmbed.$( + SELECTORS.COMPOSE_ATTACHMENTS_FILE_NAME + ); } get composeAttachmentsFileNameText() { - return this.instance - .$(SELECTORS.COMPOSE_ATTACHMENTS) - .$(SELECTORS.COMPOSE_ATTACHMENTS_FILE_EMBED) + return this.composeAttachmentsFileEmbed .$(SELECTORS.COMPOSE_ATTACHMENTS_FILE_NAME) .$(SELECTORS.COMPOSE_ATTACHMENTS_FILE_NAME_TEXT); } + get composeAttachmentsInputError() { + return this.composeAttachments.$(SELECTORS.COMPOSE_ATTACHMENTS_INPUT_ERROR); + } + + get composeAttachmentsInputErrorText() { + return this.composeAttachmentsInputError.$( + SELECTORS.COMPOSE_ATTACHMENTS_INPUT_ERROR_TEXT + ); + } + async deleteFileOnComposeAttachment() { const composeAttachmentsButton = await this.composeAttachmentsButton; await composeAttachmentsButton.click(); } + async getListOfAttachmentsEmbed() { + const composeAttachments = await this.composeAttachments; + await composeAttachments.waitForExist(); + const filesAttached = await this.instance.$$( + SELECTORS.COMPOSE_ATTACHMENTS_FILE_EMBED + ); + let results = []; + for (let fileAttached of filesAttached) { + const fileName = await fileAttached + .$(SELECTORS.COMPOSE_ATTACHMENTS_FILE_INFO) + .$(SELECTORS.COMPOSE_ATTACHMENTS_FILE_NAME) + .$(SELECTORS.COMPOSE_ATTACHMENTS_FILE_NAME_TEXT); + const fileNameText = await fileName.getText(); + results.push(fileNameText); + } + return results; + } + async validateAttachmentIsAdded() { const composeAttachmentsFileEmbed = await this.composeAttachmentsFileEmbed; await driver[this.executor].waitUntil( @@ -108,4 +131,18 @@ export default class ComposeAttachments extends UplinkMainScreen { } ); } + + async validateAttachmentWithFileNameIsAdded( + fileName: string, + expectedAssertion: boolean + ) { + const attachmentsList = await this.getListOfAttachmentsEmbed(); + const includesAttachment = await attachmentsList.includes(fileName); + await expect(includesAttachment).toEqual(expectedAssertion); + } + + async validateComposeAttachmentsIsShown() { + const composeAttachments = await this.composeAttachments; + await composeAttachments.waitForExist(); + } } diff --git a/tests/screenobjects/chats/InputBar.ts b/tests/screenobjects/chats/InputBar.ts index e4294fe66ec..e164aca4c0b 100644 --- a/tests/screenobjects/chats/InputBar.ts +++ b/tests/screenobjects/chats/InputBar.ts @@ -205,6 +205,11 @@ export default class InputBar extends UplinkMainScreen { await uploadButtonLocalDisk.click(); } + async selectUploadFromStorage() { + const uploadButtonStorage = await this.uploadButtonStorage; + await uploadButtonStorage.click(); + } + async typeCodeOnInputBar(language: string, codeToType: string) { const inputText = await this.inputText; await inputText.clearValue(); @@ -246,4 +251,9 @@ export default class InputBar extends UplinkMainScreen { await selectFileOnWindows(relativePath, uplinkContext, executor); } } + + async openUploadFilesFromStorage() { + await this.clickOnUploadFile(); + await this.selectUploadFromStorage(); + } } diff --git a/tests/screenobjects/chats/Messages.ts b/tests/screenobjects/chats/Messages.ts index cfd28c58081..991a0ca1a51 100644 --- a/tests/screenobjects/chats/Messages.ts +++ b/tests/screenobjects/chats/Messages.ts @@ -300,10 +300,10 @@ export default class Messages extends UplinkMainScreen { async getLastMessageReceivedCodeLanguage() { const message = await this.getLastMessageReceivedLocator(); - const messageCodeLanguage = await message - .$(SELECTORS.CHAT_MESSAGE_TEXT_GROUP) - .$(SELECTORS.CHAT_MESSAGE_CODE_LANGUAGE); - await messageCodeLanguage.waitForExist(); + const messageText = await message.$(SELECTORS.CHAT_MESSAGE_TEXT_GROUP); + const messageCodeLanguage = await messageText.$( + SELECTORS.CHAT_MESSAGE_CODE_LANGUAGE + ); return messageCodeLanguage; } @@ -592,9 +592,10 @@ export default class Messages extends UplinkMainScreen { async getLastMessageSentCodeLanguage() { const message = await this.getLastMessageSentLocator(); - const messageCodeLanguage = await message - .$(SELECTORS.CHAT_MESSAGE_TEXT_GROUP) - .$(SELECTORS.CHAT_MESSAGE_CODE_LANGUAGE); + const messageText = await message.$(SELECTORS.CHAT_MESSAGE_TEXT_GROUP); + const messageCodeLanguage = await messageText.$( + SELECTORS.CHAT_MESSAGE_CODE_LANGUAGE + ); await messageCodeLanguage.waitForExist(); return messageCodeLanguage; } @@ -799,7 +800,7 @@ export default class Messages extends UplinkMainScreen { const lastMessageLinkEmbed = await lastMessage.$( SELECTORS.CHAT_MESSAGE_LINK_EMBED ); - await lastMessageLinkEmbed.waitForExist(); + await lastMessageLinkEmbed.waitForExist({ timeout: 30000 }); return lastMessageLinkEmbed; } @@ -836,7 +837,7 @@ export default class Messages extends UplinkMainScreen { const lastMessageLinkEmbed = await lastMessage.$( SELECTORS.CHAT_MESSAGE_LINK_EMBED ); - await lastMessageLinkEmbed.waitForExist(); + await lastMessageLinkEmbed.waitForExist({ timeout: 30000 }); return lastMessageLinkEmbed; } diff --git a/tests/screenobjects/chats/SendFiles.ts b/tests/screenobjects/chats/SendFiles.ts index 74b5da6feb8..68ffe706a83 100644 --- a/tests/screenobjects/chats/SendFiles.ts +++ b/tests/screenobjects/chats/SendFiles.ts @@ -13,11 +13,14 @@ let SELECTORS = {}; const SELECTORS_COMMON = {}; const SELECTORS_WINDOWS = { + CLOSE_BUTTON: "