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
3 changes: 2 additions & 1 deletion appium/tests/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const CommonData = {
},
errors: {
noPublicKey: 'Could not compose message One or more of your recipients are missing a public key (marked in gray). ' +
'Please ask them to share it with you, or ask them to also set up FlowCrypt.'
'Please ask them to share it with you, or ask them to also set up FlowCrypt.',
wrongPassPhrase: 'Could not compose message This pass phrase did not match your signing private key'
}
};
7 changes: 7 additions & 0 deletions appium/tests/helpers/DataHelper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class DataHelper {
static uniqueValue() {
return Math.random().toString(36).substring(2);
}
}

export default DataHelper;
2 changes: 1 addition & 1 deletion appium/tests/screenobjects/email.screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class EmailScreen extends BaseScreen {
await ElementHelper.waitAndClick(await this.downloadAttachmentButton);
}

clickReplyButton = async () =>{
clickReplyButton = async () => {
await ElementHelper.waitAndClick(await this.replyButton);
}
}
Expand Down
11 changes: 10 additions & 1 deletion appium/tests/screenobjects/inbox.screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const SELECTORS = {
OK_BUTTON: '~Ok',
CONFIRM_PASS_PHRASE_FIELD: '~textField',
CREATE_EMAIL_BUTTON: '-ios class chain:**/XCUIElementTypeButton[`label == "+"`]',
INBOX_HEADER: '-ios class chain:**/XCUIElementTypeStaticText[`label == "INBOX"`]'
};

class InboxScreen extends BaseScreen {
Expand All @@ -17,19 +18,27 @@ class InboxScreen extends BaseScreen {
return $(SELECTORS.CREATE_EMAIL_BUTTON);
}

get inboxHeader() {
return $(SELECTORS.INBOX_HEADER)
}

clickOnUserEmail = async (email: string) => {
await (await this.createEmailButton).waitForDisplayed();
await $(`~${email}`).click();
}

clickOnEmailBySubject = async (subject: string) => {
await (await this.createEmailButton).waitForDisplayed();
await ElementHelper.waitAndClick(await $(`~${subject}`), 500);
}

clickCreateEmail = async () => {
await ElementHelper.waitAndClick(await this.createEmailButton);
}

checkInboxScreen = async () => {
await (await this.inboxHeader).waitForDisplayed();
await (await this.createEmailButton).waitForDisplayed();
}
}

export default new InboxScreen();
13 changes: 11 additions & 2 deletions appium/tests/screenobjects/menu-bar.screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const SELECTORS = {
MENU_ICON: '~menu icn',
LOGOUT_BTN: '~Log out',
SETTINGS_BTN: '~Settings',
INBOX_BTN: '~INBOX'
INBOX_BTN: '~INBOX',
SENT_BTN: '~SENT'
};

class MenuBarScreen extends BaseScreen {
Expand All @@ -30,8 +31,12 @@ class MenuBarScreen extends BaseScreen {
return $(SELECTORS.INBOX_BTN);
}

get sentButton() {
return $(SELECTORS.SENT_BTN);
}

clickMenuIcon = async () => {
await ElementHelper.waitAndClick(await this.menuIcon, 500);
await ElementHelper.waitAndClick(await this.menuIcon, 1000);
}

checkUserEmail = async (email: string = CommonData.account.email) => {
Expand All @@ -55,6 +60,10 @@ class MenuBarScreen extends BaseScreen {
clickInboxButton = async () => {
await ElementHelper.waitAndClick(await this.inboxButton);
}

clickSentButton = async () => {
await ElementHelper.waitAndClick(await this.sentButton);
}
}

export default new MenuBarScreen();
4 changes: 4 additions & 0 deletions appium/tests/screenobjects/new-message.screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ class NewMessageScreen extends BaseScreen {
await expect(await $(message)).toHaveAttribute('value', `${errorText}`);
await expect(await this.okButton).toBeDisplayed();
}

clickOkButtonOnError = async () => {
await ElementHelper.waitAndClick(await this.okButton)
}
}

export default new NewMessageScreen();
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import {
SplashScreen,
CreateKeyScreen,
InboxScreen,
NewMessageScreen,
EmailScreen,
MenuBarScreen
} 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 () => {

const contactEmail = CommonData.secondContact.email;
const emailSubject = CommonData.simpleEmail.subject + DataHelper.uniqueValue();
const emailText = CommonData.simpleEmail.message;
const passPhrase = CommonData.account.passPhrase;
const wrongPassPhraseError = CommonData.errors.wrongPassPhrase;
const wrongPassPhrase = "wrong";
const senderEmail = CommonData.account.email;

await SplashScreen.login();
await CreateKeyScreen.setPassPhrase();

await InboxScreen.clickCreateEmail();
await NewMessageScreen.composeEmail(contactEmail, emailSubject, emailText);
await NewMessageScreen.checkFilledComposeEmailInfo(contactEmail, emailSubject, emailText);
//Set wrong pass phrase and check error
await NewMessageScreen.clickSentButton();
await EmailScreen.enterPassPhrase(wrongPassPhrase);
await EmailScreen.clickOkButton();
await NewMessageScreen.checkError(wrongPassPhraseError);
await NewMessageScreen.clickOkButtonOnError();
//Set correct pass phrase
await NewMessageScreen.clickSentButton();
await EmailScreen.enterPassPhrase(passPhrase);
await EmailScreen.clickOkButton();
await InboxScreen.checkInboxScreen();

await MenuBarScreen.clickMenuIcon();
await MenuBarScreen.clickSentButton();
//Check sent email
await InboxScreen.clickOnEmailBySubject(emailSubject);
await EmailScreen.checkOpenedEmail(senderEmail, emailSubject, emailText);
});
});