diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index 81c3e0cc2..645038b3e 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -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 @@ -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 + diff --git a/appium/config/wdio.ios.app.conf.js b/appium/config/wdio.ios.app.conf.js index 82da5eedd..846e0493d 100644 --- a/appium/config/wdio.ios.app.conf.js +++ b/appium/config/wdio.ios.app.conf.js @@ -30,8 +30,7 @@ config.capabilities = [ wdaLaunchTimeout: 300000, wdaConnectionTimeout: 600000, wdaStartupRetries: 4, - wdaStartupRetryInterval: 120000, - resetOnSessionStartOnly: true + wdaStartupRetryInterval: 120000 }, ]; diff --git a/appium/config/wdio.shared.conf.js b/appium/config/wdio.shared.conf.js index 824d2fea4..644cf1408 100644 --- a/appium/config/wdio.shared.conf.js +++ b/appium/config/wdio.shared.conf.js @@ -5,7 +5,7 @@ exports.config = { runner: 'local', framework: 'jasmine', jasmineNodeOpts: { - defaultTimeoutInterval: 180000, + defaultTimeoutInterval: 600000, requires: ['ts-node/register', 'tsconfig-paths/register'] }, sync: true, diff --git a/appium/tests/helpers/ElementHelper.ts b/appium/tests/helpers/ElementHelper.ts index 405e4b478..1338d37e9 100644 --- a/appium/tests/helpers/ElementHelper.ts +++ b/appium/tests/helpers/ElementHelper.ts @@ -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; diff --git a/appium/tests/screenobjects/create-key.screen.ts b/appium/tests/screenobjects/create-key.screen.ts index baebc04ab..470023f23 100644 --- a/appium/tests/screenobjects/create-key.screen.ts +++ b/appium/tests/screenobjects/create-key.screen.ts @@ -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', @@ -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); } } diff --git a/appium/tests/screenobjects/email.screen.ts b/appium/tests/screenobjects/email.screen.ts index 9f89b2457..a2382351f 100644 --- a/appium/tests/screenobjects/email.screen.ts +++ b/appium/tests/screenobjects/email.screen.ts @@ -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', @@ -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) { @@ -75,7 +76,7 @@ class EmailScreen extends BaseScreen { } clickSaveButton() { - this.saveButton.click(); + ElementHelper.waitAndClick(this.saveButton); } } diff --git a/appium/tests/screenobjects/inbox.screen.ts b/appium/tests/screenobjects/inbox.screen.ts index 81e17cb89..256bad424 100644 --- a/appium/tests/screenobjects/inbox.screen.ts +++ b/appium/tests/screenobjects/inbox.screen.ts @@ -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"`]', @@ -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); } } diff --git a/appium/tests/screenobjects/keys.screen.ts b/appium/tests/screenobjects/keys.screen.ts index 58439e4d1..fb2c9ce35 100644 --- a/appium/tests/screenobjects/keys.screen.ts +++ b/appium/tests/screenobjects/keys.screen.ts @@ -1,4 +1,5 @@ import BaseScreen from './base.screen'; +import ElementHelper from "../helpers/ElementHelper"; const SELECTORS = { KEYS_HEADER: '-ios class chain:**/XCUIElementTypeStaticText[`label == "Keys"`]', @@ -71,7 +72,7 @@ class KeysScreen extends BaseScreen { } clickOnKey() { - this.nameAndEmail.click(); + ElementHelper.waitAndClick(this.nameAndEmail); } checkSelectedKeyScreen() { @@ -83,7 +84,7 @@ class KeysScreen extends BaseScreen { } clickOnShowPublicKey() { - this.showPublicKeyButton.click(); + ElementHelper.waitAndClick(this.showPublicKeyButton); } } diff --git a/appium/tests/screenobjects/menu-bar.screen.ts b/appium/tests/screenobjects/menu-bar.screen.ts index b4fcc9786..6e53c6f57 100644 --- a/appium/tests/screenobjects/menu-bar.screen.ts +++ b/appium/tests/screenobjects/menu-bar.screen.ts @@ -1,5 +1,6 @@ import BaseScreen from './base.screen'; import {CommonData} from "../data"; +import ElementHelper from "../helpers/ElementHelper"; const SELECTORS = { MENU_ICON: '~menu icn', @@ -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) { @@ -40,11 +40,11 @@ class MenuBarScreen extends BaseScreen { } clickLogout () { - this.logoutButton.click(); + ElementHelper.waitAndClick(this.logoutButton); } clickSettingsButton () { - this.settingsButton.click(); + ElementHelper.waitAndClick(this.settingsButton); } } diff --git a/appium/tests/screenobjects/new-message.screen.ts b/appium/tests/screenobjects/new-message.screen.ts index 9cde18d37..d413afcad 100644 --- a/appium/tests/screenobjects/new-message.screen.ts +++ b/appium/tests/screenobjects/new-message.screen.ts @@ -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"`]', @@ -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 { @@ -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) { @@ -55,7 +58,6 @@ class NewMessageScreen extends BaseScreen { expect(this.composeSecurityMesage).toHaveText(message); this.filledSubject(subject).waitForDisplayed(); expect(this.addedRecipientEmail).toHaveAttribute('value', ` ${recipient} `); - } } diff --git a/appium/tests/screenobjects/settings.screen.ts b/appium/tests/screenobjects/settings.screen.ts index dcc1c6b96..82823c5e4 100644 --- a/appium/tests/screenobjects/settings.screen.ts +++ b/appium/tests/screenobjects/settings.screen.ts @@ -1,4 +1,5 @@ import BaseScreen from './base.screen'; +import ElementHelper from "../helpers/ElementHelper"; const SELECTORS = { MENU_ICON: '~menu icn', }; @@ -24,7 +25,7 @@ class SettingsScreen extends BaseScreen { } clickOnSettingItem(item) { - this.settingsItem(item).click(); + ElementHelper.waitAndClick(this.settingsItem(item)); } } diff --git a/appium/tests/screenobjects/splash.screen.ts b/appium/tests/screenobjects/splash.screen.ts index 999065e98..eabe5b9ea 100644 --- a/appium/tests/screenobjects/splash.screen.ts +++ b/appium/tests/screenobjects/splash.screen.ts @@ -1,5 +1,6 @@ import BaseScreen from './base.screen'; import {CommonData} from "../data"; +import ElementHelper from "../helpers/ElementHelper"; const SELECTORS = { PRIVACY_TAB: '~privacy', @@ -89,7 +90,7 @@ class SplashScreen extends BaseScreen { } clickContinueWithGmail () { - this.continueWithGmailBtn.click(); + ElementHelper.waitAndClick(this.continueWithGmailBtn); } clickContinueBtn () { @@ -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) { @@ -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 } } diff --git a/appium/tests/specs/inbox/CheckEncryptedEmailAfterRestartApp.spec.ts b/appium/tests/specs/inbox/CheckEncryptedEmailAfterRestartApp.spec.ts index 45b14aa99..5e1aab0b0 100644 --- a/appium/tests/specs/inbox/CheckEncryptedEmailAfterRestartApp.spec.ts +++ b/appium/tests/specs/inbox/CheckEncryptedEmailAfterRestartApp.spec.ts @@ -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';