From 4afbe7580cea6bc0dce5adbc37e147bbf9d1413c Mon Sep 17 00:00:00 2001 From: Abhishek Banthia <8280282+n0shake@users.noreply.github.com> Date: Sat, 14 Aug 2021 10:30:05 -0500 Subject: [PATCH] Update PreferencesTest.swift --- Clocker/ClockerUITests/PreferencesTest.swift | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Clocker/ClockerUITests/PreferencesTest.swift b/Clocker/ClockerUITests/PreferencesTest.swift index e6df749..ef980d2 100644 --- a/Clocker/ClockerUITests/PreferencesTest.swift +++ b/Clocker/ClockerUITests/PreferencesTest.swift @@ -306,15 +306,22 @@ class PreferencesTest: XCTestCase { // Let's make sure we have > 1 timezones first let favourites = preferencesTable.tableRows + + if (favourites.count < 2) { + addAPlace(place: "UTC", to: app) + } + XCTAssertTrue(favourites.count > 1) - + sleep(2) + // Select two timezones let unfavouritedMenubarsQuery = preferencesTable.checkBoxes.matching(NSPredicate(format: "value == 0", "")) if unfavouritedMenubarsQuery.count > 1 { - for _ in 0 ..< 2 { + for _ in 0 ..< unfavouritedMenubarsQuery.count { let checkbox = unfavouritedMenubarsQuery.element(boundBy: 0) checkbox.click() + sleep(2) } } @@ -442,7 +449,7 @@ extension XCTestCase { } private func deleteAtRow(_ rowToDelete: XCUIElement, for _: XCUIApplication, shouldSleep: Bool) { - rowToDelete.coordinate(withNormalizedOffset: CGVector(dx: 0, dy: 0)).click() + rowToDelete.click() rowToDelete.typeKey(XCUIKeyboardKey.delete, modifierFlags: XCUIElement.KeyModifierFlags()) if shouldSleep { sleep(2)