Skip to content

Commit

Permalink
Metadata updates
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisballinger committed Apr 23, 2019
1 parent 105b7fd commit dedf40e
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 72 deletions.
71 changes: 35 additions & 36 deletions ChatSecureUITests/ChatSecureUITests.swift
Expand Up @@ -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
Expand All @@ -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")
}

}
12 changes: 6 additions & 6 deletions Gemfile.lock
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Submodules/ChatSecure-Metadata
17 changes: 7 additions & 10 deletions fastlane/Deliverfile
Expand Up @@ -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
Expand All @@ -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
",
})

Expand Down
10 changes: 6 additions & 4 deletions fastlane/Snapfile
Expand Up @@ -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",
Expand Down
48 changes: 33 additions & 15 deletions fastlane/SnapshotHelper.swift
Expand Up @@ -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) {
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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")
Expand All @@ -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)
}
Expand Down Expand Up @@ -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 }
Expand All @@ -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]

0 comments on commit dedf40e

Please sign in to comment.