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
20 changes: 20 additions & 0 deletions appium/tests/helpers/TouchHelper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

class TouchHelper {

/**
* scroll down
*/
static scrollDown = async() => {
await driver.execute('mobile: scroll', {direction: 'down'});
}

/**
* scroll up
*/
static scrollUp = async() => {
await driver.execute('mobile: scroll', {direction: 'up'});
}

}

export default TouchHelper;
6 changes: 5 additions & 1 deletion appium/tests/screenobjects/all-screens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import ContactScreen from './contacts.screen';
import ContactPublicKeyScreen from './contact-public-key.screen';
import PublicKeyScreen from './public-key.screen';
import AttachmentScreen from './attachment.screen';
import SentScreen from './sent.screen';
import TrashScreen from './trash.screen'

export {
SplashScreen,
Expand All @@ -23,5 +25,7 @@ export {
AttachmentScreen,
PublicKeyScreen,
ContactScreen,
ContactPublicKeyScreen
ContactPublicKeyScreen,
SentScreen,
TrashScreen
};
18 changes: 18 additions & 0 deletions appium/tests/screenobjects/email.screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const SELECTORS = {
SAVE_BUTTON: '~Save',
DOWNLOAD_ATTACHMENT_BUTTON: '~downloadButton',
REPLY_BUTTON: '~replyButton',
DELETE_BUTTON: '~Delete',
CONFIRM_DELETING: '~OK'
};


Expand Down Expand Up @@ -46,6 +48,14 @@ class EmailScreen extends BaseScreen {
return $(SELECTORS.REPLY_BUTTON);
}

get deleteButton() {
return $(SELECTORS.DELETE_BUTTON)
}

get confirmDeletingButton() {
return $(SELECTORS.CONFIRM_DELETING)
}

checkEmailAddress = async (email: string) => {
const selector = `~${email}`;
await (await $(selector)).waitForDisplayed();
Expand Down Expand Up @@ -106,6 +116,14 @@ class EmailScreen extends BaseScreen {
clickReplyButton = async () => {
await ElementHelper.waitAndClick(await this.replyButton);
}

clickDeleteButton = async () => {
await ElementHelper.waitAndClick(await this.deleteButton);
}

confirmDelete = async () => {
await ElementHelper.waitAndClick(await this.confirmDeletingButton)
}
}

export default new EmailScreen();
11 changes: 10 additions & 1 deletion appium/tests/screenobjects/menu-bar.screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const SELECTORS = {
LOGOUT_BTN: '~Log out',
SETTINGS_BTN: '~Settings',
INBOX_BTN: '~INBOX',
SENT_BTN: '~SENT'
SENT_BTN: '~SENT',
TRASH_BTN: '~TRASH'
};

class MenuBarScreen extends BaseScreen {
Expand Down Expand Up @@ -35,6 +36,10 @@ class MenuBarScreen extends BaseScreen {
return $(SELECTORS.SENT_BTN);
}

get trashButton() {
return $(SELECTORS.TRASH_BTN)
}

clickMenuIcon = async () => {
await ElementHelper.waitAndClick(await this.menuIcon, 1000);
}
Expand Down Expand Up @@ -64,6 +69,10 @@ class MenuBarScreen extends BaseScreen {
clickSentButton = async () => {
await ElementHelper.waitAndClick(await this.sentButton);
}

clickTrashButton = async () => {
await ElementHelper.waitAndClick(await this.trashButton);
}
}

export default new MenuBarScreen();
43 changes: 43 additions & 0 deletions appium/tests/screenobjects/sent.screen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import BaseScreen from './base.screen';
import TouchHelper from "../helpers/TouchHelper";

const SELECTORS = {
SENT_HEADER: '-ios class chain:**/XCUIElementTypeNavigationBar[`name == "SENT"`]',
SEARCH_ICON: '~search icn',
HELP_ICON: '~help icn'
};


class SentScreen extends BaseScreen {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inbox, sent, trash, and other such screens are all the same - they are all just a folder screen. So it should probably really just be one screen. A MailFolderScreen or maybe just InboxScreen or if you want to extend from something and still have them all separate, then BaseFolderScreen. What do you think?

constructor() {
super(SELECTORS.SEARCH_ICON);
}

get searchIcon() {
return $(SELECTORS.SEARCH_ICON);
}

get helpIcon() {
return $(SELECTORS.HELP_ICON);
}

get sentHeader() {
return $(SELECTORS.SENT_HEADER)
}

checkSentScreen = async () => {
await expect(await this.sentHeader).toBeDisplayed();
await expect(await this.searchIcon).toBeDisplayed();
await expect(await this.helpIcon).toBeDisplayed()
}

checkEmailIsNotDisplayed = async (subject: string) => {
await (await $(`~${subject}`)).waitForDisplayed({reverse: true});
}

refreshSentList = async () => {
await TouchHelper.scrollUp();
}
}

export default new SentScreen();
42 changes: 42 additions & 0 deletions appium/tests/screenobjects/trash.screen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import BaseScreen from './base.screen';
import TouchHelper from "../helpers/TouchHelper";

const SELECTORS = {
TRASH_HEADER: '-ios class chain:**/XCUIElementTypeNavigationBar[`name == "TRASH"`]',
SEARCH_ICON: '~search icn',
HELP_ICON: '~help icn'
};

class TrashScreen extends BaseScreen {
constructor() {
super(SELECTORS.SEARCH_ICON);
}

get searchIcon() {
return $(SELECTORS.SEARCH_ICON);
}

get helpIcon() {
return $(SELECTORS.HELP_ICON);
}

get trashHeader() {
return $(SELECTORS.TRASH_HEADER)
}

checkTrashScreen = async () => {
await expect(await this.trashHeader).toBeDisplayed();
await expect(await this.searchIcon).toBeDisplayed();
await expect(await this.helpIcon).toBeDisplayed()
}

checkEmailIsNotDisplayed = async (subject: string) => {
await (await $(`~${subject}`)).waitForDisplayed({reverse: true});
}

refreshTrashList = async () => {
await TouchHelper.scrollUp();
}
}

export default new TrashScreen();
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ import {
InboxScreen,
NewMessageScreen,
EmailScreen,
MenuBarScreen
MenuBarScreen,
SentScreen,
TrashScreen
} from '../../screenobjects/all-screens';

import { CommonData } from '../../data';
import DataHelper from "../../helpers/DataHelper";

describe('COMPOSE EMAIL: ', () => {

it('user is able to send encrypted email after resetting pass phrase', async () => {
it('user is able to send encrypted email after resetting pass phrase + move to trash, delete', async () => {

const contactEmail = CommonData.secondContact.email;
const emailSubject = CommonData.simpleEmail.subject + DataHelper.uniqueValue();
Expand Down Expand Up @@ -42,8 +44,29 @@ describe('COMPOSE EMAIL: ', () => {

await MenuBarScreen.clickMenuIcon();
await MenuBarScreen.clickSentButton();
await SentScreen.checkSentScreen();

//Check sent email
await InboxScreen.clickOnEmailBySubject(emailSubject);
await EmailScreen.checkOpenedEmail(senderEmail, emailSubject, emailText);
//Delete sent email
await EmailScreen.clickDeleteButton();
await SentScreen.checkSentScreen();
await SentScreen.checkEmailIsNotDisplayed(emailSubject);
await SentScreen.refreshSentList();
await SentScreen.checkSentScreen();
await SentScreen.checkEmailIsNotDisplayed(emailSubject);
//Check email in Trash list
await MenuBarScreen.clickMenuIcon();
await MenuBarScreen.clickTrashButton();
await TrashScreen.checkTrashScreen();
await InboxScreen.clickOnEmailBySubject(emailSubject);
//Remove from Trash
await EmailScreen.clickDeleteButton();
await EmailScreen.confirmDelete();
await TrashScreen.checkTrashScreen();
await TrashScreen.refreshTrashList();
await TrashScreen.checkTrashScreen();
await TrashScreen.checkEmailIsNotDisplayed(emailSubject);
});
});