Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion appium/tests/helpers/ElementHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ElementHelper {
* returns true or false for element visibility
*/
static elementDisplayed = async (element: WebdriverIO.Element): Promise<boolean> => {
return await element.isExisting();
return await element.isDisplayed();
}

static waitElementVisible = async (element: WebdriverIO.Element, timeout: number = DEFAULT_TIMEOUT) => {
Expand Down
22 changes: 22 additions & 0 deletions appium/tests/helpers/TouchHelper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@


class TouchHelper {

/**
Expand Down Expand Up @@ -29,6 +30,27 @@ class TouchHelper {
{action: 'release', options: {}},
]);
}

static scrollDownToElement = async (element: WebdriverIO.Element) => {
const { width, height } = await driver.getWindowSize();
const anchor = width / 2;
const startPoint = height * 0.25;
const endPoint = height * 0.15;
let index = 0;

do {
await browser.pause(1000); // due to scroll action which takes about second
await driver.touchPerform([
{action: 'press', options: {x: anchor, y: startPoint}},
{action: 'wait', options: {ms: 100}},
{action: 'moveTo', options: {x: anchor, y: endPoint}},
{action: 'release', options: {}},
]);
} while (await (await element).isDisplayed() !== true && index++ < 14);

if(index === 15) throw new Error(`Element ${JSON.stringify(element.selector)} doesn't displayed after scroll`);
}

}

export default TouchHelper;
13 changes: 6 additions & 7 deletions appium/tests/screenobjects/mail-folder.screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,18 @@ class MailFolderScreen extends BaseScreen {
}

clickOnEmailBySubject = async (subject: string) => {
await expect(await this.helpIcon).toBeDisplayed();
const selector = `~${subject}`;
if (await (await $(selector)).isDisplayed() !== true) {
await TouchHelper.scrollDown();
await TouchHelper.scrollDownToElement(await $(selector));
}
await ElementHelper.waitAndClick(await $(selector), 500);
}

clickCreateEmail = async () => {
await browser.pause(2000); // todo: loading inbox. Fix this: wait until loader gone
if (await (await this.createEmailButton).isDisplayed() !== true) {
await TouchHelper.scrollDown();
await TouchHelper.scrollDownToElement(await this.createEmailButton);
await (await this.createEmailButton).waitForDisplayed();
}
await ElementHelper.waitAndClick(await this.createEmailButton, 1000); // delay needed on M1
Expand All @@ -83,11 +84,9 @@ class MailFolderScreen extends BaseScreen {
}

checkInboxScreen = async () => {
await (await this.inboxHeader).waitForDisplayed();
if (await (await this.createEmailButton).isDisplayed() !== true) {
await TouchHelper.scrollDown();
await (await this.createEmailButton).waitForDisplayed();
}
await expect(await this.inboxHeader).toBeDisplayed();
await expect(await this.searchIcon).toBeDisplayed();
await expect(await this.helpIcon).toBeDisplayed()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ describe('COMPOSE EMAIL: ', () => {
await driver.terminateApp(bundleId);
await driver.activateApp(bundleId);

await MailFolderScreen.checkInboxScreen();
await MailFolderScreen.clickCreateEmail();
await NewMessageScreen.composeEmail(contactEmail, emailSubject, emailText);
await NewMessageScreen.checkFilledComposeEmailInfo(contactEmail, emailSubject, emailText);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('INBOX: ', () => {
await driver.terminateApp(bundleId);
await driver.activateApp(bundleId);

await MailFolderScreen.checkInboxScreen();
await MailFolderScreen.clickOnEmailBySubject(emailSubject);

//try to see encrypted message with wrong pass phrase
Expand Down
1 change: 1 addition & 0 deletions appium/tests/specs/inbox/ReadAttachmentEmail.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('INBOX: ', () => {
await driver.terminateApp(bundleId);
await driver.activateApp(bundleId);

await MailFolderScreen.checkInboxScreen();
await MailFolderScreen.clickOnEmailBySubject(emailSubject);

//try to see encrypted message with wrong pass phrase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe('INBOX: ', () => {
await driver.terminateApp(CommonData.bundleId.id);
await driver.activateApp(CommonData.bundleId.id);

await MailFolderScreen.checkInboxScreen();
await MailFolderScreen.clickOnEmailBySubject(emailSubject);
await EmailScreen.checkOpenedEmail(senderEmail, emailSubject, emailText);
});
Expand Down
2 changes: 1 addition & 1 deletion appium/tests/specs/inbox/ReadKeyMismatchEmail.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('INBOX: ', () => {

await SplashScreen.login();
await SetupKeyScreen.setPassPhrase();
await MailFolderScreen.checkInboxScreen()
await MailFolderScreen.checkInboxScreen();

await MailFolderScreen.clickOnEmailBySubject(emailSubject);
await EmailScreen.checkOpenedEmail(senderEmail, emailSubject, emailText);
Expand Down