summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2022-12-21 10:32:36 +0100
committerAndrej Mihajlov <and@mullvad.net>2022-12-21 10:32:36 +0100
commit11a1c3a04c3a084100979cfa0198a10c5baaf072 (patch)
tree1e9f3e31b69ff00c7e51197906d4a22a4b85d5e5
parentb78cf942bdf80d168ca1d6c37494c57de76b1381 (diff)
parent3a538acad95d329cb84b03863527146b78f0cc76 (diff)
downloadmullvadvpn-11a1c3a04c3a084100979cfa0198a10c5baaf072.tar.xz
mullvadvpn-11a1c3a04c3a084100979cfa0198a10c5baaf072.zip
Merge branch 'fix-screenshots'
-rw-r--r--ios/Gemfile2
-rw-r--r--ios/Gemfile.lock74
-rw-r--r--ios/MullvadVPN/AccountContentView.swift1
-rw-r--r--ios/MullvadVPN/ConnectViewController.swift17
-rw-r--r--ios/MullvadVPN/PreferencesDataSource.swift37
-rw-r--r--ios/MullvadVPN/SettingsDataSource.swift10
-rw-r--r--ios/MullvadVPNScreenshots/MullvadVPNScreenshots.swift26
-rw-r--r--ios/MullvadVPNScreenshots/SnapshotHelper.swift4
-rw-r--r--ios/Snapfile3
9 files changed, 108 insertions, 66 deletions
diff --git a/ios/Gemfile b/ios/Gemfile
index 13ca76b4a1..4f2f71294e 100644
--- a/ios/Gemfile
+++ b/ios/Gemfile
@@ -1,3 +1,3 @@
source "https://rubygems.org"
-gem "fastlane", "~> 2.206.2"
+gem "fastlane", "~> 2.211.0"
diff --git a/ios/Gemfile.lock b/ios/Gemfile.lock
index a7a9d853e7..d205e03c44 100644
--- a/ios/Gemfile.lock
+++ b/ios/Gemfile.lock
@@ -3,25 +3,25 @@ GEM
specs:
CFPropertyList (3.0.5)
rexml
- addressable (2.8.0)
- public_suffix (>= 2.0.2, < 5.0)
+ addressable (2.8.1)
+ public_suffix (>= 2.0.2, < 6.0)
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
- aws-partitions (1.598.0)
- aws-sdk-core (3.131.1)
+ aws-partitions (1.680.0)
+ aws-sdk-core (3.168.4)
aws-eventstream (~> 1, >= 1.0.2)
- aws-partitions (~> 1, >= 1.525.0)
- aws-sigv4 (~> 1.1)
+ aws-partitions (~> 1, >= 1.651.0)
+ aws-sigv4 (~> 1.5)
jmespath (~> 1, >= 1.6.1)
- aws-sdk-kms (1.57.0)
- aws-sdk-core (~> 3, >= 3.127.0)
+ aws-sdk-kms (1.61.0)
+ aws-sdk-core (~> 3, >= 3.165.0)
aws-sigv4 (~> 1.1)
- aws-sdk-s3 (1.114.0)
- aws-sdk-core (~> 3, >= 3.127.0)
+ aws-sdk-s3 (1.117.2)
+ aws-sdk-core (~> 3, >= 3.165.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
- aws-sigv4 (1.5.0)
+ aws-sigv4 (1.5.2)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
claide (1.1.0)
@@ -34,10 +34,10 @@ GEM
rake (>= 12.0.0, < 14.0.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
- dotenv (2.7.6)
+ dotenv (2.8.1)
emoji_regex (3.2.3)
- excon (0.92.3)
- faraday (1.10.0)
+ excon (0.95.0)
+ faraday (1.10.2)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
@@ -66,7 +66,7 @@ GEM
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.2.6)
- fastlane (2.206.2)
+ fastlane (2.211.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
@@ -106,9 +106,9 @@ GEM
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
gh_inspector (1.1.3)
- google-apis-androidpublisher_v3 (0.22.0)
- google-apis-core (>= 0.5, < 2.a)
- google-apis-core (0.5.0)
+ google-apis-androidpublisher_v3 (0.32.0)
+ google-apis-core (>= 0.9.1, < 2.a)
+ google-apis-core (0.9.2)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.16.2, < 2.a)
httpclient (>= 2.8.1, < 3.a)
@@ -117,27 +117,27 @@ GEM
retriable (>= 2.0, < 4.a)
rexml
webrick
- google-apis-iamcredentials_v1 (0.11.0)
- google-apis-core (>= 0.5, < 2.a)
- google-apis-playcustomapp_v1 (0.8.0)
- google-apis-core (>= 0.5, < 2.a)
- google-apis-storage_v1 (0.15.0)
- google-apis-core (>= 0.5, < 2.a)
+ google-apis-iamcredentials_v1 (0.16.0)
+ google-apis-core (>= 0.9.1, < 2.a)
+ google-apis-playcustomapp_v1 (0.12.0)
+ google-apis-core (>= 0.9.1, < 2.a)
+ google-apis-storage_v1 (0.19.0)
+ google-apis-core (>= 0.9.0, < 2.a)
google-cloud-core (1.6.0)
google-cloud-env (~> 1.0)
google-cloud-errors (~> 1.0)
google-cloud-env (1.6.0)
faraday (>= 0.17.3, < 3.0)
- google-cloud-errors (1.2.0)
- google-cloud-storage (1.36.2)
+ google-cloud-errors (1.3.0)
+ google-cloud-storage (1.44.0)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-apis-iamcredentials_v1 (~> 0.1)
- google-apis-storage_v1 (~> 0.1)
+ google-apis-storage_v1 (~> 0.19.0)
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
- googleauth (1.1.3)
+ googleauth (1.3.0)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
@@ -148,11 +148,11 @@ GEM
http-cookie (1.0.5)
domain_name (~> 0.5)
httpclient (2.8.3)
- jmespath (1.6.1)
- json (2.6.2)
- jwt (2.4.1)
+ jmespath (1.6.2)
+ json (2.6.3)
+ jwt (2.5.0)
memoist (0.16.2)
- mini_magick (4.11.0)
+ mini_magick (4.12.0)
mini_mime (1.1.2)
multi_json (1.15.0)
multipart-post (2.0.0)
@@ -161,7 +161,7 @@ GEM
optparse (0.1.1)
os (1.1.4)
plist (3.6.0)
- public_suffix (4.0.7)
+ public_suffix (5.0.1)
rake (13.0.6)
representable (3.2.0)
declarative (< 0.1.0)
@@ -173,9 +173,9 @@ GEM
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
security (0.1.3)
- signet (0.16.1)
+ signet (0.17.0)
addressable (~> 2.8)
- faraday (>= 0.17.5, < 3.0)
+ faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simctl (1.6.8)
@@ -196,7 +196,7 @@ GEM
unicode-display_width (1.8.0)
webrick (1.7.0)
word_wrap (1.0.0)
- xcodeproj (1.21.0)
+ xcodeproj (1.22.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
@@ -212,7 +212,7 @@ PLATFORMS
ruby
DEPENDENCIES
- fastlane (~> 2.206.2)
+ fastlane (~> 2.211.0)
BUNDLED WITH
1.17.3
diff --git a/ios/MullvadVPN/AccountContentView.swift b/ios/MullvadVPN/AccountContentView.swift
index 13c78226e7..604ba53ed4 100644
--- a/ios/MullvadVPN/AccountContentView.swift
+++ b/ios/MullvadVPN/AccountContentView.swift
@@ -12,6 +12,7 @@ class AccountContentView: UIView {
let purchaseButton: InAppPurchaseButton = {
let button = InAppPurchaseButton()
button.translatesAutoresizingMaskIntoConstraints = false
+ button.accessibilityIdentifier = "PurchaseButton"
return button
}()
diff --git a/ios/MullvadVPN/ConnectViewController.swift b/ios/MullvadVPN/ConnectViewController.swift
index 1e4bb4e99a..f87ef7680a 100644
--- a/ios/MullvadVPN/ConnectViewController.swift
+++ b/ios/MullvadVPN/ConnectViewController.swift
@@ -368,17 +368,16 @@ class ConnectViewController: UIViewController, MKMapViewDelegate, RootContainmen
let markerOffset = locationMarkerOffset()
let region = computeCoordinateRegion(center: coordinate, offset: markerOffset)
- if targetRegion?.isApproximatelyEqualTo(region) ?? false {
+ if let targetRegion = targetRegion, targetRegion.isApproximatelyEqualTo(region) {
if isAnimatingMap {
mapRegionAnimationDidEnd = animationDidEnd
} else {
animationDidEnd?()
}
- return
+ } else {
+ mapRegionAnimationDidEnd = animationDidEnd
+ setMapRegion(region, animated: animated)
}
-
- mapRegionAnimationDidEnd = animationDidEnd
- setMapRegion(region, animated: animated)
}
private func unsetLocation(animated: Bool) {
@@ -390,17 +389,17 @@ class ConnectViewController: UIViewController, MKMapViewDelegate, RootContainmen
mapRegionAnimationDidEnd = nil
- if targetRegion?.isApproximatelyEqualTo(region) ?? false {
+ if let targetRegion = targetRegion, targetRegion.isApproximatelyEqualTo(region) {
return
+ } else {
+ setMapRegion(region, animated: animated)
}
-
- setMapRegion(region, animated: animated)
}
private func setMapRegion(_ region: MKCoordinateRegion, animated: Bool) {
- contentView.mapView.setRegion(region, animated: animated)
isAnimatingMap = true
targetRegion = region
+ contentView.mapView.setRegion(region, animated: animated)
}
private func addNotificationController() {
diff --git a/ios/MullvadVPN/PreferencesDataSource.swift b/ios/MullvadVPN/PreferencesDataSource.swift
index 4f39ad1403..80200a88de 100644
--- a/ios/MullvadVPN/PreferencesDataSource.swift
+++ b/ios/MullvadVPN/PreferencesDataSource.swift
@@ -40,7 +40,7 @@ class PreferencesDataSource: NSObject, UITableViewDataSource, UITableViewDelegat
}
}
- private enum Section: Hashable {
+ private enum Section: String, Hashable {
case mullvadDNS
case customDNS
}
@@ -55,6 +55,27 @@ class PreferencesDataSource: NSObject, UITableViewDataSource, UITableViewDelegat
case addDNSServer
case dnsServer(_ uniqueID: UUID)
+ var accessibilityIdentifier: String {
+ switch self {
+ case .blockAdvertising:
+ return "blockAdvertising"
+ case .blockTracking:
+ return "blockTracking"
+ case .blockMalware:
+ return "blockMalware"
+ case .blockGambling:
+ return "blockGambling"
+ case .blockAdultContent:
+ return "blockAdultContent"
+ case .useCustomDNS:
+ return "useCustomDNS"
+ case .addDNSServer:
+ return "addDNSServer"
+ case let .dnsServer(uuid):
+ return "dnsServer(\(uuid.uuidString))"
+ }
+ }
+
static func isDNSServerItem(_ item: Item) -> Bool {
if case .dnsServer = item {
return true
@@ -156,8 +177,12 @@ class PreferencesDataSource: NSObject, UITableViewDataSource, UITableViewDelegat
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let item = snapshot.itemForIndexPath(indexPath)!
+ let cell = dequeueCellForItem(item, in: tableView, at: indexPath)
+
+ let section = snapshot.section(at: indexPath.section)!
+ cell.accessibilityIdentifier = "\(section.rawValue).\(item.accessibilityIdentifier)"
- return dequeueCellForItem(item, in: tableView, at: indexPath)
+ return cell
}
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
@@ -228,11 +253,9 @@ class PreferencesDataSource: NSObject, UITableViewDataSource, UITableViewDelegat
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
- return tableView
- .dequeueReusableHeaderFooterView(
- withIdentifier: HeaderFooterReuseIdentifiers.spacer
- .rawValue
- )
+ return tableView.dequeueReusableHeaderFooterView(
+ withIdentifier: HeaderFooterReuseIdentifiers.spacer.rawValue
+ )
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
diff --git a/ios/MullvadVPN/SettingsDataSource.swift b/ios/MullvadVPN/SettingsDataSource.swift
index e2510baf20..15027f8ae4 100644
--- a/ios/MullvadVPN/SettingsDataSource.swift
+++ b/ios/MullvadVPN/SettingsDataSource.swift
@@ -152,7 +152,7 @@ final class SettingsDataSource: NSObject, UITableViewDataSource, UITableViewDele
comment: ""
)
cell.detailTitleLabel.text = nil
- cell.accessibilityIdentifier = nil
+ cell.accessibilityIdentifier = "PreferencesCell"
cell.disclosureType = .chevron
return cell
@@ -227,11 +227,9 @@ final class SettingsDataSource: NSObject, UITableViewDataSource, UITableViewDele
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
- return tableView
- .dequeueReusableHeaderFooterView(
- withIdentifier: HeaderFooterReuseIdentifier.spacer
- .rawValue
- )
+ return tableView.dequeueReusableHeaderFooterView(
+ withIdentifier: HeaderFooterReuseIdentifier.spacer.rawValue
+ )
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
diff --git a/ios/MullvadVPNScreenshots/MullvadVPNScreenshots.swift b/ios/MullvadVPNScreenshots/MullvadVPNScreenshots.swift
index ea72413456..6fe7ead758 100644
--- a/ios/MullvadVPNScreenshots/MullvadVPNScreenshots.swift
+++ b/ios/MullvadVPNScreenshots/MullvadVPNScreenshots.swift
@@ -89,11 +89,18 @@ class MullvadVPNScreenshots: XCTestCase {
// Open Settings
app.buttons["SettingsButton"].tap()
- // Tap on WireGuard key cell
- _ = app.tables.cells["WireGuardKeyCell"].waitForExistence(timeout: 2)
- app.tables.cells["WireGuardKeyCell"].tap()
+ // Tap on preferences cell
+ _ = app.tables.cells["PreferencesCell"].waitForExistence(timeout: 2)
+ app.tables.cells["PreferencesCell"].tap()
- snapshot("WireGuardKeys")
+ app.tables.element
+ .cells
+ .matching(NSPredicate(format: "identifier BEGINSWITH %@", "mullvadDNS"))
+ .switches
+ .matching(NSPredicate(format: "value = %@", "0"))
+ .allElementsBoundByAccessibilityElement
+ .forEach { $0.tap() }
+ snapshot("Preferences")
// Tap back button
app.navigationBars.buttons.firstMatch.tap()
@@ -102,6 +109,17 @@ class MullvadVPNScreenshots: XCTestCase {
_ = app.tables.cells["AccountCell"].waitForExistence(timeout: 2)
app.tables.cells["AccountCell"].tap()
+ // Wait for StoreKit to fetch subscriptions
+ _ = app.buttons["PurchaseButton"].waitForExistence(timeout: 2)
+
+ wait(for: [
+ expectation(
+ for: NSPredicate(format: "isEnabled = YES"),
+ evaluatedWith: app.buttons["PurchaseButton"]
+ ),
+ ], timeout: 10)
+ snapshot("Account")
+
// Hit "Log out" button
_ = app.buttons["LogoutButton"].waitForExistence(timeout: 2)
app.buttons["LogoutButton"].tap()
diff --git a/ios/MullvadVPNScreenshots/SnapshotHelper.swift b/ios/MullvadVPNScreenshots/SnapshotHelper.swift
index 0046aaa683..da063ba1c7 100644
--- a/ios/MullvadVPNScreenshots/SnapshotHelper.swift
+++ b/ios/MullvadVPNScreenshots/SnapshotHelper.swift
@@ -181,7 +181,7 @@ open class Snapshot: NSObject {
let path = screenshotsDir.appendingPathComponent("\(simulator)-\(name).png")
#if swift(<5.0)
- UIImagePNGRepresentation(image)?.write(to: path, options: .atomic)
+ try UIImagePNGRepresentation(image)?.write(to: path, options: .atomic)
#else
try image.pngData()?.write(to: path, options: .atomic)
#endif
@@ -306,4 +306,4 @@ private extension CGFloat {
// Please don't remove the lines below
// They are used to detect outdated configuration files
-// SnapshotHelperVersion [1.28]
+// SnapshotHelperVersion [1.29]
diff --git a/ios/Snapfile b/ios/Snapfile
index 5f046038b0..5633df4fe2 100644
--- a/ios/Snapfile
+++ b/ios/Snapfile
@@ -31,6 +31,9 @@ erase_simulator(true)
# Disable concurrent simulators to prevent too many WireGuard public keys error
concurrent_simulators(false)
+# Stop right away on first error.
+stop_after_first_error(true)
+
# Hide simulator window
headless(true)