diff --git a/appium/tests/data/index.ts b/appium/tests/data/index.ts index 6fa8ccc1e..29672a8bf 100644 --- a/appium/tests/data/index.ts +++ b/appium/tests/data/index.ts @@ -5,7 +5,11 @@ export const CommonData = { passPhrase: process.env.PASS_PHRASE }, sender: { - email: 'dmitry@flowcrypt.com' + email: process.env.SENDER_EMAIL, + }, + contact: { + email: 'dmitry@flowcrypt.com', + name: 'Dima' }, bundleId: { id: process.env.BUNDLE_ID diff --git a/appium/tests/screenobjects/new-message.screen.ts b/appium/tests/screenobjects/new-message.screen.ts index d413afcad..c4aa52d1f 100644 --- a/appium/tests/screenobjects/new-message.screen.ts +++ b/appium/tests/screenobjects/new-message.screen.ts @@ -48,15 +48,26 @@ class NewMessageScreen extends BaseScreen { return $(`-ios class chain:${selector}`); } - setComposeEmail(recipient, subject, message) { + composeEmail(recipient, subject, message) { this.setAddRecipient(recipient); this.setSubject(subject); this.setComposeSecurityMessage(message); } + setAddRecipientByName(name, email) { + this.addRecipientField.setValue(name); + const selector = `~${email}`; + $(selector).waitForDisplayed(); + $(selector).click(); + } + checkFilledComposeEmailInfo(recipient, subject, message) { expect(this.composeSecurityMesage).toHaveText(message); this.filledSubject(subject).waitForDisplayed(); + this.checkAddedRecipient(recipient); + } + + checkAddedRecipient(recipient) { expect(this.addedRecipientEmail).toHaveAttribute('value', ` ${recipient} `); } } diff --git a/appium/tests/specs/composeEmail/CheckComposeEmailAfterReopening.spec.ts b/appium/tests/specs/composeEmail/CheckComposeEmailAfterReopening.spec.ts index d6f0abd3c..cbdc5bd87 100644 --- a/appium/tests/specs/composeEmail/CheckComposeEmailAfterReopening.spec.ts +++ b/appium/tests/specs/composeEmail/CheckComposeEmailAfterReopening.spec.ts @@ -11,7 +11,7 @@ describe('COMPOSE EMAIL: ', () => { it('check filled compose email after reopening app', () => { - const senderEmail = CommonData.sender.email; + const recipientEmail = 'dmitry@flowcrypt.com'; const emailSubject = 'TestSubject'; const emailText = 'Test email'; @@ -19,11 +19,11 @@ describe('COMPOSE EMAIL: ', () => { CreateKeyScreen.setPassPhrase(); InboxScreen.clickCreateEmail(); - NewMessageScreen.setComposeEmail(senderEmail, emailSubject, emailText); - NewMessageScreen.checkFilledComposeEmailInfo(senderEmail, emailSubject, emailText); + NewMessageScreen.composeEmail(recipientEmail, emailSubject, emailText); + NewMessageScreen.checkFilledComposeEmailInfo(recipientEmail, emailSubject, emailText); driver.background(3); - NewMessageScreen.checkFilledComposeEmailInfo(senderEmail, emailSubject, emailText); + NewMessageScreen.checkFilledComposeEmailInfo(recipientEmail, emailSubject, emailText); }); }); diff --git a/appium/tests/specs/composeEmail/SelectRecipientByName.spec.ts b/appium/tests/specs/composeEmail/SelectRecipientByName.spec.ts new file mode 100644 index 000000000..194a0a1ed --- /dev/null +++ b/appium/tests/specs/composeEmail/SelectRecipientByName.spec.ts @@ -0,0 +1,25 @@ +import { + SplashScreen, + CreateKeyScreen, + InboxScreen, + NewMessageScreen +} from '../../screenobjects/all-screens'; + +import {CommonData} from '../../data'; + +describe('COMPOSE EMAIL: ', () => { + + it('user is able to select recipient from contact list using contact name', () => { + + const contactEmail = CommonData.contact.email; + const contactName = CommonData.contact.name; + + SplashScreen.login(); + CreateKeyScreen.setPassPhrase(); + + InboxScreen.clickCreateEmail(); + + NewMessageScreen.setAddRecipientByName(contactName, contactEmail); + NewMessageScreen.checkAddedRecipient(contactEmail); + }); +});