From dedf40e5256ceefd460f02e45c4a02b512d328c8 Mon Sep 17 00:00:00 2001 From: Chris Ballinger Date: Mon, 22 Apr 2019 19:18:20 -0700 Subject: [PATCH] Metadata updates --- ChatSecureUITests/ChatSecureUITests.swift | 71 +++++++++++------------ Gemfile.lock | 12 ++-- Submodules/ChatSecure-Metadata | 2 +- fastlane/Deliverfile | 17 +++--- fastlane/Snapfile | 10 ++-- fastlane/SnapshotHelper.swift | 48 ++++++++++----- 6 files changed, 88 insertions(+), 72 deletions(-) diff --git a/ChatSecureUITests/ChatSecureUITests.swift b/ChatSecureUITests/ChatSecureUITests.swift index 4ae75dac0..475af8cce 100644 --- a/ChatSecureUITests/ChatSecureUITests.swift +++ b/ChatSecureUITests/ChatSecureUITests.swift @@ -74,10 +74,18 @@ class ChatSecureUITests: XCTestCase { app.launch() skipEnablePush(app) skipDonatePrompt(app) - XCTAssertTrue(app.buttons[localizedString("Skip")].exists, "Skip button exists") - XCTAssertTrue(app.buttons[localizedString("Create New Account")].exists, "Create new Account button exists") - XCTAssertTrue(app.buttons[localizedString("Add Existing Account")].exists, "Add existing account button exists") + if app.buttons[localizedString("Skip")].exists { + XCTAssertTrue(app.buttons[localizedString("Skip")].exists, "Skip button exists") + XCTAssertTrue(app.buttons[localizedString("Create New Account")].exists, "Create new Account button exists") + XCTAssertTrue(app.buttons[localizedString("Add Existing Account")].exists, "Add existing account button exists") + } else { + let chatsNavigationBar = app.navigationBars[localizedString("Chats")] + chatsNavigationBar.buttons[localizedString("Chats")].tap() + chatsNavigationBar.children(matching: .button).element(boundBy: 1).tap() + app.tables["settingsTableView"].staticTexts[localizedString("New Account")].tap() + app.buttons[localizedString("Create New Account")].tap() + } app.buttons[localizedString("Create New Account")].tap() let tablesQuery = app.tables @@ -88,42 +96,33 @@ class ChatSecureUITests: XCTestCase { tablesQuery.switches[localizedString("Show Advanced Options")].tap() - tablesQuery.switches[localizedString("Enable Tor")].tap() snapshot("01CreateAccountScreen") } -// func testConversationList() { -// let app = XCUIApplication() -// app.launchEnvironment["OTRLaunchMode"] = "ChatSecureUITestsDemoData" -// app.launch() -// skipEnablePush(app) -// -// switch UIDevice.current.userInterfaceIdiom { -// case .phone: -// snapshot("02ConversationListScreen") -// break -// case .pad: -// break -// default: -// break -// } -// sleep(2) -// skipEnablePush(app) -// XCUIApplication().tables["conversationTableView"].children(matching: .any).element(boundBy: 0).tap() -// snapshot("03ChatScreen") -// XCUIApplication().buttons["profileButton"].tap() -// snapshot("04ProfileScreen") -// -//// app.navigationBars["Profile"].buttons["Done"].tap() -//// -//// let chatsNavigationBar = app.navigationBars["Chats"] -//// chatsNavigationBar.buttons["Chats"].tap() -//// chatsNavigationBar.childrenMatchingType(.Button).elementBoundByIndex(1).tap() -//// app.tables["settingsTableView"].staticTexts["New Account"].tap() -//// app.buttons["Create New Account"].tap() -// -// } -// + func testConversationList() { + let app = XCUIApplication() + app.launchEnvironment["OTRLaunchMode"] = "ChatSecureUITestsDemoData" + app.launch() + skipEnablePush(app) + skipDonatePrompt(app) + + switch UIDevice.current.userInterfaceIdiom { + case .phone: + snapshot("02ConversationListScreen") + break + case .pad: + break + default: + break + } + sleep(2) + skipEnablePush(app) + XCUIApplication().tables["conversationTableView"].children(matching: .any).element(boundBy: 0).tap() + snapshot("03ChatScreen") + XCUIApplication().buttons["profileButton"].tap() + snapshot("04ProfileScreen") + } + } diff --git a/Gemfile.lock b/Gemfile.lock index a5ba3d66d..1556d6b73 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -35,7 +35,7 @@ GEM activesupport (>= 4.0.2, < 6) fuzzy_match (~> 2.0.4) nap (~> 1.0) - cocoapods-deintegrate (1.0.3) + cocoapods-deintegrate (1.0.4) cocoapods-downloader (1.2.2) cocoapods-plugins (1.0.0) nap @@ -58,7 +58,7 @@ GEM dotenv (2.7.2) emoji_regex (1.0.1) escape (0.0.4) - excon (0.62.0) + excon (0.64.0) faraday (0.15.4) multipart-post (>= 1.2, < 3) faraday-cookie_jar (0.0.6) @@ -67,7 +67,7 @@ GEM faraday_middleware (0.13.1) faraday (>= 0.7.4, < 1.0) fastimage (2.1.5) - fastlane (2.119.0) + fastlane (2.120.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.3, < 3.0.0) babosa (>= 1.0.2, < 2.0.0) @@ -142,7 +142,7 @@ GEM memoist (0.16.0) mime-types (3.2.2) mime-types-data (~> 3.2015) - mime-types-data (3.2018.0812) + mime-types-data (3.2019.0331) mini_magick (4.5.1) minitest (5.11.3) molinillo (0.6.6) @@ -187,10 +187,10 @@ GEM uber (0.1.0) unf (0.1.4) unf_ext - unf_ext (0.0.7.5) + unf_ext (0.0.7.6) unicode-display_width (1.5.0) word_wrap (1.0.0) - xcodeproj (1.8.1) + xcodeproj (1.8.2) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) diff --git a/Submodules/ChatSecure-Metadata b/Submodules/ChatSecure-Metadata index a3c1344f6..28dc1164d 160000 --- a/Submodules/ChatSecure-Metadata +++ b/Submodules/ChatSecure-Metadata @@ -1 +1 @@ -Subproject commit a3c1344f6c9743ed26a7cc0f082516f1e02b1324 +Subproject commit 28dc1164def7a5dfc3852e59f48ab35821397063 diff --git a/fastlane/Deliverfile b/fastlane/Deliverfile index 6f5598472..8af766e94 100644 --- a/fastlane/Deliverfile +++ b/fastlane/Deliverfile @@ -17,7 +17,7 @@ # beta_ipa "./app.ipa" # The version of your app - remove this if you provide an ipa file -app_version "4.3.6" +app_version "4.3.7" submit_for_review false skip_binary_upload true # overwrite_screenshots true @@ -28,15 +28,12 @@ metadata_path "./Submodules/ChatSecure-Metadata/metadata" screenshots_path "./Submodules/ChatSecure-Metadata/screenshots" release_notes({ - 'default' => "v4.3.6: -* Fix security issue in certificate pinning alert dialog, where any valid certificate would show as valid -* Fix crash when rapidly scrolling through chat history -* Fix issue where chat history is temporarily blank after sending a message -* Swift 4.2 / Xcode 10.1 -* Updated 3rd party dependencies -* Other minor bug fixes - -Changelog: https://github.com/chatsecure/chatsecure-ios/compare/v4.3.5...v4.3.6 + 'default' => "v4.3.7: +* Swift 5.0 / Xcode 10.2 +* Updated translations +* Minor bug fixes + +Changelog: https://github.com/chatsecure/chatsecure-ios/compare/v4.3.6...v4.3.7 ", }) diff --git a/fastlane/Snapfile b/fastlane/Snapfile index a2445aea9..cccef402a 100644 --- a/fastlane/Snapfile +++ b/fastlane/Snapfile @@ -4,15 +4,17 @@ devices([ # "iPhone 8", # "iPhone 8 Plus", - "iPhone SE", + # "iPhone SE", + "iPhone Xs Max", # "iPhone X", # "iPad Pro (12.9-inch)", # "iPad Pro (9.7-inch)", + "iPad Pro (12.9-inch) (3rd generation)", ]) -languages([ - "it", #{}"nl-NL", "pt-BR", "pt-PT", "tr", -]) +# languages([ +# "it", #{}"nl-NL", "pt-BR", "pt-PT", "tr", +# ]) # languages([ # "da", "el", "es-ES", "it", "nl-NL", "pt-BR", "pt-PT", "tr", diff --git a/fastlane/SnapshotHelper.swift b/fastlane/SnapshotHelper.swift index 34195af0b..77c5f2ede 100644 --- a/fastlane/SnapshotHelper.swift +++ b/fastlane/SnapshotHelper.swift @@ -18,8 +18,8 @@ import XCTest var deviceLanguage = "" var locale = "" -func setupSnapshot(_ app: XCUIApplication) { - Snapshot.setupSnapshot(app) +func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) { + Snapshot.setupSnapshot(app, waitForAnimations: waitForAnimations) } func snapshot(_ name: String, waitForLoadingIndicator: Bool) { @@ -63,14 +63,16 @@ enum SnapshotError: Error, CustomDebugStringConvertible { @objcMembers open class Snapshot: NSObject { static var app: XCUIApplication? + static var waitForAnimations = true static var cacheDirectory: URL? static var screenshotsDirectory: URL? { return cacheDirectory?.appendingPathComponent("screenshots", isDirectory: true) } - open class func setupSnapshot(_ app: XCUIApplication) { + open class func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) { Snapshot.app = app + Snapshot.waitForAnimations = waitForAnimations do { let cacheDir = try pathPrefix() @@ -114,10 +116,14 @@ open class Snapshot: NSObject { } catch { print("Couldn't detect/set locale...") } - if locale.isEmpty { + + if locale.isEmpty && !deviceLanguage.isEmpty { locale = Locale(identifier: deviceLanguage).identifier } - app.launchArguments += ["-AppleLocale", "\"\(locale)\""] + + if !locale.isEmpty { + app.launchArguments += ["-AppleLocale", "\"\(locale)\""] + } } class func setLaunchArguments(_ app: XCUIApplication) { @@ -149,22 +155,25 @@ open class Snapshot: NSObject { print("snapshot: \(name)") // more information about this, check out https://docs.fastlane.tools/actions/snapshot/#how-does-it-work - sleep(1) // Waiting for the animation to be finished (kind of) + if Snapshot.waitForAnimations { + sleep(1) // Waiting for the animation to be finished (kind of) + } #if os(OSX) - XCUIApplication().typeKey(XCUIKeyboardKeySecondaryFn, modifierFlags: []) - #else - guard let app = self.app else { print("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") return } + + app.typeKey(XCUIKeyboardKeySecondaryFn, modifierFlags: []) + #else - guard let window = app.windows.allElementsBoundByIndex.first(where: { $0.frame.isEmpty == false }) else { - print("Couldn't find an element window in XCUIApplication with a non-empty frame.") + guard let app = self.app else { + print("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") return } - + + let window = app.windows.firstMatch let screenshot = window.screenshot() guard let simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return } let path = screenshotsDir.appendingPathComponent("\(simulator)-\(name).png") @@ -182,7 +191,12 @@ open class Snapshot: NSObject { return #endif - let networkLoadingIndicator = XCUIApplication().otherElements.deviceStatusBars.networkLoadingIndicators.element + guard let app = self.app else { + print("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + let networkLoadingIndicator = app.otherElements.deviceStatusBars.networkLoadingIndicators.element let networkLoadingIndicatorDisappeared = XCTNSPredicateExpectation(predicate: NSPredicate(format: "exists == false"), object: networkLoadingIndicator) _ = XCTWaiter.wait(for: [networkLoadingIndicatorDisappeared], timeout: timeout) } @@ -257,7 +271,11 @@ private extension XCUIElementQuery { } var deviceStatusBars: XCUIElementQuery { - let deviceWidth = XCUIApplication().frame.width + guard let app = Snapshot.app else { + fatalError("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + } + + let deviceWidth = app.windows.firstMatch.frame.width let isStatusBar = NSPredicate { (evaluatedObject, _) in guard let element = evaluatedObject as? XCUIElementAttributes else { return false } @@ -277,4 +295,4 @@ private extension CGFloat { // Please don't remove the lines below // They are used to detect outdated configuration files -// SnapshotHelperVersion [1.10] +// SnapshotHelperVersion [1.15]