From afc0165a0826da5219693bce0c9add1d09202ff7 Mon Sep 17 00:00:00 2001 From: Roma Sosnovsky Date: Wed, 6 Apr 2022 16:32:21 +0300 Subject: [PATCH 01/10] #1467 make fesUrl lazy property --- FlowCrypt/App/AppContext.swift | 2 - .../Compose/ComposeViewController.swift | 5 ++- .../Inbox/InboxViewController.swift | 14 +++--- .../MsgListViewController.swift | 34 +++++++------- .../Key List/KeySettingsViewController.swift | 4 +- .../SettingsViewController.swift | 13 +++--- .../SetupGenerateKeyViewController.swift | 4 +- .../Setup/SetupInitialViewController.swift | 16 ++++--- .../SideMenu/Menu/MyMenuViewController.swift | 10 +++-- .../Threads/ThreadDetailsViewController.swift | 21 +++++---- .../Encrypted Storage/EncryptedStorage.swift | 5 ++- .../EnterpriseServerApi.swift | 22 +++++++--- .../EnterpriseServerApiHelper.swift | 8 +++- .../Functionality/Services/AppStartup.swift | 12 ++--- .../ClientConfigurationService.swift | 44 +++++++++++-------- .../LocalClientConfiguration.swift | 6 +-- .../ClientConfigurationRealmObject.swift | 10 ++--- .../ClientConfigurationServiceTests.swift | 10 ++--- .../ClientConfigurationProviderMock.swift | 2 +- .../OrganisationalRulesServiceMock.swift | 15 ++++--- 20 files changed, 149 insertions(+), 108 deletions(-) diff --git a/FlowCrypt/App/AppContext.swift b/FlowCrypt/App/AppContext.swift index b5a93817b..4fd48334b 100644 --- a/FlowCrypt/App/AppContext.swift +++ b/FlowCrypt/App/AppContext.swift @@ -145,8 +145,6 @@ class AppContextWithUser: AppContext { ) ) - _ = try await self.clientConfigurationService.fetch(for: user) - super.init( encryptedStorage: encryptedStorage, session: session, diff --git a/FlowCrypt/Controllers/Compose/ComposeViewController.swift b/FlowCrypt/Controllers/Compose/ComposeViewController.swift index 3a0dcf294..89625dc3b 100644 --- a/FlowCrypt/Controllers/Compose/ComposeViewController.swift +++ b/FlowCrypt/Controllers/Compose/ComposeViewController.swift @@ -101,13 +101,14 @@ final class ComposeViewController: TableNodeViewController { filesManager: FilesManagerType = FilesManager(), photosManager: PhotosManagerType = PhotosManager(), keyMethods: KeyMethodsType = KeyMethods() - ) throws { + ) async throws { self.appContext = appContext self.email = appContext.user.email self.notificationCenter = notificationCenter self.input = input self.decorator = decorator - let clientConfiguration = try appContext.clientConfigurationService.getSaved(for: appContext.user.email) + let clientConfiguration = try await appContext.clientConfigurationService.configuration + self.localContactsProvider = LocalContactsProvider( encryptedStorage: appContext.encryptedStorage ) diff --git a/FlowCrypt/Controllers/Inbox/InboxViewController.swift b/FlowCrypt/Controllers/Inbox/InboxViewController.swift index 6e6577587..435a00102 100644 --- a/FlowCrypt/Controllers/Inbox/InboxViewController.swift +++ b/FlowCrypt/Controllers/Inbox/InboxViewController.swift @@ -369,12 +369,14 @@ extension InboxViewController { } private func btnComposeTap() { - do { - TapTicFeedback.generate(.light) - let composeVc = try ComposeViewController(appContext: appContext) - navigationController?.pushViewController(composeVc, animated: true) - } catch { - showAlert(message: error.localizedDescription) + Task { + do { + TapTicFeedback.generate(.light) + let composeVc = try await ComposeViewController(appContext: appContext) + navigationController?.pushViewController(composeVc, animated: true) + } catch { + showAlert(message: error.localizedDescription) + } } } } diff --git a/FlowCrypt/Controllers/MessageList Extension/MsgListViewController.swift b/FlowCrypt/Controllers/MessageList Extension/MsgListViewController.swift index af3d2e016..9d28b462e 100644 --- a/FlowCrypt/Controllers/MessageList Extension/MsgListViewController.swift +++ b/FlowCrypt/Controllers/MessageList Extension/MsgListViewController.swift @@ -31,12 +31,14 @@ extension MsgListViewController where Self: UIViewController { // TODO: uncomment in "sent message from draft" feature private func openDraft(appContext: AppContextWithUser, with message: Message) { - do { - let controller = try ComposeViewController(appContext: appContext) - controller.update(with: message) - navigationController?.pushViewController(controller, animated: true) - } catch { - showAlert(message: error.localizedDescription) + Task { + do { + let controller = try await ComposeViewController(appContext: appContext) + controller.update(with: message) + navigationController?.pushViewController(controller, animated: true) + } catch { + showAlert(message: error.localizedDescription) + } } } @@ -51,16 +53,18 @@ extension MsgListViewController where Self: UIViewController { } private func openThread(with thread: MessageThread, appContext: AppContextWithUser) { - do { - let viewController = try ThreadDetailsViewController( - appContext: appContext, - thread: thread - ) { [weak self] (action, message) in - self?.handleMessageOperation(with: message, action: action) + Task { + do { + let viewController = try await ThreadDetailsViewController( + appContext: appContext, + thread: thread + ) { [weak self] (action, message) in + self?.handleMessageOperation(with: message, action: action) + } + navigationController?.pushViewController(viewController, animated: true) + } catch { + showAlert(message: error.localizedDescription) } - navigationController?.pushViewController(viewController, animated: true) - } catch { - showAlert(message: error.localizedDescription) } } diff --git a/FlowCrypt/Controllers/Settings/KeySettings/Key List/KeySettingsViewController.swift b/FlowCrypt/Controllers/Settings/KeySettings/Key List/KeySettingsViewController.swift index 02c3f174e..05f5f92d4 100644 --- a/FlowCrypt/Controllers/Settings/KeySettings/Key List/KeySettingsViewController.swift +++ b/FlowCrypt/Controllers/Settings/KeySettings/Key List/KeySettingsViewController.swift @@ -27,10 +27,10 @@ final class KeySettingsViewController: TableNodeViewController { appContext: AppContextWithUser, decorator: KeySettingsViewDecorator = KeySettingsViewDecorator(), keyMethods: KeyMethodsType = KeyMethods() - ) throws { + ) async throws { self.appContext = appContext self.decorator = decorator - self.isUsingKeyManager = try appContext.clientConfigurationService.getSaved(for: appContext.user.email).isUsingKeyManager + self.isUsingKeyManager = try await appContext.clientConfigurationService.configuration.isUsingKeyManager self.keyMethods = keyMethods super.init(node: TableNode()) } diff --git a/FlowCrypt/Controllers/Settings/Settings List/SettingsViewController.swift b/FlowCrypt/Controllers/Settings/Settings List/SettingsViewController.swift index 2977738ad..44936b3a1 100644 --- a/FlowCrypt/Controllers/Settings/Settings List/SettingsViewController.swift +++ b/FlowCrypt/Controllers/Settings/Settings List/SettingsViewController.swift @@ -51,10 +51,10 @@ final class SettingsViewController: TableNodeViewController { init( appContext: AppContextWithUser, decorator: SettingsViewDecorator = SettingsViewDecorator() - ) throws { + ) async throws { self.appContext = appContext self.decorator = decorator - self.clientConfiguration = try appContext.clientConfigurationService.getSaved(for: appContext.user.email) + self.clientConfiguration = try await appContext.clientConfigurationService.configuration self.rows = SettingsMenuItem.filtered(with: clientConfiguration) super.init(node: TableNode()) } @@ -101,20 +101,23 @@ extension SettingsViewController: ASTableDelegate, ASTableDataSource { func tableNode(_: ASTableNode, didSelectRowAt indexPath: IndexPath) { let setting = rows[indexPath.row] - proceed(to: setting) + + Task { + await proceed(to: setting) + } } } // MARK: - Actions extension SettingsViewController { - private func proceed(to setting: SettingsMenuItem) { + private func proceed(to setting: SettingsMenuItem) async { let viewController: UIViewController? switch setting { case .keys: do { - viewController = try KeySettingsViewController(appContext: appContext) + viewController = try await KeySettingsViewController(appContext: appContext) } catch { viewController = nil showAlert(message: error.localizedDescription) diff --git a/FlowCrypt/Controllers/Setup/SetupGenerateKeyViewController.swift b/FlowCrypt/Controllers/Setup/SetupGenerateKeyViewController.swift index 7c943e978..a23215bc2 100644 --- a/FlowCrypt/Controllers/Setup/SetupGenerateKeyViewController.swift +++ b/FlowCrypt/Controllers/Setup/SetupGenerateKeyViewController.swift @@ -23,9 +23,9 @@ final class SetupGenerateKeyViewController: SetupCreatePassphraseAbstractViewCon init( appContext: AppContextWithUser, decorator: SetupViewDecorator = SetupViewDecorator() - ) throws { + ) async throws { self.attester = AttesterApi( - clientConfiguration: try appContext.clientConfigurationService.getSaved(for: appContext.user.email) + clientConfiguration: try await appContext.clientConfigurationService.configuration ) super.init( appContext: appContext, diff --git a/FlowCrypt/Controllers/Setup/SetupInitialViewController.swift b/FlowCrypt/Controllers/Setup/SetupInitialViewController.swift index e155f8664..1930b374a 100644 --- a/FlowCrypt/Controllers/Setup/SetupInitialViewController.swift +++ b/FlowCrypt/Controllers/Setup/SetupInitialViewController.swift @@ -62,10 +62,10 @@ final class SetupInitialViewController: TableNodeViewController { appContext: AppContextWithUser, decorator: SetupViewDecorator = SetupViewDecorator(), emailKeyManagerApi: EmailKeyManagerApiType? = nil - ) throws { + ) async throws { self.appContext = appContext self.decorator = decorator - let clientConfiguration = try appContext.clientConfigurationService.getSaved(for: appContext.user.email) + let clientConfiguration = try await appContext.clientConfigurationService.configuration self.emailKeyManagerApi = emailKeyManagerApi ?? EmailKeyManagerApi(clientConfiguration: clientConfiguration) self.clientConfiguration = clientConfiguration super.init(node: TableNode()) @@ -322,11 +322,13 @@ extension SetupInitialViewController { } private func proceedToCreatingNewKey() { - do { - let viewController = try SetupGenerateKeyViewController(appContext: appContext) - navigationController?.pushViewController(viewController, animated: true) - } catch { - showAlert(message: error.localizedDescription) + Task { + do { + let viewController = try await SetupGenerateKeyViewController(appContext: appContext) + navigationController?.pushViewController(viewController, animated: true) + } catch { + showAlert(message: error.localizedDescription) + } } } diff --git a/FlowCrypt/Controllers/SideMenu/Menu/MyMenuViewController.swift b/FlowCrypt/Controllers/SideMenu/Menu/MyMenuViewController.swift index ef5b9556d..7b31e3643 100644 --- a/FlowCrypt/Controllers/SideMenu/Menu/MyMenuViewController.swift +++ b/FlowCrypt/Controllers/SideMenu/Menu/MyMenuViewController.swift @@ -305,10 +305,12 @@ extension MyMenuViewController { sideMenuController()?.sideMenu?.hideSideMenu() return } - do { - sideMenuController()?.setContentViewController(try SettingsViewController(appContext: appContext)) - } catch { - showAlert(message: error.localizedDescription) + Task { + do { + sideMenuController()?.setContentViewController(try await SettingsViewController(appContext: appContext)) + } catch { + showAlert(message: error.localizedDescription) + } } case .logOut: Task { diff --git a/FlowCrypt/Controllers/Threads/ThreadDetailsViewController.swift b/FlowCrypt/Controllers/Threads/ThreadDetailsViewController.swift index b4ff83a8b..4a0c7c3a7 100644 --- a/FlowCrypt/Controllers/Threads/ThreadDetailsViewController.swift +++ b/FlowCrypt/Controllers/Threads/ThreadDetailsViewController.swift @@ -50,9 +50,9 @@ final class ThreadDetailsViewController: TableNodeViewController { messageService: MessageService? = nil, thread: MessageThread, completion: @escaping MessageActionCompletion - ) throws { + ) async throws { self.appContext = appContext - let clientConfiguration = try appContext.clientConfigurationService.getSaved(for: appContext.user.email) + let clientConfiguration = try await appContext.clientConfigurationService.configuration let localContactsProvider = LocalContactsProvider( encryptedStorage: appContext.encryptedStorage ) @@ -268,13 +268,16 @@ extension ThreadDetailsViewController { }() let composeInput = ComposeMessageInput(type: composeType) - do { - navigationController?.pushViewController( - try ComposeViewController(appContext: appContext, input: composeInput), - animated: true - ) - } catch { - showAlert(message: error.localizedDescription) + + Task { + do { + navigationController?.pushViewController( + try await ComposeViewController(appContext: appContext, input: composeInput), + animated: true + ) + } catch { + showAlert(message: error.localizedDescription) + } } } diff --git a/FlowCrypt/Functionality/DataManager/Encrypted Storage/EncryptedStorage.swift b/FlowCrypt/Functionality/DataManager/Encrypted Storage/EncryptedStorage.swift index 56f66458f..fafe75471 100644 --- a/FlowCrypt/Functionality/DataManager/Encrypted Storage/EncryptedStorage.swift +++ b/FlowCrypt/Functionality/DataManager/Encrypted Storage/EncryptedStorage.swift @@ -40,6 +40,7 @@ final class EncryptedStorage: EncryptedStorageType { case version5 case version6 case version7 + case version8 var version: SchemaVersion { switch self { @@ -51,6 +52,8 @@ final class EncryptedStorage: EncryptedStorageType { return SchemaVersion(appVersion: "0.2.0", dbSchemaVersion: 6) case .version7: return SchemaVersion(appVersion: "0.2.0", dbSchemaVersion: 7) + case .version8: + return SchemaVersion(appVersion: "0.2.0", dbSchemaVersion: 8) } } } @@ -62,7 +65,7 @@ final class EncryptedStorage: EncryptedStorageType { private lazy var migrationLogger = Logger.nested(in: Self.self, with: .migration) private lazy var logger = Logger.nested(Self.self) - private let currentSchema: EncryptedStorageSchema = .version7 + private let currentSchema: EncryptedStorageSchema = .version8 private let supportedSchemas = EncryptedStorageSchema.allCases private let storageEncryptionKey: Data diff --git a/FlowCrypt/Functionality/Services/Account Server Services/EnterpriseServerApi.swift b/FlowCrypt/Functionality/Services/Account Server Services/EnterpriseServerApi.swift index 305a2f07b..40186ba70 100644 --- a/FlowCrypt/Functionality/Services/Account Server Services/EnterpriseServerApi.swift +++ b/FlowCrypt/Functionality/Services/Account Server Services/EnterpriseServerApi.swift @@ -9,7 +9,8 @@ import FlowCryptCommon protocol EnterpriseServerApiType { - var fesUrl: String? { get } + var email: String { get } + var fesUrl: String? { get async throws } func getClientConfiguration() async throws -> RawClientConfiguration func getReplyToken() async throws -> String @@ -46,15 +47,22 @@ class EnterpriseServerApi: NSObject, EnterpriseServerApiType { private var messageUploadProgressHandler: ((Float) -> Void)? - private let email: String - let fesUrl: String? + private var helper: EnterpriseServerApiHelper? + + let email: String + var fesUrl: String? { + get async throws { + if helper == nil { + self.helper = try await EnterpriseServerApiHelper(email: email) + } + + return self.helper?.fesUrl + } + } init(email: String) async throws { self.email = email - let helper = EnterpriseServerApiHelper() - self.fesUrl = try await helper.getActiveFesUrl(for: email) - super.init() } @@ -132,7 +140,7 @@ class EnterpriseServerApi: NSObject, EnterpriseServerApiType { withAuthorization: Bool = true, delegate: URLSessionTaskDelegate? = nil ) async throws -> T { - guard let fesUrl = fesUrl else { + guard let fesUrl = try await fesUrl else { throw EnterpriseServerApiError.noActiveFesUrl } diff --git a/FlowCrypt/Functionality/Services/Account Server Services/EnterpriseServerApiHelper.swift b/FlowCrypt/Functionality/Services/Account Server Services/EnterpriseServerApiHelper.swift index 3d959bf40..d295aec8c 100644 --- a/FlowCrypt/Functionality/Services/Account Server Services/EnterpriseServerApiHelper.swift +++ b/FlowCrypt/Functionality/Services/Account Server Services/EnterpriseServerApiHelper.swift @@ -25,7 +25,13 @@ struct EnterpriseServerApiHelper { return "https://fes.\(emailDomain)" // live } - func getActiveFesUrl(for email: String) async throws -> String? { + private(set) var fesUrl: String? + + init(email: String) async throws { + self.fesUrl = try await getActiveFesUrl(for: email) + } + + private func getActiveFesUrl(for email: String) async throws -> String? { do { guard let userDomain = email.emailParts?.domain, !EnterpriseServerApi.publicEmailProviderDomains.contains(userDomain) else { diff --git a/FlowCrypt/Functionality/Services/AppStartup.swift b/FlowCrypt/Functionality/Services/AppStartup.swift index dbab88c34..964061382 100644 --- a/FlowCrypt/Functionality/Services/AppStartup.swift +++ b/FlowCrypt/Functionality/Services/AppStartup.swift @@ -75,11 +75,13 @@ struct AppStartup { ) case .setupFlow: try await startWithUserContext(appContext: appContext, window: window) { context in - do { - let controller = try SetupInitialViewController(appContext: context) - window.rootViewController = MainNavigationController(rootViewController: controller) - } catch { - window.rootViewController?.showAlert(message: error.errorMessage) + Task { + do { + let controller = try await SetupInitialViewController(appContext: context) + window.rootViewController = MainNavigationController(rootViewController: controller) + } catch { + window.rootViewController?.showAlert(message: error.errorMessage) + } } } } diff --git a/FlowCrypt/Functionality/Services/Client Configuration Service/ClientConfigurationService.swift b/FlowCrypt/Functionality/Services/Client Configuration Service/ClientConfigurationService.swift index eef94d89b..6d866cf0e 100644 --- a/FlowCrypt/Functionality/Services/Client Configuration Service/ClientConfigurationService.swift +++ b/FlowCrypt/Functionality/Services/Client Configuration Service/ClientConfigurationService.swift @@ -10,15 +10,30 @@ import FlowCryptCommon import Foundation protocol ClientConfigurationServiceType { - func fetch(for user: User) async throws -> ClientConfiguration - func getSaved(for user: String) throws -> ClientConfiguration + var configuration: ClientConfiguration { get async throws } } -final class ClientConfigurationService { +final class ClientConfigurationService: ClientConfigurationServiceType { private let server: EnterpriseServerApiType private let local: LocalClientConfigurationType + private var didFetch = false + + var configuration: ClientConfiguration { + get async throws { + guard didFetch else { + return try await fetch() + } + + guard let raw = try local.load(for: server.email) else { + throw AppErr.unexpected("There should not be a user without OrganisationalRules") + } + + return ClientConfiguration(raw: raw) + } + } + init( server: EnterpriseServerApiType, local: LocalClientConfigurationType @@ -26,29 +41,22 @@ final class ClientConfigurationService { self.server = server self.local = local } -} - -// MARK: - OrganisationalRulesServiceType -extension ClientConfigurationService: ClientConfigurationServiceType { - func fetch(for user: User) async throws -> ClientConfiguration { + private func fetch() async throws -> ClientConfiguration { do { let raw = try await server.getClientConfiguration() - try local.save(for: user, raw: raw, fesUrl: server.fesUrl) + try await local.save( + for: server.email, + raw: raw, + fesUrl: server.fesUrl + ) + didFetch = true return ClientConfiguration(raw: raw) } catch { - guard let raw = try local.load(for: user.email) else { + guard let raw = try local.load(for: server.email) else { throw error } return ClientConfiguration(raw: raw) } } - - func getSaved(for userEmail: String) throws -> ClientConfiguration { - guard let raw = try local.load(for: userEmail) else { - // todo - throw instead - fatalError("There should not be a user without OrganisationalRules") - } - return ClientConfiguration(raw: raw) - } } diff --git a/FlowCrypt/Functionality/Services/Client Configuration Service/LocalClientConfiguration.swift b/FlowCrypt/Functionality/Services/Client Configuration Service/LocalClientConfiguration.swift index 7c2a336b8..f325518a4 100644 --- a/FlowCrypt/Functionality/Services/Client Configuration Service/LocalClientConfiguration.swift +++ b/FlowCrypt/Functionality/Services/Client Configuration Service/LocalClientConfiguration.swift @@ -12,7 +12,7 @@ import RealmSwift protocol LocalClientConfigurationType { func load(for user: String) throws -> RawClientConfiguration? func remove(for user: String) throws - func save(for user: User, raw: RawClientConfiguration, fesUrl: String?) throws + func save(for user: String, raw: RawClientConfiguration, fesUrl: String?) throws } final class LocalClientConfiguration { @@ -48,10 +48,10 @@ extension LocalClientConfiguration: LocalClientConfigurationType { } } - func save(for user: User, raw: RawClientConfiguration, fesUrl: String?) throws { + func save(for userEmail: String, raw: RawClientConfiguration, fesUrl: String?) throws { let object = ClientConfigurationRealmObject( configuration: raw, - user: user, + email: userEmail, fesUrl: fesUrl ) diff --git a/FlowCrypt/Models/Realm Models/ClientConfigurationRealmObject.swift b/FlowCrypt/Models/Realm Models/ClientConfigurationRealmObject.swift index ab2850c2b..d4de3f1d4 100644 --- a/FlowCrypt/Models/Realm Models/ClientConfigurationRealmObject.swift +++ b/FlowCrypt/Models/Realm Models/ClientConfigurationRealmObject.swift @@ -18,7 +18,6 @@ final class ClientConfigurationRealmObject: Object { @Persisted var disallowAttesterSearchForDomains: Data? @Persisted var enforceKeygenAlgo: String? @Persisted var enforceKeygenExpireMonths: Int - @Persisted var user: UserRealmObject? convenience init( flags: [String]?, @@ -28,7 +27,7 @@ final class ClientConfigurationRealmObject: Object { disallowAttesterSearchForDomains: [String]?, enforceKeygenAlgo: String?, enforceKeygenExpireMonths: Int?, - user: UserRealmObject + email: String ) { self.init() if let flags = flags { @@ -42,13 +41,12 @@ final class ClientConfigurationRealmObject: Object { } self.enforceKeygenAlgo = enforceKeygenAlgo self.enforceKeygenExpireMonths = enforceKeygenExpireMonths ?? -1 - self.user = user - self.userEmail = user.email + self.userEmail = email } } extension ClientConfigurationRealmObject { - convenience init(configuration: RawClientConfiguration, user: User, fesUrl: String?) { + convenience init(configuration: RawClientConfiguration, email: String, fesUrl: String?) { self.init( flags: configuration.flags?.map(\.rawValue), customKeyserverUrl: configuration.customKeyserverUrl, @@ -57,7 +55,7 @@ extension ClientConfigurationRealmObject { disallowAttesterSearchForDomains: configuration.disallowAttesterSearchForDomains, enforceKeygenAlgo: configuration.enforceKeygenAlgo, enforceKeygenExpireMonths: configuration.enforceKeygenExpireMonths, - user: UserRealmObject(user) + email: email ) } } diff --git a/FlowCryptAppTests/Functionality/Services/Client Configuration Service/ClientConfigurationServiceTests.swift b/FlowCryptAppTests/Functionality/Services/Client Configuration Service/ClientConfigurationServiceTests.swift index af9fceb8a..83aba48b1 100644 --- a/FlowCryptAppTests/Functionality/Services/Client Configuration Service/ClientConfigurationServiceTests.swift +++ b/FlowCryptAppTests/Functionality/Services/Client Configuration Service/ClientConfigurationServiceTests.swift @@ -29,13 +29,13 @@ final class ClientConfigurationServiceTests: XCTestCase { ) } - func testGetSavedOrganisationalRulesForCurrentUser() throws { + func testGetSavedOrganisationalRulesForCurrentUser() async throws { let expectedConfiguration = RawClientConfiguration(keyManagerUrl: "https://ekm.example.com") localClientConfigurationProvider.fetchCall = { expectedConfiguration } - let clientConfiguration = try sut.getSaved(for: user.email) + let clientConfiguration = try await sut.configuration XCTAssert(localClientConfigurationProvider.fetchCount == 1) XCTAssert(localClientConfigurationProvider.fetchInvoked == true) XCTAssert(clientConfiguration.raw == expectedConfiguration) @@ -46,7 +46,7 @@ final class ClientConfigurationServiceTests: XCTestCase { nil } do { - _ = try await sut.fetch(for: user) + _ = try await sut.configuration XCTFail() } catch { } @@ -68,7 +68,7 @@ final class ClientConfigurationServiceTests: XCTestCase { "example@flowcrypt.test" } - _ = try await sut.fetch(for: user) + _ = try await sut.configuration } func testInCaseGetClientConfigurationReturnsError() async throws { @@ -86,7 +86,7 @@ final class ClientConfigurationServiceTests: XCTestCase { expectedClientConfiguration } - let clientConfiguration = try await sut.fetch(for: user) + let clientConfiguration = try await sut.configuration XCTAssertTrue(clientConfiguration.raw == expectedClientConfiguration) } } diff --git a/FlowCryptAppTests/Functionality/Services/Client Configuration Service/Mocks/ClientConfigurationProviderMock.swift b/FlowCryptAppTests/Functionality/Services/Client Configuration Service/Mocks/ClientConfigurationProviderMock.swift index cb9471ff1..c12d15ad1 100644 --- a/FlowCryptAppTests/Functionality/Services/Client Configuration Service/Mocks/ClientConfigurationProviderMock.swift +++ b/FlowCryptAppTests/Functionality/Services/Client Configuration Service/Mocks/ClientConfigurationProviderMock.swift @@ -33,7 +33,7 @@ class LocalClientConfigurationMock: LocalClientConfigurationType { var saveCount = 0 var saveCall: (RawClientConfiguration) -> Void = { clientConfiguration in } - func save(for user: User, raw: RawClientConfiguration, fesUrl: String?) { + func save(for user: String, raw: RawClientConfiguration, fesUrl: String?) { saveInvoked = true saveCount += 1 saveCall(raw) diff --git a/FlowCryptAppTests/Functionality/Services/Client Configuration Service/Mocks/OrganisationalRulesServiceMock.swift b/FlowCryptAppTests/Functionality/Services/Client Configuration Service/Mocks/OrganisationalRulesServiceMock.swift index e4785fac3..8de13c104 100644 --- a/FlowCryptAppTests/Functionality/Services/Client Configuration Service/Mocks/OrganisationalRulesServiceMock.swift +++ b/FlowCryptAppTests/Functionality/Services/Client Configuration Service/Mocks/OrganisationalRulesServiceMock.swift @@ -10,14 +10,15 @@ import Foundation final class OrganisationalRulesServiceMock: ClientConfigurationServiceType { - var fetchOrganisationalRulesForCurrentUserResult: Result = .failure(MockError()) - func fetchForCurrentUser() async throws -> ClientConfiguration { - switch fetchOrganisationalRulesForCurrentUserResult { - case .success(let result): - return result - case .failure(let error): - throw error + var configuration: ClientConfiguration { + get async throws { + switch fetchOrganisationalRulesForCurrentUserResult { + case .success(let result): + return result + case .failure(let error): + throw error + } } } From ab53d4a8fb864ac62674bf3abfffb872f0fc4999 Mon Sep 17 00:00:00 2001 From: Roma Sosnovsky Date: Wed, 6 Apr 2022 20:53:16 +0300 Subject: [PATCH 02/10] ui test fix --- FlowCrypt/Functionality/Services/AppStartup.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/FlowCrypt/Functionality/Services/AppStartup.swift b/FlowCrypt/Functionality/Services/AppStartup.swift index 964061382..ce156eb86 100644 --- a/FlowCrypt/Functionality/Services/AppStartup.swift +++ b/FlowCrypt/Functionality/Services/AppStartup.swift @@ -80,7 +80,10 @@ struct AppStartup { let controller = try await SetupInitialViewController(appContext: context) window.rootViewController = MainNavigationController(rootViewController: controller) } catch { - window.rootViewController?.showAlert(message: error.errorMessage) + window.rootViewController?.showAlert( + title: "error_login".localized, + message: error.errorMessage + ) } } } From ecc593a2453e2942f759e1f069918de681b1573f Mon Sep 17 00:00:00 2001 From: Roma Sosnovsky Date: Thu, 7 Apr 2022 21:51:30 +0300 Subject: [PATCH 03/10] tests fixes, xcode and packages update --- .semaphore/semaphore.yml | 2 + .../xcshareddata/swiftpm/Package.resolved | 224 +++++++++--------- .../ClientConfigurationService.swift | 13 +- .../ClientConfigurationServiceTests.swift | 6 +- .../ClientConfigurationProviderMock.swift | 9 +- appium/config/wdio.live.conf.js | 2 +- appium/config/wdio.mock.conf.js | 2 +- appium/tests/screenobjects/email.screen.ts | 11 +- .../tests/screenobjects/new-message.screen.ts | 5 +- 9 files changed, 135 insertions(+), 139 deletions(-) diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index 1fa8bac71..99e9b7a36 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -36,6 +36,7 @@ blocks: jobs: - name: Appium UI tests commands: + - xcversion select 13.3 - bundle exec fastlane build && ls -la appium - 'wget https://flowcrypt.s3.eu-central-1.amazonaws.com/dev/flowcrypt-ios-2021-12-17-v060-for-ci-migration-test.zip -P ~/git/flowcrypt-ios/appium' - cd appium && npm run-script lint @@ -71,6 +72,7 @@ blocks: jobs: - name: TypeScript + Swift tests commands: + - xcversion select 13.3 - ( 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 after_pipeline: diff --git a/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved b/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved index d0d3880a9..d0e356b20 100644 --- a/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,115 +1,113 @@ { - "object": { - "pins": [ - { - "package": "AppAuth", - "repositoryURL": "https://github.com/openid/AppAuth-iOS.git", - "state": { - "branch": null, - "revision": "01131d68346c8ae552961c768d583c715fbe1410", - "version": "1.4.0" - } - }, - { - "package": "BigInt", - "repositoryURL": "https://github.com/attaswift/BigInt", - "state": { - "branch": null, - "revision": "0ed110f7555c34ff468e72e1686e59721f2b0da6", - "version": "5.3.0" - } - }, - { - "package": "GoogleAPIClientForREST", - "repositoryURL": "https://github.com/google/google-api-objectivec-client-for-rest", - "state": { - "branch": null, - "revision": "22e0bb02729d60db396e8b90d8189313cd86ba53", - "version": "1.6.0" - } - }, - { - "package": "GoogleSignIn", - "repositoryURL": "https://github.com/google/GoogleSignIn-iOS", - "state": { - "branch": null, - "revision": "60ca2bfd218ccb194a746a79b41d9d50eb7e3af0", - "version": "6.1.0" - } - }, - { - "package": "GTMSessionFetcher", - "repositoryURL": "https://github.com/google/gtm-session-fetcher.git", - "state": { - "branch": null, - "revision": "bc6a19702ac76ac4e488b68148710eb815f9bc56", - "version": "1.7.0" - } - }, - { - "package": "GTMAppAuth", - "repositoryURL": "https://github.com/google/GTMAppAuth.git", - "state": { - "branch": null, - "revision": "40f4103fb52109032c05599a0c39ad43edbdf80a", - "version": "1.2.2" - } - }, - { - "package": "IDZSwiftCommonCrypto", - "repositoryURL": "https://github.com/iosdevzone/IDZSwiftCommonCrypto", - "state": { - "branch": null, - "revision": "d824371e670bd57eb456bbc41139b4997f7207b8", - "version": "0.13.1" - } - }, - { - "package": "MailCore", - "repositoryURL": "https://github.com/FlowCrypt/mailcore2", - "state": { - "branch": null, - "revision": "512e3074f7b80a4425be806e3ce968f1e84b995f", - "version": "0.7.5" - } - }, - { - "package": "MBProgressHUD", - "repositoryURL": "https://github.com/jdg/MBProgressHUD", - "state": { - "branch": null, - "revision": "bca42b801100b2b3a4eda0ba8dd33d858c780b0d", - "version": "1.2.0" - } - }, - { - "package": "Realm", - "repositoryURL": "https://github.com/realm/realm-cocoa", - "state": { - "branch": null, - "revision": "9dff9f2862240d521ad6ad599541269177ddb993", - "version": "10.22.0" - } - }, - { - "package": "RealmDatabase", - "repositoryURL": "https://github.com/realm/realm-core", - "state": { - "branch": null, - "revision": "6b81f1a7a2d421f9e0b9e7f04e76bcf736a54409", - "version": "11.9.0" - } - }, - { - "package": "Toast", - "repositoryURL": "https://github.com/scalessec/Toast-Swift", - "state": { - "branch": null, - "revision": "0c9493eeacb102cc614da385cfaaf475379f4ab4", - "version": "5.0.1" - } + "pins" : [ + { + "identity" : "appauth-ios", + "kind" : "remoteSourceControl", + "location" : "https://github.com/openid/AppAuth-iOS.git", + "state" : { + "revision" : "33660c271c961f8ce1084cc13f2ea8195e864f7d", + "version" : "1.5.0" } - ] - }, - "version": 1 -} \ No newline at end of file + }, + { + "identity" : "bigint", + "kind" : "remoteSourceControl", + "location" : "https://github.com/attaswift/BigInt", + "state" : { + "revision" : "0ed110f7555c34ff468e72e1686e59721f2b0da6", + "version" : "5.3.0" + } + }, + { + "identity" : "google-api-objectivec-client-for-rest", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/google-api-objectivec-client-for-rest", + "state" : { + "revision" : "3228334d0584cb9174796fecbe628a723be70452", + "version" : "1.7.0" + } + }, + { + "identity" : "googlesignin-ios", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/GoogleSignIn-iOS", + "state" : { + "revision" : "60ca2bfd218ccb194a746a79b41d9d50eb7e3af0", + "version" : "6.1.0" + } + }, + { + "identity" : "gtm-session-fetcher", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/gtm-session-fetcher.git", + "state" : { + "revision" : "eca9404a18f53727e4698211aaf2615eb93b962a", + "version" : "1.7.1" + } + }, + { + "identity" : "gtmappauth", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/GTMAppAuth.git", + "state" : { + "revision" : "e803d09da0147fbf1bbb30e126c47ff43254e057", + "version" : "1.2.3" + } + }, + { + "identity" : "idzswiftcommoncrypto", + "kind" : "remoteSourceControl", + "location" : "https://github.com/iosdevzone/IDZSwiftCommonCrypto", + "state" : { + "revision" : "d824371e670bd57eb456bbc41139b4997f7207b8", + "version" : "0.13.1" + } + }, + { + "identity" : "mailcore2", + "kind" : "remoteSourceControl", + "location" : "https://github.com/FlowCrypt/mailcore2", + "state" : { + "revision" : "512e3074f7b80a4425be806e3ce968f1e84b995f", + "version" : "0.7.5" + } + }, + { + "identity" : "mbprogresshud", + "kind" : "remoteSourceControl", + "location" : "https://github.com/jdg/MBProgressHUD", + "state" : { + "revision" : "bca42b801100b2b3a4eda0ba8dd33d858c780b0d", + "version" : "1.2.0" + } + }, + { + "identity" : "realm-cocoa", + "kind" : "remoteSourceControl", + "location" : "https://github.com/realm/realm-cocoa", + "state" : { + "revision" : "f9400ca044844701ea32491a4c6c4b06d74ab24d", + "version" : "10.25.0" + } + }, + { + "identity" : "realm-core", + "kind" : "remoteSourceControl", + "location" : "https://github.com/realm/realm-core", + "state" : { + "revision" : "3c78cccdc0d9f967c5c15b7f3ea081814e2b3ef2", + "version" : "11.13.0" + } + }, + { + "identity" : "toast-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/scalessec/Toast-Swift", + "state" : { + "revision" : "0c9493eeacb102cc614da385cfaaf475379f4ab4", + "version" : "5.0.1" + } + } + ], + "version" : 2 +} diff --git a/FlowCrypt/Functionality/Services/Client Configuration Service/ClientConfigurationService.swift b/FlowCrypt/Functionality/Services/Client Configuration Service/ClientConfigurationService.swift index 6d866cf0e..68c2bffb1 100644 --- a/FlowCrypt/Functionality/Services/Client Configuration Service/ClientConfigurationService.swift +++ b/FlowCrypt/Functionality/Services/Client Configuration Service/ClientConfigurationService.swift @@ -14,6 +14,7 @@ protocol ClientConfigurationServiceType { } final class ClientConfigurationService: ClientConfigurationServiceType { + private lazy var logger = Logger.nested(Self.self) private let server: EnterpriseServerApiType private let local: LocalClientConfigurationType @@ -22,9 +23,7 @@ final class ClientConfigurationService: ClientConfigurationServiceType { var configuration: ClientConfiguration { get async throws { - guard didFetch else { - return try await fetch() - } + if !didFetch { await fetch() } guard let raw = try local.load(for: server.email) else { throw AppErr.unexpected("There should not be a user without OrganisationalRules") @@ -42,7 +41,7 @@ final class ClientConfigurationService: ClientConfigurationServiceType { self.local = local } - private func fetch() async throws -> ClientConfiguration { + private func fetch() async { do { let raw = try await server.getClientConfiguration() try await local.save( @@ -51,12 +50,8 @@ final class ClientConfigurationService: ClientConfigurationServiceType { fesUrl: server.fesUrl ) didFetch = true - return ClientConfiguration(raw: raw) } catch { - guard let raw = try local.load(for: server.email) else { - throw error - } - return ClientConfiguration(raw: raw) + logger.logError("Client configuration fetch failed: \(error.errorMessage)") } } } diff --git a/FlowCryptAppTests/Functionality/Services/Client Configuration Service/ClientConfigurationServiceTests.swift b/FlowCryptAppTests/Functionality/Services/Client Configuration Service/ClientConfigurationServiceTests.swift index 83aba48b1..627f98471 100644 --- a/FlowCryptAppTests/Functionality/Services/Client Configuration Service/ClientConfigurationServiceTests.swift +++ b/FlowCryptAppTests/Functionality/Services/Client Configuration Service/ClientConfigurationServiceTests.swift @@ -31,7 +31,7 @@ final class ClientConfigurationServiceTests: XCTestCase { func testGetSavedOrganisationalRulesForCurrentUser() async throws { let expectedConfiguration = RawClientConfiguration(keyManagerUrl: "https://ekm.example.com") - localClientConfigurationProvider.fetchCall = { + enterpriseServerApi.getClientConfigurationCall = { _ in expectedConfiguration } @@ -82,9 +82,7 @@ final class ClientConfigurationServiceTests: XCTestCase { "example@flowcrypt.test" } - localClientConfigurationProvider.fetchCall = { - expectedClientConfiguration - } + localClientConfigurationProvider.raw = expectedClientConfiguration let clientConfiguration = try await sut.configuration XCTAssertTrue(clientConfiguration.raw == expectedClientConfiguration) diff --git a/FlowCryptAppTests/Functionality/Services/Client Configuration Service/Mocks/ClientConfigurationProviderMock.swift b/FlowCryptAppTests/Functionality/Services/Client Configuration Service/Mocks/ClientConfigurationProviderMock.swift index c12d15ad1..03f67769e 100644 --- a/FlowCryptAppTests/Functionality/Services/Client Configuration Service/Mocks/ClientConfigurationProviderMock.swift +++ b/FlowCryptAppTests/Functionality/Services/Client Configuration Service/Mocks/ClientConfigurationProviderMock.swift @@ -10,21 +10,21 @@ import Foundation class LocalClientConfigurationMock: LocalClientConfigurationType { + var raw: RawClientConfiguration? var fetchInvoked = false var fetchCount = 0 - var fetchCall: () -> (RawClientConfiguration?) = { - nil - } + func load(for user: String) -> RawClientConfiguration? { fetchInvoked = true fetchCount += 1 - return fetchCall() + return raw } var removeClientConfigurationInvoked = false var removeClientConfigurationCount = 0 func remove(for user: String) { + raw = nil removeClientConfigurationInvoked = true removeClientConfigurationCount += 1 } @@ -34,6 +34,7 @@ class LocalClientConfigurationMock: LocalClientConfigurationType { var saveCall: (RawClientConfiguration) -> Void = { clientConfiguration in } func save(for user: String, raw: RawClientConfiguration, fesUrl: String?) { + self.raw = raw saveInvoked = true saveCount += 1 saveCall(raw) diff --git a/appium/config/wdio.live.conf.js b/appium/config/wdio.live.conf.js index 3075d83a9..bf6378a54 100644 --- a/appium/config/wdio.live.conf.js +++ b/appium/config/wdio.live.conf.js @@ -29,7 +29,7 @@ config.capabilities = [ platformName: 'iOS', iosInstallPause: 5000, deviceName: 'iPhone 13', - platformVersion: '15.2', + platformVersion: '15.4', automationName: 'XCUITest', app: join(process.cwd(), './FlowCrypt.app'), simpleIsVisibleCheck: true, diff --git a/appium/config/wdio.mock.conf.js b/appium/config/wdio.mock.conf.js index 0ee49f6cf..e0d5a1f66 100644 --- a/appium/config/wdio.mock.conf.js +++ b/appium/config/wdio.mock.conf.js @@ -14,7 +14,7 @@ config.capabilities = [ platformName: 'iOS', iosInstallPause: 5000, deviceName: 'iPhone 13', - platformVersion: '15.2', + platformVersion: '15.4', automationName: 'XCUITest', app: join(process.cwd(), './FlowCrypt.app'), processArguments: { 'args': ['--mock-fes-api', '--mock-attester-api'] }, diff --git a/appium/tests/screenobjects/email.screen.ts b/appium/tests/screenobjects/email.screen.ts index 4c4f52ace..07f6ef296 100644 --- a/appium/tests/screenobjects/email.screen.ts +++ b/appium/tests/screenobjects/email.screen.ts @@ -120,8 +120,8 @@ class EmailScreen extends BaseScreen { checkEmailSender = async (sender: string, index = 0) => { const element = await this.senderEmail(index); - await (await element).waitForDisplayed(); - await expect(await (await element).getValue()).toEqual(sender); + await (element).waitForDisplayed(); + expect(await element.getValue()).toEqual(sender); } senderEmail = async (index = 0) =>{ @@ -138,7 +138,7 @@ class EmailScreen extends BaseScreen { await (await $(selector)).waitForDisplayed(); console.log(await $(selector).getValue()); - await expect(await $(selector).getValue()).toContain(text) + expect(await $(selector).getValue()).toContain(text) } checkOpenedEmail = async (email: string, subject: string, text: string) => { @@ -166,7 +166,7 @@ class EmailScreen extends BaseScreen { const element = `~aid-date-${index}`; await (await $(element)).waitForDisplayed(); const convertedDate = moment(await $(element).getValue()).utcOffset(0).format('MMM DD'); - await expect(convertedDate).toEqual(date) + expect(convertedDate).toEqual(date) } clickBackButton = async () => { @@ -246,7 +246,8 @@ class EmailScreen extends BaseScreen { checkAttachmentTextView = async (value: string) => { const el = await this.attachmentTextView; - expect(el).toHaveValueContaining(value); + await ElementHelper.waitElementVisible(el); + expect(el).toHaveTextContaining(value); } } diff --git a/appium/tests/screenobjects/new-message.screen.ts b/appium/tests/screenobjects/new-message.screen.ts index d315bfdad..0734d0c9f 100644 --- a/appium/tests/screenobjects/new-message.screen.ts +++ b/appium/tests/screenobjects/new-message.screen.ts @@ -313,8 +313,9 @@ class NewMessageScreen extends BaseScreen { } checkPasswordCell = async (text: string) => { - await ElementHelper.waitElementVisible(await this.passwordCell); - await ElementHelper.checkStaticText(await this.passwordCell, text); + const el = await this.passwordCell; + await ElementHelper.waitElementVisible(el); + await ElementHelper.checkStaticText(el, text); } clickPasswordCell = async () => { From fd91eb25f058d57afe50c26647d1b21dcbd7e0de Mon Sep 17 00:00:00 2001 From: Roma Sosnovsky Date: Fri, 8 Apr 2022 20:23:59 +0300 Subject: [PATCH 04/10] update ClientConfigurationService --- BuildTools/Package.resolved | 4 +- BuildTools/Package.swift | 2 +- .../ClientConfigurationService.swift | 42 ++++++++++++------- appium/tests/data/index.ts | 2 +- appium/tests/helpers/ElementHelper.ts | 2 +- appium/tests/screenobjects/email.screen.ts | 5 ++- .../tests/screenobjects/mail-folder.screen.ts | 8 ++-- 7 files changed, 38 insertions(+), 27 deletions(-) diff --git a/BuildTools/Package.resolved b/BuildTools/Package.resolved index 2096287e1..2cf327339 100644 --- a/BuildTools/Package.resolved +++ b/BuildTools/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/nicklockwood/SwiftFormat", "state": { "branch": null, - "revision": "a07e7dca002072f1761bae8d5c53fa64462b2c2a", - "version": "0.49.5" + "revision": "16e7dd37937af0f9adf7d8cfb35e97146ce1875f", + "version": "0.49.7" } } ] diff --git a/BuildTools/Package.swift b/BuildTools/Package.swift index dd68d1308..2860a399b 100644 --- a/BuildTools/Package.swift +++ b/BuildTools/Package.swift @@ -6,7 +6,7 @@ let package = Package( name: "BuildTools", platforms: [.macOS(.v10_11)], dependencies: [ - .package(url: "https://github.com/nicklockwood/SwiftFormat", .exact("0.49.5")), + .package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.49.7"), ], targets: [.target(name: "BuildTools", path: "")] ) diff --git a/FlowCrypt/Functionality/Services/Client Configuration Service/ClientConfigurationService.swift b/FlowCrypt/Functionality/Services/Client Configuration Service/ClientConfigurationService.swift index 68c2bffb1..759d643de 100644 --- a/FlowCrypt/Functionality/Services/Client Configuration Service/ClientConfigurationService.swift +++ b/FlowCrypt/Functionality/Services/Client Configuration Service/ClientConfigurationService.swift @@ -23,13 +23,7 @@ final class ClientConfigurationService: ClientConfigurationServiceType { var configuration: ClientConfiguration { get async throws { - if !didFetch { await fetch() } - - guard let raw = try local.load(for: server.email) else { - throw AppErr.unexpected("There should not be a user without OrganisationalRules") - } - - return ClientConfiguration(raw: raw) + didFetch ? try loadSaved() : try await fetchLatest() } } @@ -41,17 +35,33 @@ final class ClientConfigurationService: ClientConfigurationServiceType { self.local = local } - private func fetch() async { + private func loadSaved() throws -> ClientConfiguration { + guard let raw = try local.load(for: server.email) else { + throw AppErr.unexpected("There should not be a user without OrganisationalRules") + } + + return ClientConfiguration(raw: raw) + } + + private func fetchLatest() async throws -> ClientConfiguration { do { - let raw = try await server.getClientConfiguration() - try await local.save( - for: server.email, - raw: raw, - fesUrl: server.fesUrl - ) - didFetch = true + try await fetch() + return try loadSaved() } catch { - logger.logError("Client configuration fetch failed: \(error.errorMessage)") + if let configuration = try? loadSaved() { + return configuration + } + throw error } } + + private func fetch() async throws { + let raw = try await server.getClientConfiguration() + try await local.save( + for: server.email, + raw: raw, + fesUrl: server.fesUrl + ) + didFetch = true + } } diff --git a/appium/tests/data/index.ts b/appium/tests/data/index.ts index d3215ffc0..a2312ed16 100644 --- a/appium/tests/data/index.ts +++ b/appium/tests/data/index.ts @@ -141,7 +141,7 @@ export const CommonData = { encryptedBadgeText: 'encrypted', signatureBadgeText: 'not signed', firstAttachmentName: 'Screenshot_20180422_125217.png.asc', - firstAttachmentBody: '-----BEGIN PGP MESSAGE-----\nVersion: Mailvelope v2.2.0\nComment: https://www.mailvelope.com' + firstAttachmentBody: '-----BEGIN PGP MESSAGE-----\r\nVersion: Mailvelope v2.2.0\r\nComment: https://www.mailvelope.com' }, recipientWithoutPublicKey: { email: 'no.publickey@flowcrypt.com', diff --git a/appium/tests/helpers/ElementHelper.ts b/appium/tests/helpers/ElementHelper.ts index 9f8350ff2..c6ce8fc51 100644 --- a/appium/tests/helpers/ElementHelper.ts +++ b/appium/tests/helpers/ElementHelper.ts @@ -41,7 +41,7 @@ class ElementHelper { static checkStaticText = async (element: WebdriverIO.Element, label: string) => { await this.waitElementVisible(element); - await expect(element).toHaveText(label); + expect(await element.getText()).toEqual(label); } static doubleClick = async (element: WebdriverIO.Element) => { diff --git a/appium/tests/screenobjects/email.screen.ts b/appium/tests/screenobjects/email.screen.ts index 07f6ef296..d8f4b5fd5 100644 --- a/appium/tests/screenobjects/email.screen.ts +++ b/appium/tests/screenobjects/email.screen.ts @@ -120,7 +120,7 @@ class EmailScreen extends BaseScreen { checkEmailSender = async (sender: string, index = 0) => { const element = await this.senderEmail(index); - await (element).waitForDisplayed(); + await element.waitForDisplayed(); expect(await element.getValue()).toEqual(sender); } @@ -247,7 +247,8 @@ class EmailScreen extends BaseScreen { checkAttachmentTextView = async (value: string) => { const el = await this.attachmentTextView; await ElementHelper.waitElementVisible(el); - expect(el).toHaveTextContaining(value); + const text = await el.getText(); + expect(text.includes(value)).toBeTrue(); } } diff --git a/appium/tests/screenobjects/mail-folder.screen.ts b/appium/tests/screenobjects/mail-folder.screen.ts index 532af1813..9dc342a30 100644 --- a/appium/tests/screenobjects/mail-folder.screen.ts +++ b/appium/tests/screenobjects/mail-folder.screen.ts @@ -104,16 +104,16 @@ class MailFolderScreen extends BaseScreen { }; scrollUpToFirstEmail = async () => { - const elem = await this.inboxList[0]; + const elem = this.inboxList[0]; if (elem) { await TouchHelper.scrollUpToElement(elem); } } checkInboxScreen = async () => { - await expect(await this.inboxHeader).toBeDisplayed(); - await expect(await this.searchIcon).toBeDisplayed(); - await expect(await this.helpIcon).toBeDisplayed() + await ElementHelper.waitElementVisible(await this.inboxHeader); + await ElementHelper.waitElementVisible(await this.searchIcon); + await ElementHelper.waitElementVisible(await this.helpIcon); } clickSearchButton = async () => { From 1ed482e40b28946d019cdf285f22694c3c2271b7 Mon Sep 17 00:00:00 2001 From: Roma Sosnovsky Date: Fri, 8 Apr 2022 22:51:25 +0300 Subject: [PATCH 05/10] checkStaticText fix --- appium/tests/helpers/ElementHelper.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/appium/tests/helpers/ElementHelper.ts b/appium/tests/helpers/ElementHelper.ts index c6ce8fc51..d8adc5cd7 100644 --- a/appium/tests/helpers/ElementHelper.ts +++ b/appium/tests/helpers/ElementHelper.ts @@ -41,7 +41,9 @@ class ElementHelper { static checkStaticText = async (element: WebdriverIO.Element, label: string) => { await this.waitElementVisible(element); - expect(await element.getText()).toEqual(label); + await browser.waitUntil( + async () => (await element.getText()) === label + ); } static doubleClick = async (element: WebdriverIO.Element) => { From 5351631d3a9eb8bf2c918cebb625256877e33a9c Mon Sep 17 00:00:00 2001 From: Tom J <6306961+tomholub@users.noreply.github.com> Date: Sat, 9 Apr 2022 10:04:16 +0200 Subject: [PATCH 06/10] Update Package.resolved --- .../xcshareddata/swiftpm/Package.resolved | 214 +++++++++--------- 1 file changed, 106 insertions(+), 108 deletions(-) diff --git a/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved b/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved index 7827dcd75..d4ed6fa79 100644 --- a/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,112 +1,110 @@ { - "object": { - "pins": [ - { - "identity" : "appauth-ios", - "kind" : "remoteSourceControl", - "location" : "https://github.com/openid/AppAuth-iOS.git", - "state" : { - "revision" : "33660c271c961f8ce1084cc13f2ea8195e864f7d", - "version" : "1.5.0" - }, - { - "package": "BigInt", - "repositoryURL": "https://github.com/attaswift/BigInt", - "state": { - "branch": null, - "revision": "0ed110f7555c34ff468e72e1686e59721f2b0da6", - "version": "5.3.0" - } - }, - { - "package": "GoogleAPIClientForREST", - "repositoryURL": "https://github.com/google/google-api-objectivec-client-for-rest", - "state": { - "branch": null, - "revision": "22e0bb02729d60db396e8b90d8189313cd86ba53", - "version": "1.6.0" - } - }, - { - "package": "GoogleSignIn", - "repositoryURL": "https://github.com/google/GoogleSignIn-iOS", - "state": { - "branch": null, - "revision": "60ca2bfd218ccb194a746a79b41d9d50eb7e3af0", - "version": "6.1.0" - } - }, - { - "package": "GTMSessionFetcher", - "repositoryURL": "https://github.com/google/gtm-session-fetcher.git", - "state": { - "branch": null, - "revision": "bc6a19702ac76ac4e488b68148710eb815f9bc56", - "version": "1.7.0" - } - }, - { - "package": "GTMAppAuth", - "repositoryURL": "https://github.com/google/GTMAppAuth.git", - "state": { - "branch": null, - "revision": "40f4103fb52109032c05599a0c39ad43edbdf80a", - "version": "1.2.2" - } - }, - { - "package": "IDZSwiftCommonCrypto", - "repositoryURL": "https://github.com/iosdevzone/IDZSwiftCommonCrypto", - "state": { - "branch": null, - "revision": "d824371e670bd57eb456bbc41139b4997f7207b8", - "version": "0.13.1" - } - }, - { - "package": "MailCore", - "repositoryURL": "https://github.com/FlowCrypt/mailcore2", - "state": { - "branch": null, - "revision": "512e3074f7b80a4425be806e3ce968f1e84b995f", - "version": "0.7.5" - } - }, - { - "package": "MBProgressHUD", - "repositoryURL": "https://github.com/jdg/MBProgressHUD", - "state": { - "branch": null, - "revision": "bca42b801100b2b3a4eda0ba8dd33d858c780b0d", - "version": "1.2.0" - } - }, - { - "package": "Realm", - "repositoryURL": "https://github.com/realm/realm-cocoa", - "state": { - "branch": null, - "revision": "f9400ca044844701ea32491a4c6c4b06d74ab24d", - "version": "10.25.0" - } - }, - { - "package": "RealmDatabase", - "repositoryURL": "https://github.com/realm/realm-core", - "state": { - "branch": null, - "revision": "3c78cccdc0d9f967c5c15b7f3ea081814e2b3ef2", - "version": "11.13.0" - } - }, - { - "package": "Toast", - "repositoryURL": "https://github.com/scalessec/Toast-Swift", - "state": { - "branch": null, - "revision": "0c9493eeacb102cc614da385cfaaf475379f4ab4", - "version": "5.0.1" - } + "pins": [ + { + "identity" : "appauth-ios", + "kind" : "remoteSourceControl", + "location" : "https://github.com/openid/AppAuth-iOS.git", + "state" : { + "revision" : "33660c271c961f8ce1084cc13f2ea8195e864f7d", + "version" : "1.5.0" + }, + { + "package": "BigInt", + "repositoryURL": "https://github.com/attaswift/BigInt", + "state": { + "branch": null, + "revision": "0ed110f7555c34ff468e72e1686e59721f2b0da6", + "version": "5.3.0" + } + }, + { + "package": "GoogleAPIClientForREST", + "repositoryURL": "https://github.com/google/google-api-objectivec-client-for-rest", + "state": { + "branch": null, + "revision": "22e0bb02729d60db396e8b90d8189313cd86ba53", + "version": "1.6.0" + } + }, + { + "package": "GoogleSignIn", + "repositoryURL": "https://github.com/google/GoogleSignIn-iOS", + "state": { + "branch": null, + "revision": "60ca2bfd218ccb194a746a79b41d9d50eb7e3af0", + "version": "6.1.0" + } + }, + { + "package": "GTMSessionFetcher", + "repositoryURL": "https://github.com/google/gtm-session-fetcher.git", + "state": { + "branch": null, + "revision": "bc6a19702ac76ac4e488b68148710eb815f9bc56", + "version": "1.7.0" + } + }, + { + "package": "GTMAppAuth", + "repositoryURL": "https://github.com/google/GTMAppAuth.git", + "state": { + "branch": null, + "revision": "40f4103fb52109032c05599a0c39ad43edbdf80a", + "version": "1.2.2" + } + }, + { + "package": "IDZSwiftCommonCrypto", + "repositoryURL": "https://github.com/iosdevzone/IDZSwiftCommonCrypto", + "state": { + "branch": null, + "revision": "d824371e670bd57eb456bbc41139b4997f7207b8", + "version": "0.13.1" + } + }, + { + "package": "MailCore", + "repositoryURL": "https://github.com/FlowCrypt/mailcore2", + "state": { + "branch": null, + "revision": "512e3074f7b80a4425be806e3ce968f1e84b995f", + "version": "0.7.5" + } + }, + { + "package": "MBProgressHUD", + "repositoryURL": "https://github.com/jdg/MBProgressHUD", + "state": { + "branch": null, + "revision": "bca42b801100b2b3a4eda0ba8dd33d858c780b0d", + "version": "1.2.0" + } + }, + { + "package": "Realm", + "repositoryURL": "https://github.com/realm/realm-cocoa", + "state": { + "branch": null, + "revision": "f9400ca044844701ea32491a4c6c4b06d74ab24d", + "version": "10.25.0" + } + }, + { + "package": "RealmDatabase", + "repositoryURL": "https://github.com/realm/realm-core", + "state": { + "branch": null, + "revision": "3c78cccdc0d9f967c5c15b7f3ea081814e2b3ef2", + "version": "11.13.0" + } + }, + { + "package": "Toast", + "repositoryURL": "https://github.com/scalessec/Toast-Swift", + "state": { + "branch": null, + "revision": "0c9493eeacb102cc614da385cfaaf475379f4ab4", + "version": "5.0.1" } }, { From 78e0439a21cc33cbb3c8d981b97646e7f11cecf5 Mon Sep 17 00:00:00 2001 From: Tom J <6306961+tomholub@users.noreply.github.com> Date: Sat, 9 Apr 2022 10:27:28 +0200 Subject: [PATCH 07/10] Update Package.resolved --- .../xcshareddata/swiftpm/Package.resolved | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved b/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved index d4ed6fa79..f2b787d0e 100644 --- a/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,12 +1,13 @@ { "pins": [ { - "identity" : "appauth-ios", - "kind" : "remoteSourceControl", - "location" : "https://github.com/openid/AppAuth-iOS.git", - "state" : { - "revision" : "33660c271c961f8ce1084cc13f2ea8195e864f7d", - "version" : "1.5.0" + "identity" : "appauth-ios", + "kind" : "remoteSourceControl", + "location" : "https://github.com/openid/AppAuth-iOS.git", + "state" : { + "revision" : "33660c271c961f8ce1084cc13f2ea8195e864f7d", + "version" : "1.5.0" + } }, { "package": "BigInt", From bf1e8bc12800f8b6b143d5428cd2e42c50a1fba7 Mon Sep 17 00:00:00 2001 From: Tom J <6306961+tomholub@users.noreply.github.com> Date: Sat, 9 Apr 2022 10:45:56 +0200 Subject: [PATCH 08/10] Update Package.resolved --- .../xcshareddata/swiftpm/Package.resolved | 99 ------------------- 1 file changed, 99 deletions(-) diff --git a/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved b/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved index f2b787d0e..523857579 100644 --- a/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -9,105 +9,6 @@ "version" : "1.5.0" } }, - { - "package": "BigInt", - "repositoryURL": "https://github.com/attaswift/BigInt", - "state": { - "branch": null, - "revision": "0ed110f7555c34ff468e72e1686e59721f2b0da6", - "version": "5.3.0" - } - }, - { - "package": "GoogleAPIClientForREST", - "repositoryURL": "https://github.com/google/google-api-objectivec-client-for-rest", - "state": { - "branch": null, - "revision": "22e0bb02729d60db396e8b90d8189313cd86ba53", - "version": "1.6.0" - } - }, - { - "package": "GoogleSignIn", - "repositoryURL": "https://github.com/google/GoogleSignIn-iOS", - "state": { - "branch": null, - "revision": "60ca2bfd218ccb194a746a79b41d9d50eb7e3af0", - "version": "6.1.0" - } - }, - { - "package": "GTMSessionFetcher", - "repositoryURL": "https://github.com/google/gtm-session-fetcher.git", - "state": { - "branch": null, - "revision": "bc6a19702ac76ac4e488b68148710eb815f9bc56", - "version": "1.7.0" - } - }, - { - "package": "GTMAppAuth", - "repositoryURL": "https://github.com/google/GTMAppAuth.git", - "state": { - "branch": null, - "revision": "40f4103fb52109032c05599a0c39ad43edbdf80a", - "version": "1.2.2" - } - }, - { - "package": "IDZSwiftCommonCrypto", - "repositoryURL": "https://github.com/iosdevzone/IDZSwiftCommonCrypto", - "state": { - "branch": null, - "revision": "d824371e670bd57eb456bbc41139b4997f7207b8", - "version": "0.13.1" - } - }, - { - "package": "MailCore", - "repositoryURL": "https://github.com/FlowCrypt/mailcore2", - "state": { - "branch": null, - "revision": "512e3074f7b80a4425be806e3ce968f1e84b995f", - "version": "0.7.5" - } - }, - { - "package": "MBProgressHUD", - "repositoryURL": "https://github.com/jdg/MBProgressHUD", - "state": { - "branch": null, - "revision": "bca42b801100b2b3a4eda0ba8dd33d858c780b0d", - "version": "1.2.0" - } - }, - { - "package": "Realm", - "repositoryURL": "https://github.com/realm/realm-cocoa", - "state": { - "branch": null, - "revision": "f9400ca044844701ea32491a4c6c4b06d74ab24d", - "version": "10.25.0" - } - }, - { - "package": "RealmDatabase", - "repositoryURL": "https://github.com/realm/realm-core", - "state": { - "branch": null, - "revision": "3c78cccdc0d9f967c5c15b7f3ea081814e2b3ef2", - "version": "11.13.0" - } - }, - { - "package": "Toast", - "repositoryURL": "https://github.com/scalessec/Toast-Swift", - "state": { - "branch": null, - "revision": "0c9493eeacb102cc614da385cfaaf475379f4ab4", - "version": "5.0.1" - } - }, { "identity" : "bigint", "kind" : "remoteSourceControl", From 8e309d6f68f8ea6c3388622bd6568c6cf0310daf Mon Sep 17 00:00:00 2001 From: tomholub Date: Sat, 9 Apr 2022 19:42:36 +0200 Subject: [PATCH 09/10] try revert to swiftpm v1 as on master --- .../xcshareddata/swiftpm/Package.resolved | 222 +++++++++--------- 1 file changed, 112 insertions(+), 110 deletions(-) diff --git a/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved b/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved index 523857579..40d3c5b44 100644 --- a/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,113 +1,115 @@ { - "pins": [ - { - "identity" : "appauth-ios", - "kind" : "remoteSourceControl", - "location" : "https://github.com/openid/AppAuth-iOS.git", - "state" : { - "revision" : "33660c271c961f8ce1084cc13f2ea8195e864f7d", - "version" : "1.5.0" + "object": { + "pins": [ + { + "package": "AppAuth", + "repositoryURL": "https://github.com/openid/AppAuth-iOS.git", + "state": { + "branch": null, + "revision": "01131d68346c8ae552961c768d583c715fbe1410", + "version": "1.4.0" + } + }, + { + "package": "BigInt", + "repositoryURL": "https://github.com/attaswift/BigInt", + "state": { + "branch": null, + "revision": "0ed110f7555c34ff468e72e1686e59721f2b0da6", + "version": "5.3.0" + } + }, + { + "package": "GoogleAPIClientForREST", + "repositoryURL": "https://github.com/google/google-api-objectivec-client-for-rest", + "state": { + "branch": null, + "revision": "22e0bb02729d60db396e8b90d8189313cd86ba53", + "version": "1.6.0" + } + }, + { + "package": "GoogleSignIn", + "repositoryURL": "https://github.com/google/GoogleSignIn-iOS", + "state": { + "branch": null, + "revision": "60ca2bfd218ccb194a746a79b41d9d50eb7e3af0", + "version": "6.1.0" + } + }, + { + "package": "GTMSessionFetcher", + "repositoryURL": "https://github.com/google/gtm-session-fetcher.git", + "state": { + "branch": null, + "revision": "bc6a19702ac76ac4e488b68148710eb815f9bc56", + "version": "1.7.0" + } + }, + { + "package": "GTMAppAuth", + "repositoryURL": "https://github.com/google/GTMAppAuth.git", + "state": { + "branch": null, + "revision": "40f4103fb52109032c05599a0c39ad43edbdf80a", + "version": "1.2.2" + } + }, + { + "package": "IDZSwiftCommonCrypto", + "repositoryURL": "https://github.com/iosdevzone/IDZSwiftCommonCrypto", + "state": { + "branch": null, + "revision": "d824371e670bd57eb456bbc41139b4997f7207b8", + "version": "0.13.1" + } + }, + { + "package": "MailCore", + "repositoryURL": "https://github.com/FlowCrypt/mailcore2", + "state": { + "branch": null, + "revision": "512e3074f7b80a4425be806e3ce968f1e84b995f", + "version": "0.7.5" + } + }, + { + "package": "MBProgressHUD", + "repositoryURL": "https://github.com/jdg/MBProgressHUD", + "state": { + "branch": null, + "revision": "bca42b801100b2b3a4eda0ba8dd33d858c780b0d", + "version": "1.2.0" + } + }, + { + "package": "Realm", + "repositoryURL": "https://github.com/realm/realm-cocoa", + "state": { + "branch": null, + "revision": "f9400ca044844701ea32491a4c6c4b06d74ab24d", + "version": "10.25.0" + } + }, + { + "package": "RealmDatabase", + "repositoryURL": "https://github.com/realm/realm-core", + "state": { + "branch": null, + "revision": "3c78cccdc0d9f967c5c15b7f3ea081814e2b3ef2", + "version": "11.13.0" + } + }, + { + "package": "Toast", + "repositoryURL": "https://github.com/scalessec/Toast-Swift", + "state": { + "branch": null, + "revision": "0c9493eeacb102cc614da385cfaaf475379f4ab4", + "version": "5.0.1" + } } - }, - { - "identity" : "bigint", - "kind" : "remoteSourceControl", - "location" : "https://github.com/attaswift/BigInt", - "state" : { - "revision" : "0ed110f7555c34ff468e72e1686e59721f2b0da6", - "version" : "5.3.0" - } - }, - { - "identity" : "google-api-objectivec-client-for-rest", - "kind" : "remoteSourceControl", - "location" : "https://github.com/google/google-api-objectivec-client-for-rest", - "state" : { - "revision" : "3228334d0584cb9174796fecbe628a723be70452", - "version" : "1.7.0" - } - }, - { - "identity" : "googlesignin-ios", - "kind" : "remoteSourceControl", - "location" : "https://github.com/google/GoogleSignIn-iOS", - "state" : { - "revision" : "60ca2bfd218ccb194a746a79b41d9d50eb7e3af0", - "version" : "6.1.0" - } - }, - { - "identity" : "gtm-session-fetcher", - "kind" : "remoteSourceControl", - "location" : "https://github.com/google/gtm-session-fetcher.git", - "state" : { - "revision" : "eca9404a18f53727e4698211aaf2615eb93b962a", - "version" : "1.7.1" - } - }, - { - "identity" : "gtmappauth", - "kind" : "remoteSourceControl", - "location" : "https://github.com/google/GTMAppAuth.git", - "state" : { - "revision" : "e803d09da0147fbf1bbb30e126c47ff43254e057", - "version" : "1.2.3" - } - }, - { - "identity" : "idzswiftcommoncrypto", - "kind" : "remoteSourceControl", - "location" : "https://github.com/iosdevzone/IDZSwiftCommonCrypto", - "state" : { - "revision" : "d824371e670bd57eb456bbc41139b4997f7207b8", - "version" : "0.13.1" - } - }, - { - "identity" : "mailcore2", - "kind" : "remoteSourceControl", - "location" : "https://github.com/FlowCrypt/mailcore2", - "state" : { - "revision" : "512e3074f7b80a4425be806e3ce968f1e84b995f", - "version" : "0.7.5" - } - }, - { - "identity" : "mbprogresshud", - "kind" : "remoteSourceControl", - "location" : "https://github.com/jdg/MBProgressHUD", - "state" : { - "revision" : "bca42b801100b2b3a4eda0ba8dd33d858c780b0d", - "version" : "1.2.0" - } - }, - { - "identity" : "realm-cocoa", - "kind" : "remoteSourceControl", - "location" : "https://github.com/realm/realm-cocoa", - "state" : { - "revision" : "f9400ca044844701ea32491a4c6c4b06d74ab24d", - "version" : "10.25.0" - } - }, - { - "identity" : "realm-core", - "kind" : "remoteSourceControl", - "location" : "https://github.com/realm/realm-core", - "state" : { - "revision" : "3c78cccdc0d9f967c5c15b7f3ea081814e2b3ef2", - "version" : "11.13.0" - } - }, - { - "identity" : "toast-swift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/scalessec/Toast-Swift", - "state" : { - "revision" : "0c9493eeacb102cc614da385cfaaf475379f4ab4", - "version" : "5.0.1" - } - } - ], - "version" : 2 + ] + }, + "version": 1 } From 3cfc52355e0d8e58d46da4ea116f3c39f8bee518 Mon Sep 17 00:00:00 2001 From: Roma Sosnovsky Date: Sat, 9 Apr 2022 20:57:20 +0300 Subject: [PATCH 10/10] swiftpm update --- .../xcshareddata/swiftpm/Package.resolved | 222 +++++++++--------- appium/tests/helpers/ElementHelper.ts | 4 +- .../RecipientListLabelCheck.spec.ts | 2 +- 3 files changed, 112 insertions(+), 116 deletions(-) diff --git a/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved b/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved index 40d3c5b44..d0e356b20 100644 --- a/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/FlowCrypt.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,115 +1,113 @@ { - "object": { - "pins": [ - { - "package": "AppAuth", - "repositoryURL": "https://github.com/openid/AppAuth-iOS.git", - "state": { - "branch": null, - "revision": "01131d68346c8ae552961c768d583c715fbe1410", - "version": "1.4.0" - } - }, - { - "package": "BigInt", - "repositoryURL": "https://github.com/attaswift/BigInt", - "state": { - "branch": null, - "revision": "0ed110f7555c34ff468e72e1686e59721f2b0da6", - "version": "5.3.0" - } - }, - { - "package": "GoogleAPIClientForREST", - "repositoryURL": "https://github.com/google/google-api-objectivec-client-for-rest", - "state": { - "branch": null, - "revision": "22e0bb02729d60db396e8b90d8189313cd86ba53", - "version": "1.6.0" - } - }, - { - "package": "GoogleSignIn", - "repositoryURL": "https://github.com/google/GoogleSignIn-iOS", - "state": { - "branch": null, - "revision": "60ca2bfd218ccb194a746a79b41d9d50eb7e3af0", - "version": "6.1.0" - } - }, - { - "package": "GTMSessionFetcher", - "repositoryURL": "https://github.com/google/gtm-session-fetcher.git", - "state": { - "branch": null, - "revision": "bc6a19702ac76ac4e488b68148710eb815f9bc56", - "version": "1.7.0" - } - }, - { - "package": "GTMAppAuth", - "repositoryURL": "https://github.com/google/GTMAppAuth.git", - "state": { - "branch": null, - "revision": "40f4103fb52109032c05599a0c39ad43edbdf80a", - "version": "1.2.2" - } - }, - { - "package": "IDZSwiftCommonCrypto", - "repositoryURL": "https://github.com/iosdevzone/IDZSwiftCommonCrypto", - "state": { - "branch": null, - "revision": "d824371e670bd57eb456bbc41139b4997f7207b8", - "version": "0.13.1" - } - }, - { - "package": "MailCore", - "repositoryURL": "https://github.com/FlowCrypt/mailcore2", - "state": { - "branch": null, - "revision": "512e3074f7b80a4425be806e3ce968f1e84b995f", - "version": "0.7.5" - } - }, - { - "package": "MBProgressHUD", - "repositoryURL": "https://github.com/jdg/MBProgressHUD", - "state": { - "branch": null, - "revision": "bca42b801100b2b3a4eda0ba8dd33d858c780b0d", - "version": "1.2.0" - } - }, - { - "package": "Realm", - "repositoryURL": "https://github.com/realm/realm-cocoa", - "state": { - "branch": null, - "revision": "f9400ca044844701ea32491a4c6c4b06d74ab24d", - "version": "10.25.0" - } - }, - { - "package": "RealmDatabase", - "repositoryURL": "https://github.com/realm/realm-core", - "state": { - "branch": null, - "revision": "3c78cccdc0d9f967c5c15b7f3ea081814e2b3ef2", - "version": "11.13.0" - } - }, - { - "package": "Toast", - "repositoryURL": "https://github.com/scalessec/Toast-Swift", - "state": { - "branch": null, - "revision": "0c9493eeacb102cc614da385cfaaf475379f4ab4", - "version": "5.0.1" - } + "pins" : [ + { + "identity" : "appauth-ios", + "kind" : "remoteSourceControl", + "location" : "https://github.com/openid/AppAuth-iOS.git", + "state" : { + "revision" : "33660c271c961f8ce1084cc13f2ea8195e864f7d", + "version" : "1.5.0" } - ] - }, - "version": 1 + }, + { + "identity" : "bigint", + "kind" : "remoteSourceControl", + "location" : "https://github.com/attaswift/BigInt", + "state" : { + "revision" : "0ed110f7555c34ff468e72e1686e59721f2b0da6", + "version" : "5.3.0" + } + }, + { + "identity" : "google-api-objectivec-client-for-rest", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/google-api-objectivec-client-for-rest", + "state" : { + "revision" : "3228334d0584cb9174796fecbe628a723be70452", + "version" : "1.7.0" + } + }, + { + "identity" : "googlesignin-ios", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/GoogleSignIn-iOS", + "state" : { + "revision" : "60ca2bfd218ccb194a746a79b41d9d50eb7e3af0", + "version" : "6.1.0" + } + }, + { + "identity" : "gtm-session-fetcher", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/gtm-session-fetcher.git", + "state" : { + "revision" : "eca9404a18f53727e4698211aaf2615eb93b962a", + "version" : "1.7.1" + } + }, + { + "identity" : "gtmappauth", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/GTMAppAuth.git", + "state" : { + "revision" : "e803d09da0147fbf1bbb30e126c47ff43254e057", + "version" : "1.2.3" + } + }, + { + "identity" : "idzswiftcommoncrypto", + "kind" : "remoteSourceControl", + "location" : "https://github.com/iosdevzone/IDZSwiftCommonCrypto", + "state" : { + "revision" : "d824371e670bd57eb456bbc41139b4997f7207b8", + "version" : "0.13.1" + } + }, + { + "identity" : "mailcore2", + "kind" : "remoteSourceControl", + "location" : "https://github.com/FlowCrypt/mailcore2", + "state" : { + "revision" : "512e3074f7b80a4425be806e3ce968f1e84b995f", + "version" : "0.7.5" + } + }, + { + "identity" : "mbprogresshud", + "kind" : "remoteSourceControl", + "location" : "https://github.com/jdg/MBProgressHUD", + "state" : { + "revision" : "bca42b801100b2b3a4eda0ba8dd33d858c780b0d", + "version" : "1.2.0" + } + }, + { + "identity" : "realm-cocoa", + "kind" : "remoteSourceControl", + "location" : "https://github.com/realm/realm-cocoa", + "state" : { + "revision" : "f9400ca044844701ea32491a4c6c4b06d74ab24d", + "version" : "10.25.0" + } + }, + { + "identity" : "realm-core", + "kind" : "remoteSourceControl", + "location" : "https://github.com/realm/realm-core", + "state" : { + "revision" : "3c78cccdc0d9f967c5c15b7f3ea081814e2b3ef2", + "version" : "11.13.0" + } + }, + { + "identity" : "toast-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/scalessec/Toast-Swift", + "state" : { + "revision" : "0c9493eeacb102cc614da385cfaaf475379f4ab4", + "version" : "5.0.1" + } + } + ], + "version" : 2 } diff --git a/appium/tests/helpers/ElementHelper.ts b/appium/tests/helpers/ElementHelper.ts index 8c8723df9..78b5e3918 100644 --- a/appium/tests/helpers/ElementHelper.ts +++ b/appium/tests/helpers/ElementHelper.ts @@ -41,9 +41,7 @@ class ElementHelper { static checkStaticText = async (element: WebdriverIO.Element, label: string) => { await this.waitElementVisible(element); - await browser.waitUntil( - async () => (await element.getText()) === label - ); + await this.waitForText(element, label); } static doubleClick = async (element: WebdriverIO.Element) => { diff --git a/appium/tests/specs/live/composeEmail/RecipientListLabelCheck.spec.ts b/appium/tests/specs/live/composeEmail/RecipientListLabelCheck.spec.ts index 27996b313..fc5139cee 100644 --- a/appium/tests/specs/live/composeEmail/RecipientListLabelCheck.spec.ts +++ b/appium/tests/specs/live/composeEmail/RecipientListLabelCheck.spec.ts @@ -10,7 +10,7 @@ import { CommonData } from '../../../data'; describe('COMPOSE EMAIL: ', () => { - it('should toggle recipient list label and show correct email addresses ', async () => { + it('should toggle recipient list label and show correct email addresses', async () => { const recipientEmail = CommonData.recipient.email; const recipientName = CommonData.recipient.name;