diff --git a/FlowCryptUI/Nodes/ComposeButtonNode.swift b/FlowCryptUI/Nodes/ComposeButtonNode.swift index 3cdd29b95..2367342ec 100644 --- a/FlowCryptUI/Nodes/ComposeButtonNode.swift +++ b/FlowCryptUI/Nodes/ComposeButtonNode.swift @@ -15,7 +15,8 @@ public final class ComposeButtonNode: ASButtonNode { super.init() onTap = action backgroundColor = .main - setTitle("+", with: UIFont.boldSystemFont(ofSize: 30), with: .white, for: .normal) + accessibilityIdentifier = "aid-compose-message-button" + setTitle("+", with: .boldSystemFont(ofSize: 30), with: .white, for: .normal) addTarget(self, action: #selector(onButtonTap), forControlEvents: .touchUpInside) } diff --git a/appium/config/wdio.live.conf.js b/appium/config/wdio.live.conf.js index de9c1568d..23bb32a9e 100644 --- a/appium/config/wdio.live.conf.js +++ b/appium/config/wdio.live.conf.js @@ -29,6 +29,7 @@ config.capabilities = [ platformVersion: '15.0', automationName: 'XCUITest', app: join(process.cwd(), './FlowCrypt.app'), + simpleIsVisibleCheck: true, newCommandTimeout: 10000, wdaLaunchTimeout: 300000, wdaConnectionTimeout: 600000, diff --git a/appium/tests/helpers/ElementHelper.ts b/appium/tests/helpers/ElementHelper.ts index e4ee38984..9f8350ff2 100644 --- a/appium/tests/helpers/ElementHelper.ts +++ b/appium/tests/helpers/ElementHelper.ts @@ -50,7 +50,7 @@ class ElementHelper { } static waitAndClick = async (element: WebdriverIO.Element, delayMs = 50) => { - await element.waitForDisplayed(); + await this.waitElementVisible(element); // stability fix to make sure element is ready for interaction await browser.pause(delayMs); await element.click(); diff --git a/appium/tests/helpers/TouchHelper.ts b/appium/tests/helpers/TouchHelper.ts index 33ab74a58..f74522070 100644 --- a/appium/tests/helpers/TouchHelper.ts +++ b/appium/tests/helpers/TouchHelper.ts @@ -40,7 +40,7 @@ class TouchHelper { // this wait can be later replaced by waiting for loader to go away before scrolling await browser.pause(1000); // make sure contents are loaded first, so we don't scroll too early for(let i = 0; i < 15; i++) { - if (await (await element).isDisplayed()) { + if (await element.isDisplayed()) { return; } await driver.touchPerform([ diff --git a/appium/tests/screenobjects/mail-folder.screen.ts b/appium/tests/screenobjects/mail-folder.screen.ts index 60b9a6a99..0b55d448a 100644 --- a/appium/tests/screenobjects/mail-folder.screen.ts +++ b/appium/tests/screenobjects/mail-folder.screen.ts @@ -5,7 +5,7 @@ import ElementHelper from "../helpers/ElementHelper"; const SELECTORS = { TRASH_HEADER: '~navigationItemTrash', SENT_HEADER: '~navigationItemSent', - CREATE_EMAIL_BUTTON: '-ios class chain:**/XCUIElementTypeButton[`label == "+"`]', + CREATE_EMAIL_BUTTON: '~aid-compose-message-button', INBOX_HEADER: '~navigationItemInbox', SEARCH_ICON: '~search icn', HELP_ICON: '~help icn', @@ -74,12 +74,12 @@ class MailFolderScreen extends BaseScreen { } clickCreateEmail = async () => { - await browser.pause(2000); // todo: loading inbox. Fix this: wait until loader gone - if (await (await this.createEmailButton).isDisplayed() !== true) { - await TouchHelper.scrollDownToElement(await this.createEmailButton); - await (await this.createEmailButton).waitForDisplayed(); + const elem = await this.createEmailButton; + if ((await elem.isDisplayed()) !== true) { + await TouchHelper.scrollDownToElement(elem); + await elem.waitForDisplayed(); } - await ElementHelper.waitAndClick(await this.createEmailButton, 1000); // delay needed on M1 + await ElementHelper.waitAndClick(elem); } clickOnUserEmail = async (email: string) => {