Skip to content

Commit

Permalink
issue #1074 send button appium improvements + aid (#1220)
Browse files Browse the repository at this point in the history
* #1074 fix compose button tap

* #1151 update package.json

* #1074 use scrollDownToElement

* #1074 update clickCreateEmail

* #1074 PR updates
  • Loading branch information
sosnovsky authored Dec 13, 2021
1 parent d55732d commit 3984cf6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion FlowCryptUI/Nodes/ComposeButtonNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
1 change: 1 addition & 0 deletions appium/config/wdio.live.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion appium/tests/helpers/ElementHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion appium/tests/helpers/TouchHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down
12 changes: 6 additions & 6 deletions appium/tests/screenobjects/mail-folder.screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit 3984cf6

Please sign in to comment.