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
8 changes: 6 additions & 2 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,19 @@ blocks:
- cache restore && make dependencies && cache store
- mv ~/appium-env ~/git/flowcrypt-ios/appium/.env
- sem-version node 12 && cache restore appium-npm && cd ./appium && npm i && cd .. && cache store appium-npm appium/node_modules
- brew install ideviceinstaller
- npm install ios-deploy -g --unsafe-perm=true --allow-root
- npm install ios-sim -g --unsafe-perm=true --allow-root
jobs:
- name: Appium UI tests
commands:
- ios-sim start --devicetypeid com.apple.CoreSimulator.SimDeviceType.iPhone-13
- bundle exec fastlane build && ls -la appium
- cd appium && npm run-script only.test.all
epilogue:
on_fail:
always:
commands:
- artifact push job ~/git/flowcrypt-ios/appium/tmp
- artifact push job ~/git/flowcrypt-ios/appium/FlowCrypt.app
- name: TypeScript + Swift tests
dependencies: []
run: # don't run if the only thing that changed is Appium test deps
Expand All @@ -62,3 +65,4 @@ blocks:
commands:
- ( cd Core && cache restore core-npm && ../.custom-npm/node_modules/.bin/npm install && cache store core-npm node_modules && ../.custom-npm/node_modules/.bin/npm test )
- bundle exec fastlane test

3 changes: 1 addition & 2 deletions appium/config/wdio.ios.app.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ config.capabilities = [
wdaLaunchTimeout: 300000,
wdaConnectionTimeout: 600000,
wdaStartupRetries: 4,
wdaStartupRetryInterval: 120000,
resetOnSessionStartOnly: true
wdaStartupRetryInterval: 120000
},
];

Expand Down
2 changes: 1 addition & 1 deletion appium/config/wdio.shared.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports.config = {
runner: 'local',
framework: 'jasmine',
jasmineNodeOpts: {
defaultTimeoutInterval: 180000,
defaultTimeoutInterval: 600000,
requires: ['ts-node/register', 'tsconfig-paths/register']
},
sync: true,
Expand Down
10 changes: 10 additions & 0 deletions appium/tests/helpers/ElementHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ class ElementHelper {
this.waitElementVisible(element);
element.doubleClick();
}

static waitAndClick(element) {
element.waitForDisplayed();
element.click();
}

static waitClickAndType(element, text: string) {
this.waitAndClick(element)
element.setValue(text);
}
}

export default ElementHelper;
22 changes: 11 additions & 11 deletions appium/tests/screenobjects/create-key.screen.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import BaseScreen from './base.screen';
import {CommonData} from '../data';
import ElementHelper from "../helpers/ElementHelper";

const SELECTORS = {
SET_PASS_PHRASE_BUTTON: '~Set pass phrase',
Expand Down Expand Up @@ -29,24 +30,23 @@ class CreateKeyScreen extends BaseScreen {
return $(SELECTORS.CONFIRM_PASS_PHRASE_FIELD)
}

setPassPhrase(text: string = CommonData.account.passPhrase) {
this.fillPassPhrase(text);
this.clickSetPassPhraseBtn();
this.confirmPassPhrase(text);
}

fillPassPhrase (passPhrase: string) {
this.enterPassPhraseField.setValue(passPhrase);
ElementHelper.waitClickAndType(this.enterPassPhraseField, passPhrase);
}

clickSetPassPhraseBtn () {
this.setPassPhraseButton.click();
ElementHelper.waitAndClick(this.setPassPhraseButton);
}

confirmPassPhrase (passPhrase: string) {
this.confirmPassPhraseField.click();
this.confirmPassPhraseField.setValue(passPhrase);
this.okButton.click();
}

setPassPhrase(text: string = CommonData.account.passPhrase) {
this.fillPassPhrase(text);
this.clickSetPassPhraseBtn();
this.confirmPassPhrase(text);
ElementHelper.waitClickAndType(this.confirmPassPhraseField, passPhrase);
ElementHelper.waitAndClick(this.okButton);
}
}

Expand Down
7 changes: 4 additions & 3 deletions appium/tests/screenobjects/email.screen.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import BaseScreen from './base.screen';
import {CommonData} from "../data";
import ElementHelper from "../helpers/ElementHelper";

const SELECTORS = {
BACK_BTN: '~arrow left c',
Expand Down Expand Up @@ -59,11 +60,11 @@ class EmailScreen extends BaseScreen {
}

clickBackButton () {
this.backButton.click();
ElementHelper.waitAndClick(this.backButton);
}

clickOkButton() {
this.okButton.click();
ElementHelper.waitAndClick(this.okButton);
}

enterPassPhrase (text: string = CommonData.account.passPhrase) {
Expand All @@ -75,7 +76,7 @@ class EmailScreen extends BaseScreen {
}

clickSaveButton() {
this.saveButton.click();
ElementHelper.waitAndClick(this.saveButton);
}
}

Expand Down
7 changes: 4 additions & 3 deletions appium/tests/screenobjects/inbox.screen.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import BaseScreen from './base.screen';
import ElementHelper from "../helpers/ElementHelper";

const SELECTORS = {
ENTER_YOUR_PASS_PHRASE_FIELD: '-ios class chain:**/XCUIElementTypeSecureTextField[`value == "Enter your pass phrase"`]',
Expand All @@ -24,13 +25,13 @@ class InboxScreen extends BaseScreen {

clickOnEmailBySubject (subject) {
this.createEmailButton.waitForDisplayed();
browser.pause(500); // stability fix
const selector = `~${subject}`;
$(selector).waitForDisplayed();
$(selector).click();
ElementHelper.waitAndClick($(selector));
}

clickCreateEmail () {
this.createEmailButton.click();
ElementHelper.waitAndClick(this.createEmailButton);
}
}

Expand Down
5 changes: 3 additions & 2 deletions appium/tests/screenobjects/keys.screen.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import BaseScreen from './base.screen';
import ElementHelper from "../helpers/ElementHelper";

const SELECTORS = {
KEYS_HEADER: '-ios class chain:**/XCUIElementTypeStaticText[`label == "Keys"`]',
Expand Down Expand Up @@ -71,7 +72,7 @@ class KeysScreen extends BaseScreen {
}

clickOnKey() {
this.nameAndEmail.click();
ElementHelper.waitAndClick(this.nameAndEmail);
}

checkSelectedKeyScreen() {
Expand All @@ -83,7 +84,7 @@ class KeysScreen extends BaseScreen {
}

clickOnShowPublicKey() {
this.showPublicKeyButton.click();
ElementHelper.waitAndClick(this.showPublicKeyButton);
}
}

Expand Down
8 changes: 4 additions & 4 deletions appium/tests/screenobjects/menu-bar.screen.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import BaseScreen from './base.screen';
import {CommonData} from "../data";
import ElementHelper from "../helpers/ElementHelper";

const SELECTORS = {
MENU_ICON: '~menu icn',
Expand All @@ -25,8 +26,7 @@ class MenuBarScreen extends BaseScreen {
}

clickMenuIcon () {
this.menuIcon.waitForDisplayed();
this.menuIcon.click();
ElementHelper.waitAndClick(this.menuIcon);
}

checkUserEmail (email: string = CommonData.account.email) {
Expand All @@ -40,11 +40,11 @@ class MenuBarScreen extends BaseScreen {
}

clickLogout () {
this.logoutButton.click();
ElementHelper.waitAndClick(this.logoutButton);
}

clickSettingsButton () {
this.settingsButton.click();
ElementHelper.waitAndClick(this.settingsButton);
}
}

Expand Down
10 changes: 6 additions & 4 deletions appium/tests/screenobjects/new-message.screen.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import BaseScreen from './base.screen';
import ElementHelper from "../helpers/ElementHelper";

const SELECTORS = {
ADD_RECIPIENT_FIELD: '-ios class chain:**/XCUIElementTypeTextField[`value == "Add Recipient"`]',
Expand All @@ -7,7 +8,8 @@ const SELECTORS = {
ADDED_RECIPIENT: '-ios class chain:**/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther' +
'/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther/XCUIElementTypeTable' +
'/XCUIElementTypeCell[1]/XCUIElementTypeOther/XCUIElementTypeCollectionView/XCUIElementTypeCell' +
'/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeStaticText' //it works only with this selector
'/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeStaticText',//it works only with this selector
RETURN_BUTTON: '~Return'
};

class NewMessageScreen extends BaseScreen {
Expand All @@ -29,11 +31,12 @@ class NewMessageScreen extends BaseScreen {

setAddRecipient(recipient) {
this.addRecipientField.setValue(recipient);
browser.pause(1000);
$(SELECTORS.RETURN_BUTTON).click()
}

setSubject(subject) {
this.subjectField.click();
this.subjectField.setValue(subject);
ElementHelper.waitClickAndType(this.subjectField, subject);
}

setComposeSecurityMessage(message) {
Expand All @@ -55,7 +58,6 @@ class NewMessageScreen extends BaseScreen {
expect(this.composeSecurityMesage).toHaveText(message);
this.filledSubject(subject).waitForDisplayed();
expect(this.addedRecipientEmail).toHaveAttribute('value', ` ${recipient} `);

}
}

Expand Down
3 changes: 2 additions & 1 deletion appium/tests/screenobjects/settings.screen.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import BaseScreen from './base.screen';
import ElementHelper from "../helpers/ElementHelper";
const SELECTORS = {
MENU_ICON: '~menu icn',
};
Expand All @@ -24,7 +25,7 @@ class SettingsScreen extends BaseScreen {
}

clickOnSettingItem(item) {
this.settingsItem(item).click();
ElementHelper.waitAndClick(this.settingsItem(item));
}
}

Expand Down
28 changes: 15 additions & 13 deletions appium/tests/screenobjects/splash.screen.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import BaseScreen from './base.screen';
import {CommonData} from "../data";
import ElementHelper from "../helpers/ElementHelper";

const SELECTORS = {
PRIVACY_TAB: '~privacy',
Expand Down Expand Up @@ -89,7 +90,7 @@ class SplashScreen extends BaseScreen {
}

clickContinueWithGmail () {
this.continueWithGmailBtn.click();
ElementHelper.waitAndClick(this.continueWithGmailBtn);
}

clickContinueBtn () {
Expand All @@ -103,26 +104,27 @@ class SplashScreen extends BaseScreen {
browser.pause(500); // stability sleep
this.languageDropdown.click();
const selector = `~${language}`;
$(selector).waitForDisplayed();
$(selector).click();
ElementHelper.waitAndClick($(selector));
}

fillEmail (email: string) {
this.loginField.click();
this.loginField.setValue(email);
this.doneButton.click();
ElementHelper.waitClickAndType(this.loginField, email);
this.clickDoneBtn();
browser.pause(500); // stability sleep
}

fillPassword(password: string) {
ElementHelper.waitClickAndType(this.passwordField, password);
this.clickDoneBtn();
browser.pause(500); // stability sleep
}

clickNextBtn () {
this.nextButton.click();
ElementHelper.waitAndClick(this.nextButton);
}

fillPassword(password: string) {
this.passwordField.click();
this.passwordField.setValue(password);
this.doneButton.click();
browser.pause(500); // stability sleep
clickDoneBtn () {
ElementHelper.waitAndClick(this.doneButton);
}

gmailLogin (email: string, password: string) {
Expand All @@ -140,11 +142,11 @@ class SplashScreen extends BaseScreen {
}

login(email: string = CommonData.account.email, password: string = CommonData.account.password) {
driver.launchApp();
this.clickContinueWithGmail();
this.clickContinueBtn();
this.changeLanguage();
this.gmailLogin(email, password);
browser.pause(10000); // STABILITY FIX UNTIL WE WLL FIGURE OUT WITH ISSUE
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('INBOX: ', () => {
it('user is able to see encrypted email with pass phrase after restart app', () => {

const senderEmail = CommonData.sender.email;
const emailSubject = 'encrypted message';
const emailSubject = 'encrypted email';
const emailText = 'test test';
const wrongPassPhrase = 'user is not able to see email';

Expand Down