Skip to content

Commit

Permalink
Fixed the UI-Tests. Right now they are running in plain english now. …
Browse files Browse the repository at this point in the history
…I will have to switch them back to localized UITests afterwards.
  • Loading branch information
dhermanns committed Sep 20, 2021
1 parent 9948250 commit 14e8a47
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 27 deletions.
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions fastlane/screenshots/de-DE/keyword.strings
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

"care" = "AKTION";

"duration" = "Dauer";

"stats" = "STATISTIKEN";

"preferences" = "START";
2 changes: 2 additions & 0 deletions fastlane/screenshots/de-DE/title.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

"care" = "Temporäre Ziele setzen";

"duration" = "Wechselzeiten im Blick behalten";

"alarms" = "Mit vielen Optionen";

"stats" = "Vergleiche verschiedene Tage";
Expand Down
4 changes: 3 additions & 1 deletion fastlane/screenshots/en-US/keyword.strings
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

"fullscreen" = "NIGHTMODE";

"care" = "CARE"
"care" = "CARE";

"duration" = "DURATION";

"alarms" = "ALARMS";

Expand Down
2 changes: 2 additions & 0 deletions fastlane/screenshots/en-US/title.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

"care" = "Set temporary targets";

"duration" = "Keep track of change durations";

"alarms" = "Tune all the details";

"stats" = "Compare every single day";
Expand Down
2 changes: 1 addition & 1 deletion nightguard WatchKit App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>730</string>
<string>732</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
Expand Down
2 changes: 1 addition & 1 deletion nightguard WatchKit Extension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>730</string>
<string>732</string>
<key>CLKComplicationPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).ComplicationController</string>
<key>CLKComplicationSupportedFamilies</key>
Expand Down
12 changes: 6 additions & 6 deletions nightguard.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down Expand Up @@ -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 = (
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion nightguard/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>730</string>
<string>732</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
Expand Down
2 changes: 1 addition & 1 deletion nightguardTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>730</string>
<string>732</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion nightguardUITests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>730</string>
<string>732</string>
</dict>
</plist>
63 changes: 52 additions & 11 deletions nightguardUITests/NightguardUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -92,15 +89,59 @@ 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
}
sleep(1)
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")
Expand Down

0 comments on commit 14e8a47

Please sign in to comment.