From 14e8a47536b4c549a89db6969f8a737db34f73f1 Mon Sep 17 00:00:00 2001 From: Dirk Hermanns Date: Mon, 20 Sep 2021 16:21:59 +0200 Subject: [PATCH] Fixed the UI-Tests. Right now they are running in plain english now. I will have to switch them back to localized UITests afterwards. --- Gemfile.lock | 8 +-- fastlane/screenshots/de-DE/keyword.strings | 2 + fastlane/screenshots/de-DE/title.strings | 2 + fastlane/screenshots/en-US/keyword.strings | 4 +- fastlane/screenshots/en-US/title.strings | 2 + nightguard WatchKit App/Info.plist | 2 +- nightguard WatchKit Extension/Info.plist | 2 +- nightguard.xcodeproj/project.pbxproj | 12 ++--- nightguard/Info.plist | 2 +- nightguardTests/Info.plist | 2 +- nightguardUITests/Info.plist | 2 +- nightguardUITests/NightguardUITests.swift | 63 ++++++++++++++++++---- 12 files changed, 76 insertions(+), 27 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 60861938..77312515 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,7 +7,7 @@ GEM artifactory (3.0.15) atomos (0.1.3) aws-eventstream (1.2.0) - aws-partitions (1.501.0) + aws-partitions (1.503.0) aws-sdk-core (3.121.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) @@ -16,7 +16,7 @@ GEM aws-sdk-kms (1.48.0) aws-sdk-core (~> 3, >= 3.120.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.102.0) + aws-sdk-s3 (1.103.0) aws-sdk-core (~> 3, >= 3.120.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.4) @@ -36,7 +36,7 @@ GEM dotenv (2.7.6) emoji_regex (3.2.2) excon (0.85.0) - faraday (1.7.2) + faraday (1.8.0) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -61,7 +61,7 @@ GEM faraday_middleware (1.1.0) faraday (~> 1.0) fastimage (2.2.5) - fastlane (2.193.1) + fastlane (2.194.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) diff --git a/fastlane/screenshots/de-DE/keyword.strings b/fastlane/screenshots/de-DE/keyword.strings index 33f4ff7e..1008809d 100644 --- a/fastlane/screenshots/de-DE/keyword.strings +++ b/fastlane/screenshots/de-DE/keyword.strings @@ -8,6 +8,8 @@ "care" = "AKTION"; +"duration" = "Dauer"; + "stats" = "STATISTIKEN"; "preferences" = "START"; diff --git a/fastlane/screenshots/de-DE/title.strings b/fastlane/screenshots/de-DE/title.strings index cd1c4637..fdd63620 100644 --- a/fastlane/screenshots/de-DE/title.strings +++ b/fastlane/screenshots/de-DE/title.strings @@ -7,6 +7,8 @@ "care" = "Temporäre Ziele setzen"; +"duration" = "Wechselzeiten im Blick behalten"; + "alarms" = "Mit vielen Optionen"; "stats" = "Vergleiche verschiedene Tage"; diff --git a/fastlane/screenshots/en-US/keyword.strings b/fastlane/screenshots/en-US/keyword.strings index 9d24a0fa..c71b5a3e 100644 --- a/fastlane/screenshots/en-US/keyword.strings +++ b/fastlane/screenshots/en-US/keyword.strings @@ -4,7 +4,9 @@ "fullscreen" = "NIGHTMODE"; -"care" = "CARE" +"care" = "CARE"; + +"duration" = "DURATION"; "alarms" = "ALARMS"; diff --git a/fastlane/screenshots/en-US/title.strings b/fastlane/screenshots/en-US/title.strings index a25d114b..87e55d1b 100644 --- a/fastlane/screenshots/en-US/title.strings +++ b/fastlane/screenshots/en-US/title.strings @@ -7,6 +7,8 @@ "care" = "Set temporary targets"; +"duration" = "Keep track of change durations"; + "alarms" = "Tune all the details"; "stats" = "Compare every single day"; diff --git a/nightguard WatchKit App/Info.plist b/nightguard WatchKit App/Info.plist index 04f49a29..4f9f94a5 100644 --- a/nightguard WatchKit App/Info.plist +++ b/nightguard WatchKit App/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 730 + 732 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait diff --git a/nightguard WatchKit Extension/Info.plist b/nightguard WatchKit Extension/Info.plist index 015fd0ae..92f8c76e 100644 --- a/nightguard WatchKit Extension/Info.plist +++ b/nightguard WatchKit Extension/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 730 + 732 CLKComplicationPrincipalClass $(PRODUCT_MODULE_NAME).ComplicationController CLKComplicationSupportedFamilies diff --git a/nightguard.xcodeproj/project.pbxproj b/nightguard.xcodeproj/project.pbxproj index 80f9a507..06ece913 100644 --- a/nightguard.xcodeproj/project.pbxproj +++ b/nightguard.xcodeproj/project.pbxproj @@ -2101,7 +2101,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 730; + CURRENT_PROJECT_VERSION = 732; DEVELOPMENT_TEAM = BSAVUVP8PV; INFOPLIST_FILE = "nightguard WatchKit Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( @@ -2132,7 +2132,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 730; + CURRENT_PROJECT_VERSION = 732; DEVELOPMENT_TEAM = BSAVUVP8PV; INFOPLIST_FILE = "nightguard WatchKit Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( @@ -2164,7 +2164,7 @@ CODE_SIGN_ENTITLEMENTS = "nightguard WatchKit App/nightguard.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 730; + CURRENT_PROJECT_VERSION = 732; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = BSAVUVP8PV; IBSC_MODULE = scoutwatch_WatchKit_Extension; @@ -2197,7 +2197,7 @@ CODE_SIGN_ENTITLEMENTS = "nightguard WatchKit App/nightguard.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 730; + CURRENT_PROJECT_VERSION = 732; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = BSAVUVP8PV; IBSC_MODULE = scoutwatch_WatchKit_Extension; @@ -2227,7 +2227,7 @@ CODE_SIGN_ENTITLEMENTS = nightguard/scoutwatch.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 730; + CURRENT_PROJECT_VERSION = 732; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = BSAVUVP8PV; ENABLE_BITCODE = NO; @@ -2255,7 +2255,7 @@ CODE_SIGN_ENTITLEMENTS = nightguard/scoutwatch.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 730; + CURRENT_PROJECT_VERSION = 732; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = BSAVUVP8PV; ENABLE_BITCODE = NO; diff --git a/nightguard/Info.plist b/nightguard/Info.plist index 751c372e..2a805cb8 100644 --- a/nightguard/Info.plist +++ b/nightguard/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 730 + 732 ITSAppUsesNonExemptEncryption LSApplicationCategoryType diff --git a/nightguardTests/Info.plist b/nightguardTests/Info.plist index 4fba5f05..83dafa61 100644 --- a/nightguardTests/Info.plist +++ b/nightguardTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 730 + 732 diff --git a/nightguardUITests/Info.plist b/nightguardUITests/Info.plist index 4fba5f05..83dafa61 100644 --- a/nightguardUITests/Info.plist +++ b/nightguardUITests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 730 + 732 diff --git a/nightguardUITests/NightguardUITests.swift b/nightguardUITests/NightguardUITests.swift index b4881b94..3790775b 100644 --- a/nightguardUITests/NightguardUITests.swift +++ b/nightguardUITests/NightguardUITests.swift @@ -48,17 +48,17 @@ class NightguardUITests: XCTestCase { func testTabsBars() { let tabBarsQuery = app.tabBars - XCTAssertEqual(tabBarsQuery.buttons.count, 5) + let tablecells = app.tables.cells + XCTAssertTrue(tabBarsQuery.buttons.count == 5 || tabBarsQuery.buttons.count == 6) // Refresh the Test-URL to refresh the correct Units (mg/dl) for the backend - tabBarsQuery.firstMatch.buttons.element(boundBy: 4).tap() - // Double Tab to be sure that the TabBar-Popup appears: - //tabBarsQuery.firstMatch.buttons.element(boundBy: 4).tap() - let tablecells = app.tables.cells - tablecells.containing(.staticText, identifier: "Preferences").element.tap() + selectPreferencesTab() let urlTextField = tablecells.containing(.staticText, identifier:"URL").children(matching: .textField).element // tap to refresh urlTextField.tap() + urlTextField.clearText() + urlTextField.tap() + urlTextField.clearText(andReplaceWith: "http://night.fritz.box") urlTextField.typeText("\n") testMainScreen(tabBarsQuery) @@ -80,10 +80,7 @@ class NightguardUITests: XCTestCase { snapshot("06-duration") // Test the Statistics Tab: - tabBarsQuery.firstMatch.buttons.element(boundBy: 4).tap() - // Double Tab to be sure that the TabBar-Popup appears: - tabBarsQuery.firstMatch.buttons.element(boundBy: 4).tap() - tablecells.containing(.staticText, identifier: "Stats").element.tap() + selectStatsTab() if UIDevice.current.userInterfaceIdiom == .phone { // only on a phone is a rotation needed if using the statistics panel XCUIDevice.shared.orientation = .landscapeLeft @@ -92,7 +89,7 @@ class NightguardUITests: XCTestCase { snapshot("07-stats") // Test the Preferences Tab: - tabBarsQuery.firstMatch.buttons.element(boundBy: 5).tap() + selectPreferencesTab() if UIDevice.current.userInterfaceIdiom == .phone { XCUIDevice.shared.orientation = .portrait } @@ -100,7 +97,51 @@ class NightguardUITests: XCTestCase { snapshot("08-preferences") } + fileprivate func selectPreferencesTab() { + + let tabBarsQuery = app.tabBars + let tablecells = app.tables.cells + + // On small devices like the iPhone => the preferences tab is hidden in a separate popup: + if tabBarsQuery.buttons.count == 5 { + + tabBarsQuery.firstMatch.buttons.element(boundBy: 4).tap() + // Double Tab to be sure that the TabBar-Popup appears: + //tabBarsQuery.firstMatch.buttons.element(boundBy: 4).tap() + + tablecells.containing(.staticText, identifier: "Preferences").element.tap() + } + + // On iPads the preferences tab can be selected directly: + if tabBarsQuery.buttons.count == 6 { + + tabBarsQuery.firstMatch.buttons.element(boundBy: 5).tap() + } + } + + fileprivate func selectStatsTab() { + + let tabBarsQuery = app.tabBars + let tablecells = app.tables.cells + + // On small devices like the iPhone => the preferences tab is hidden in a separate popup: + if tabBarsQuery.buttons.count == 5 { + + tabBarsQuery.firstMatch.buttons.element(boundBy: 4).tap() + // Double Tab to be sure that the TabBar-Popup appears: + tabBarsQuery.firstMatch.buttons.element(boundBy: 4).tap() + tablecells.containing(.staticText, identifier: "Stats").element.tap() + } + + // On iPads the preferences tab can be selected directly: + if tabBarsQuery.buttons.count == 6 { + + tabBarsQuery.firstMatch.buttons.element(boundBy: 4).tap() + } + } + fileprivate func testMainScreen(_ tabBarsQuery: XCUIElementQuery) { + tabBarsQuery.firstMatch.buttons.element(boundBy: 0).tap() sleep(3) snapshot("01-main")