Browse Source

Adding a UI interruptions handler.

pull/92/head
Abhishek 5 years ago
parent
commit
fd177bf7dc
  1. 6
      Clocker/Clocker/en.lproj/Localizable.strings
  2. 11
      Clocker/ClockerUITests/FloatingWindowTests.swift
  3. 6
      Clocker/ClockerUITests/PreferencesTest.swift
  4. 2
      Clocker/Preferences/General/PreferencesViewController.swift

6
Clocker/Clocker/en.lproj/Localizable.strings

@ -46,9 +46,9 @@
"Sort by Name" = "Sort by Name"; "Sort by Name" = "Sort by Name";
"Sort by Label" = "Sort by Label"; "Sort by Label" = "Sort by Label";
"Search Field Placeholder" = "Enter a city, state or country name"; "Search Field Placeholder" = "Enter a city, state or country name";
"No Timezone Selected Error Message" = "Please select a timezone!"; "No Timezone Selected" = "Please select a timezone!";
"Max Timezones Selected Error Message" = "Maximum 100 timezones allowed!"; "Max Timezones Selected" = "Maximum 100 timezones allowed!";
"Max Search Characters Error Message" = "Only 50 characters allowed!"; "Max Search Characters" = "Only 50 characters allowed!";
"Add Button Title" = "Add"; "Add Button Title" = "Add";
"Close Button Title" = "Close"; "Close Button Title" = "Close";

11
Clocker/ClockerUITests/FloatingWindowTests.swift

@ -76,6 +76,15 @@ class FloatingWindowTests: XCTestCase {
let remindersCheckbox = app.checkBoxes["ReminderCheckbox"] let remindersCheckbox = app.checkBoxes["ReminderCheckbox"]
remindersCheckbox.click() remindersCheckbox.click()
addUIInterruptionMonitor(withDescription: "Reminders Access") { (alert) -> Bool in
let alertButton = alert.buttons["OK"]
if alertButton.exists {
alertButton.tap()
return true
}
return false
}
app.buttons["SaveButton"].click() app.buttons["SaveButton"].click()
app.tapMenubarIcon() app.tapMenubarIcon()
@ -109,7 +118,7 @@ class FloatingWindowTests: XCTestCase {
} }
app.buttons["FloatingPreferences"].click() app.buttons["FloatingPreferences"].click()
app.windows["Clocker"].toolbars.buttons["General"].click() app.windows["Clocker"].toolbars.buttons["Preferences"].click()
let menubarDisplayQuery = app.tables.checkBoxes.matching(NSPredicate(format: "value == 1", "")) let menubarDisplayQuery = app.tables.checkBoxes.matching(NSPredicate(format: "value == 1", ""))
let menubarDisplayQueryCount = menubarDisplayQuery.count let menubarDisplayQueryCount = menubarDisplayQuery.count

6
Clocker/ClockerUITests/PreferencesTest.swift

@ -144,6 +144,8 @@ class PreferencesTest: XCTestCase {
addAPlace(place: "Aurangabad", to: app) addAPlace(place: "Aurangabad", to: app)
addAPlace(place: "Zimbabwe", to: app) addAPlace(place: "Zimbabwe", to: app)
addAPlace(place: "Portland", to: app, shouldSleep: false) addAPlace(place: "Portland", to: app, shouldSleep: false)
addAPlace(place: "Asia/Kolkata", to: app)
addAPlace(place: "Anywhere on Earth", to: app, shouldSleep: false)
XCTAssertTrue(app.windows["Clocker"].checkBoxes["Sort by Label"].exists) XCTAssertTrue(app.windows["Clocker"].checkBoxes["Sort by Label"].exists)
@ -176,7 +178,9 @@ class PreferencesTest: XCTestCase {
deleteAPlace(place: "Aurangabad", for: app) deleteAPlace(place: "Aurangabad", for: app)
deleteAPlace(place: "Zimbabwe", for: app) deleteAPlace(place: "Zimbabwe", for: app)
deleteAPlace(place: "Portland", for: app, shouldSleep: false) deleteAPlace(place: "Portland", for: app)
deleteAPlace(place: "Asia/Kolkata", for: app)
deleteAPlace(place: "Anywhere on Earth", for: app, shouldSleep: false)
} }
func testSortingTimezonesByCustomLabel() { func testSortingTimezonesByCustomLabel() {

2
Clocker/Preferences/General/PreferencesViewController.swift

@ -7,7 +7,7 @@ struct PreferencesConstants {
comment: "Message shown when the user taps on Add without selecting a timezone") comment: "Message shown when the user taps on Add without selecting a timezone")
static let maxTimezonesErrorMessage = NSLocalizedString("Max Timezones Selected", static let maxTimezonesErrorMessage = NSLocalizedString("Max Timezones Selected",
comment: "Max Timezones Error Message") comment: "Max Timezones Error Message")
static let maxCharactersAllowed = NSLocalizedString("Max Search Characters Error Message", static let maxCharactersAllowed = NSLocalizedString("Max Search Characters",
comment: "Max Character Count Allowed Error Message") comment: "Max Character Count Allowed Error Message")
static let noInternetConnectivityError = "You're offline, maybe?" static let noInternetConnectivityError = "You're offline, maybe?"
static let tryAgainMessage = "Try again, maybe?" static let tryAgainMessage = "Try again, maybe?"

Loading…
Cancel
Save