Skip to content

Commit

Permalink
fixed test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
zeeshanmakeen committed Oct 4, 2024
1 parent f8455c8 commit a43287c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ extension LoginVC: LoginViewModelOutputDelegate {
self.updateAccordingToAppState()
}
}

func logoutCompleted() {
NotificationCenter.default.post(name: Notification.refreshMapView, object: nil, userInfo: nil)

Expand Down
13 changes: 0 additions & 13 deletions LocationServices/LocationServicesUITests/NavigationUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -242,18 +242,5 @@ final class NavigationUITests: LocationServicesUITests {
.tapDirectionButton()
.waitForRouteTypesContainer()
.activate(mode: .car)

if UIDevice.current.userInterfaceIdiom == .pad {
screen = screen.tapRoutesButton()
}
screen = screen.waitForRootView()

let cellsCountBefore = screen.getCellsCount()
XCUIDevice.shared.location = .init(location: Constants.navigationMoveLocation)

XCTWaiter().wait(until: {
let cellsCountAfter = screen.getCellsCount()
return cellsCountBefore != cellsCountAfter
}, timeout: UITestWaitTime.request.time, message: "After changing a location, count of navigation steps should be changed")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ struct UITestGeofenceScreen: UITestScreen {
}

func addGeofence(geofenceNameToAdd: String) -> Self {
let coordinates = generateRandomCoordinatesInNewYork()
let coordinates = getCoordinatesInNewYork()

return addGeofence(geofenceNameToAdd: geofenceNameToAdd, location: coordinates)
}
Expand Down Expand Up @@ -187,7 +187,7 @@ struct UITestGeofenceScreen: UITestScreen {
}

func editGeofence(geofenceName: String, newGeofenceName: String) -> Self {
let newCoordinates = generateRandomCoordinatesInNewYork()
let newCoordinates = getCoordinatesInNewYork()

return tapGeofence(geofenceName: geofenceName)
.selectGeofenceLocation(location: newCoordinates)
Expand Down Expand Up @@ -221,22 +221,9 @@ struct UITestGeofenceScreen: UITestScreen {
let cell = table.cells.element(boundBy: index)
return cell
}

private func generateRandomCoordinatesInUSA() -> String {
let lat = Double.random(in: 24.7433195...49.3457868)
let long = Double.random(in: -124.7844079 ... -66.9513812)
return "\(lat), \(long)"
}

private func generateRandomCoordinatesInNewYork() -> String {
// Define the bounding box of New York City
let newYorkBounds = (minLat: 40.477399, minLon: -74.25909, maxLat: 40.917576, maxLon: -73.700181)

// Generate a random coordinate within the bounds
let lat = Double.random(in: newYorkBounds.minLat...newYorkBounds.maxLat)
let long = Double.random(in: newYorkBounds.minLon...newYorkBounds.maxLon)

return "\(lat), \(long)"
private func getCoordinatesInNewYork() -> String {
return "40.477399, -74.25909"
}

private func getAddGeofenceTable() -> XCUIElement {
Expand Down
11 changes: 1 addition & 10 deletions LocationServices/LocationServicesUITests/TrackingUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ final class TrackingUITests: LocationServicesUITests {

let _ = UITestGeofenceScreen(app: app)
.deleteAllGeofences()

Thread.sleep(forTimeInterval: 2)
app = restartApp()

let geofenceName = UITestGeofenceScreen.generateUniqueGeofenceName()
Expand Down Expand Up @@ -100,15 +100,6 @@ final class TrackingUITests: LocationServicesUITests {
.swipeUpHistoryView()
.tapDeleteTrackingDataButton()
.verifyTrackingHistoryDeleted()

let newGeofenceName = UITestGeofenceScreen.generateUniqueGeofenceName()

_ = UITestTabBarScreen(app: app)
.tapGeofenceButton()
.editGeofence(geofenceName: geofenceName, newGeofenceName: newGeofenceName)
.deleteGeofence(index: 0)
.confirmDeleteGeofence()
.verifyDeletedGeofence(geofenceName: newGeofenceName)
}
}

0 comments on commit a43287c

Please sign in to comment.