From 2074641f1b1cb22b63fc7da08fcaa53a8fcb1f8b Mon Sep 17 00:00:00 2001 From: Dmitry Sotnikov Date: Mon, 25 Oct 2021 15:03:44 +0300 Subject: [PATCH 1/9] fixes for email screen,splash screen(added wait for element displayed) disabled 2 specs renamed checkErrorMessage to checkWrongPassPhraseErrorMessage --- appium/config/wdio.shared.conf.js | 2 +- appium/tests/screenobjects/email.screen.ts | 2 +- appium/tests/screenobjects/splash.screen.ts | 6 ++++++ .../inbox/CheckEncryptedEmailAfterRestartApp.spec.ts | 8 ++++---- appium/tests/specs/inbox/ReadEmailAfterRestartApp.spec.ts | 6 +++--- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/appium/config/wdio.shared.conf.js b/appium/config/wdio.shared.conf.js index a7b0730b3..69432247b 100644 --- a/appium/config/wdio.shared.conf.js +++ b/appium/config/wdio.shared.conf.js @@ -31,7 +31,7 @@ exports.config = { ], port: 4723, path: '/wd/hub', - specFileRetries: 1, + specFileRetries: 0, specFileRetriesDeferred: false, afterTest: function (test, context, { error, result, duration, passed, retries }) { diff --git a/appium/tests/screenobjects/email.screen.ts b/appium/tests/screenobjects/email.screen.ts index 4be310daa..9f89b2457 100644 --- a/appium/tests/screenobjects/email.screen.ts +++ b/appium/tests/screenobjects/email.screen.ts @@ -70,7 +70,7 @@ class EmailScreen extends BaseScreen { this.enterPassPhraseField.setValue(text); }; - checkErrorMessage() { + checkWrongPassPhraseErrorMessage() { this.wrongPassPhraseMessage.waitForDisplayed(); } diff --git a/appium/tests/screenobjects/splash.screen.ts b/appium/tests/screenobjects/splash.screen.ts index c0a79186b..56cee06be 100644 --- a/appium/tests/screenobjects/splash.screen.ts +++ b/appium/tests/screenobjects/splash.screen.ts @@ -15,6 +15,7 @@ const SELECTORS = { PASSWORD_FIELD: '~Enter your password', DONE_BTN: '~Done', LANGUAGE_DROPDOWN: '-ios class chain:**/XCUIElementTypeOther[`label == "content information"`]/XCUIElementTypeOther[1]', + SIGN_IN_WITH_GMAIL: '-ios class chain:**/XCUIElementTypeOther[`label == "Sign in - Google Accounts"`]' }; class SplashScreen extends BaseScreen { @@ -74,6 +75,10 @@ class SplashScreen extends BaseScreen { return $(SELECTORS.LANGUAGE_DROPDOWN) } + get signInAsGoogleAccounLabel () { + return $(SELECTORS.SIGN_IN_WITH_GMAIL); + } + checkLoginPage () { expect(this.privacyTab).toBeDisplayed(); expect(this.termsTab).toBeDisplayed(); @@ -118,6 +123,7 @@ class SplashScreen extends BaseScreen { gmailLogin (email: string, password: string) { const emailSelector = `-ios class chain:**/XCUIElementTypeStaticText[\`label == "${email}"\`]`; + this.signInAsGoogleAccounLabel.waitForDisplayed(); if($(emailSelector).isDisplayed()) { $(emailSelector).click(); } else { diff --git a/appium/tests/specs/inbox/CheckEncryptedEmailAfterRestartApp.spec.ts b/appium/tests/specs/inbox/CheckEncryptedEmailAfterRestartApp.spec.ts index f3ca1175c..476e206dc 100644 --- a/appium/tests/specs/inbox/CheckEncryptedEmailAfterRestartApp.spec.ts +++ b/appium/tests/specs/inbox/CheckEncryptedEmailAfterRestartApp.spec.ts @@ -6,8 +6,8 @@ import { } from '../../screenobjects/all-screens'; import {CommonData} from '../../data'; - -describe('INBOX: ', () => { +//disabled(terminateApp doesnt work now) +xdescribe('INBOX: ', () => { it('user is able to see encrypted email with pass phrase after restart app', () => { @@ -23,7 +23,7 @@ describe('INBOX: ', () => { SplashScreen.login(); CreateKeyScreen.setPassPhrase(); - InboxScreen.clickOnEmailBySubject(senderEmail); + InboxScreen.clickOnEmailBySubject(emailSubject); EmailScreen.checkOpenedEmail(senderEmail, emailSubject, emailText); driver.terminateApp(bundleId); @@ -35,7 +35,7 @@ describe('INBOX: ', () => { //try to see encrypted message with wrong pass phrase EmailScreen.enterPassPhrase(wrongPassPhrase); EmailScreen.clickOkButton(); - EmailScreen.checkErrorMessage(); + EmailScreen.checkWrongPassPhraseErrorMessage(); //check email after setting correct pass phrase EmailScreen.enterPassPhrase(correctPassPhrase); diff --git a/appium/tests/specs/inbox/ReadEmailAfterRestartApp.spec.ts b/appium/tests/specs/inbox/ReadEmailAfterRestartApp.spec.ts index 5a8a643e1..b609a4aef 100644 --- a/appium/tests/specs/inbox/ReadEmailAfterRestartApp.spec.ts +++ b/appium/tests/specs/inbox/ReadEmailAfterRestartApp.spec.ts @@ -6,8 +6,8 @@ import { } from '../../screenobjects/all-screens'; import {CommonData} from '../../data'; - -describe('INBOX: ', () => { +//disabled(terminateApp doesnt work now) +xdescribe('INBOX: ', () => { it('user is able to see plain email without setting pass phrase after restart app', () => { @@ -20,7 +20,7 @@ describe('INBOX: ', () => { SplashScreen.login(); CreateKeyScreen.setPassPhrase(); - InboxScreen.clickOnEmailBySubject(senderEmail); + InboxScreen.clickOnEmailBySubject(emailSubject); EmailScreen.checkOpenedEmail(senderEmail, emailSubject, emailText); driver.terminateApp(bundleId); From 4023e6a9046801f9ba48473976eeaff815016968 Mon Sep 17 00:00:00 2001 From: Dmitry Sotnikov Date: Mon, 25 Oct 2021 15:31:06 +0300 Subject: [PATCH 2/9] change ci flow, revert retry, small updates --- .semaphore/semaphore.yml | 2 +- appium/config/wdio.ios.app.conf.js | 3 --- appium/config/wdio.shared.conf.js | 2 +- appium/package.json | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index c949f4e33..bed32f520 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -57,7 +57,7 @@ blocks: - mv ~/appium-env ~/git/flowcrypt-ios/appium/.env - cache restore appium-npm && cd ./appium && npm i && cd .. && cache store appium-npm appium/node_modules - bundle exec fastlane build - - ls -la appium && cd appium && npm run ios.smoke + - ls -la appium && cd appium && npm run ios.all epilogue: on_fail: commands: diff --git a/appium/config/wdio.ios.app.conf.js b/appium/config/wdio.ios.app.conf.js index c07d7dbec..a477d744d 100644 --- a/appium/config/wdio.ios.app.conf.js +++ b/appium/config/wdio.ios.app.conf.js @@ -9,9 +9,6 @@ config.suites = { ], smoke: [ './tests/specs/login/GmailLogin.spec.ts' - ], - settings: [ - './tests/specs/settings/*.spec.ts' ] }; diff --git a/appium/config/wdio.shared.conf.js b/appium/config/wdio.shared.conf.js index 69432247b..a7b0730b3 100644 --- a/appium/config/wdio.shared.conf.js +++ b/appium/config/wdio.shared.conf.js @@ -31,7 +31,7 @@ exports.config = { ], port: 4723, path: '/wd/hub', - specFileRetries: 0, + specFileRetries: 1, specFileRetriesDeferred: false, afterTest: function (test, context, { error, result, duration, passed, retries }) { diff --git a/appium/package.json b/appium/package.json index 6521d18d3..a9519ce9a 100644 --- a/appium/package.json +++ b/appium/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "ios.smoke": "./node_modules/.bin/wdio ./config/wdio.ios.app.conf.js --suite smoke", - "ios.settings": "./node_modules/.bin/wdio ./config/wdio.ios.app.conf.js --suite settings" + "ios.all": "./node_modules/.bin/wdio ./config/wdio.ios.app.conf.js --suite all" }, "author": "FlowCrypt a. s.", "license": "proprietary", From 8730bc46a6a9845ae71d808a8fd6598e66512d00 Mon Sep 17 00:00:00 2001 From: Dmitry Sotnikov Date: Mon, 25 Oct 2021 16:38:22 +0300 Subject: [PATCH 3/9] all needed fixes for all tests --- appium/config/wdio.ios.app.conf.js | 3 +++ appium/tests/screenobjects/inbox.screen.ts | 1 + appium/tests/screenobjects/menu-bar.screen.ts | 1 + appium/tests/screenobjects/splash.screen.ts | 2 ++ .../specs/inbox/CheckEncryptedEmailAfterRestartApp.spec.ts | 4 ++-- appium/tests/specs/inbox/ReadEmailAfterRestartApp.spec.ts | 2 +- .../tests/specs/settings/CheckSettingsForLoggedUser.spec.ts | 1 - 7 files changed, 10 insertions(+), 4 deletions(-) diff --git a/appium/config/wdio.ios.app.conf.js b/appium/config/wdio.ios.app.conf.js index a477d744d..c07d7dbec 100644 --- a/appium/config/wdio.ios.app.conf.js +++ b/appium/config/wdio.ios.app.conf.js @@ -9,6 +9,9 @@ config.suites = { ], smoke: [ './tests/specs/login/GmailLogin.spec.ts' + ], + settings: [ + './tests/specs/settings/*.spec.ts' ] }; diff --git a/appium/tests/screenobjects/inbox.screen.ts b/appium/tests/screenobjects/inbox.screen.ts index 8430e3f0a..81e17cb89 100644 --- a/appium/tests/screenobjects/inbox.screen.ts +++ b/appium/tests/screenobjects/inbox.screen.ts @@ -25,6 +25,7 @@ class InboxScreen extends BaseScreen { clickOnEmailBySubject (subject) { this.createEmailButton.waitForDisplayed(); const selector = `~${subject}`; + $(selector).waitForDisplayed(); $(selector).click(); } diff --git a/appium/tests/screenobjects/menu-bar.screen.ts b/appium/tests/screenobjects/menu-bar.screen.ts index ff77915cc..b4fcc9786 100644 --- a/appium/tests/screenobjects/menu-bar.screen.ts +++ b/appium/tests/screenobjects/menu-bar.screen.ts @@ -25,6 +25,7 @@ class MenuBarScreen extends BaseScreen { } clickMenuIcon () { + this.menuIcon.waitForDisplayed(); this.menuIcon.click(); } diff --git a/appium/tests/screenobjects/splash.screen.ts b/appium/tests/screenobjects/splash.screen.ts index 56cee06be..cfbc07b01 100644 --- a/appium/tests/screenobjects/splash.screen.ts +++ b/appium/tests/screenobjects/splash.screen.ts @@ -109,6 +109,7 @@ class SplashScreen extends BaseScreen { this.loginField.click(); this.loginField.setValue(email); this.doneButton.click(); + browser.pause(500); // stability sleep } clickNextBtn () { @@ -119,6 +120,7 @@ class SplashScreen extends BaseScreen { this.passwordField.click(); this.passwordField.setValue(password); this.doneButton.click(); + browser.pause(500); // stability sleep } gmailLogin (email: string, password: string) { diff --git a/appium/tests/specs/inbox/CheckEncryptedEmailAfterRestartApp.spec.ts b/appium/tests/specs/inbox/CheckEncryptedEmailAfterRestartApp.spec.ts index 476e206dc..45b14aa99 100644 --- a/appium/tests/specs/inbox/CheckEncryptedEmailAfterRestartApp.spec.ts +++ b/appium/tests/specs/inbox/CheckEncryptedEmailAfterRestartApp.spec.ts @@ -6,8 +6,8 @@ import { } from '../../screenobjects/all-screens'; import {CommonData} from '../../data'; -//disabled(terminateApp doesnt work now) -xdescribe('INBOX: ', () => { + +describe('INBOX: ', () => { it('user is able to see encrypted email with pass phrase after restart app', () => { diff --git a/appium/tests/specs/inbox/ReadEmailAfterRestartApp.spec.ts b/appium/tests/specs/inbox/ReadEmailAfterRestartApp.spec.ts index b609a4aef..28c6e9f83 100644 --- a/appium/tests/specs/inbox/ReadEmailAfterRestartApp.spec.ts +++ b/appium/tests/specs/inbox/ReadEmailAfterRestartApp.spec.ts @@ -6,7 +6,7 @@ import { } from '../../screenobjects/all-screens'; import {CommonData} from '../../data'; -//disabled(terminateApp doesnt work now) + xdescribe('INBOX: ', () => { it('user is able to see plain email without setting pass phrase after restart app', () => { diff --git a/appium/tests/specs/settings/CheckSettingsForLoggedUser.spec.ts b/appium/tests/specs/settings/CheckSettingsForLoggedUser.spec.ts index 4030bf800..7860eeda3 100644 --- a/appium/tests/specs/settings/CheckSettingsForLoggedUser.spec.ts +++ b/appium/tests/specs/settings/CheckSettingsForLoggedUser.spec.ts @@ -30,6 +30,5 @@ describe('SETTINGS: ', () => { KeysScreen.clickOnShowPublicKey(); PublicKeyScreen.checkPublicKey(); - }); }); From 8fb6e6ab98d530fe1018db916a3147fd007ea3cb Mon Sep 17 00:00:00 2001 From: Dmitry Sotnikov Date: Mon, 25 Oct 2021 16:39:02 +0300 Subject: [PATCH 4/9] enable spec --- appium/tests/specs/inbox/ReadEmailAfterRestartApp.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appium/tests/specs/inbox/ReadEmailAfterRestartApp.spec.ts b/appium/tests/specs/inbox/ReadEmailAfterRestartApp.spec.ts index 28c6e9f83..7a3b0cccc 100644 --- a/appium/tests/specs/inbox/ReadEmailAfterRestartApp.spec.ts +++ b/appium/tests/specs/inbox/ReadEmailAfterRestartApp.spec.ts @@ -7,7 +7,7 @@ import { import {CommonData} from '../../data'; -xdescribe('INBOX: ', () => { +describe('INBOX: ', () => { it('user is able to see plain email without setting pass phrase after restart app', () => { From 8986b32a401d5327219dd6ab808812ee4b442ce5 Mon Sep 17 00:00:00 2001 From: Dmitry Sotnikov Date: Mon, 25 Oct 2021 17:13:58 +0300 Subject: [PATCH 5/9] small fix for login --- appium/tests/screenobjects/splash.screen.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appium/tests/screenobjects/splash.screen.ts b/appium/tests/screenobjects/splash.screen.ts index cfbc07b01..91b6bd15c 100644 --- a/appium/tests/screenobjects/splash.screen.ts +++ b/appium/tests/screenobjects/splash.screen.ts @@ -99,6 +99,7 @@ class SplashScreen extends BaseScreen { } changeLanguage (language: string = '‪English (United States)‬') { + this.languageDropdown.waitForDisplayed(); this.languageDropdown.click(); const selector = `~${language}`; $(selector).waitForDisplayed(); @@ -126,6 +127,7 @@ class SplashScreen extends BaseScreen { gmailLogin (email: string, password: string) { const emailSelector = `-ios class chain:**/XCUIElementTypeStaticText[\`label == "${email}"\`]`; this.signInAsGoogleAccounLabel.waitForDisplayed(); + browser.pause(1000); // stability sleep for language change if($(emailSelector).isDisplayed()) { $(emailSelector).click(); } else { From a9bf5e61a6e96006e3396434aab508ab767c1d0d Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 25 Oct 2021 22:30:48 +0800 Subject: [PATCH 6/9] was clicking language selection too early --- appium/tests/screenobjects/splash.screen.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/appium/tests/screenobjects/splash.screen.ts b/appium/tests/screenobjects/splash.screen.ts index 91b6bd15c..999065e98 100644 --- a/appium/tests/screenobjects/splash.screen.ts +++ b/appium/tests/screenobjects/splash.screen.ts @@ -100,6 +100,7 @@ class SplashScreen extends BaseScreen { changeLanguage (language: string = '‪English (United States)‬') { this.languageDropdown.waitForDisplayed(); + browser.pause(500); // stability sleep this.languageDropdown.click(); const selector = `~${language}`; $(selector).waitForDisplayed(); From 639851aac22245347bafccfa63eaa8ba2764a047 Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 25 Oct 2021 23:04:24 +0800 Subject: [PATCH 7/9] increase timeout for core tests --- FlowCryptAppTests/Core/FlowCryptCoreTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FlowCryptAppTests/Core/FlowCryptCoreTests.swift b/FlowCryptAppTests/Core/FlowCryptCoreTests.swift index 7fe3d5782..c14a579cd 100644 --- a/FlowCryptAppTests/Core/FlowCryptCoreTests.swift +++ b/FlowCryptAppTests/Core/FlowCryptCoreTests.swift @@ -17,7 +17,7 @@ final class FlowCryptCoreTests: XCTestCase { core.startInBackgroundIfNotAlreadyRunning { expectation.fulfill() } - wait(for: [expectation], timeout: 10) + wait(for: [expectation], timeout: 20) } // the tests below From 0b15928788170e3fbbc3bd0a184d9f6945f978ae Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 26 Oct 2021 00:06:21 +0800 Subject: [PATCH 8/9] try increasing jasmine interval to 10 min --- appium/config/wdio.shared.conf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appium/config/wdio.shared.conf.js b/appium/config/wdio.shared.conf.js index e2181eb1a..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: 300000, + defaultTimeoutInterval: 600000, requires: ['ts-node/register', 'tsconfig-paths/register'] }, sync: true, From c0fbe1d81ccd63b4fa419ae9033ea65c70fead4d Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 26 Oct 2021 00:16:38 +0800 Subject: [PATCH 9/9] add inbox group, reduce test timeout to 3 minutes --- appium/config/wdio.ios.app.conf.js | 3 +++ appium/config/wdio.shared.conf.js | 2 +- appium/package.json | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/appium/config/wdio.ios.app.conf.js b/appium/config/wdio.ios.app.conf.js index c07d7dbec..82da5eedd 100644 --- a/appium/config/wdio.ios.app.conf.js +++ b/appium/config/wdio.ios.app.conf.js @@ -12,6 +12,9 @@ config.suites = { ], settings: [ './tests/specs/settings/*.spec.ts' + ], + inbox: [ + './tests/specs/inbox/*.spec.ts' ] }; diff --git a/appium/config/wdio.shared.conf.js b/appium/config/wdio.shared.conf.js index 644cf1408..824d2fea4 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: 600000, + defaultTimeoutInterval: 180000, requires: ['ts-node/register', 'tsconfig-paths/register'] }, sync: true, diff --git a/appium/package.json b/appium/package.json index ff16943c4..69435b16b 100644 --- a/appium/package.json +++ b/appium/package.json @@ -7,6 +7,7 @@ "only.test.smoke": "./node_modules/.bin/wdio ./config/wdio.ios.app.conf.js --suite smoke", "only.test.settings": "./node_modules/.bin/wdio ./config/wdio.ios.app.conf.js --suite settings", "only.test.all": "./node_modules/.bin/wdio ./config/wdio.ios.app.conf.js --suite all", + "only.test.inbox": "./node_modules/.bin/wdio ./config/wdio.ios.app.conf.js --suite inbox", "test": "(cd .. && bundle exec fastlane build) && npm run-script only.test.all" }, "author": "FlowCrypt a. s.",