Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new notification tile identifier for iOS 18 #2394

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/patrol/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased

- Fix tapping on notification on iOS 18. (#2394)

## 3.12.0

- Add `clear-permissions` flag on ios commands. (#2367)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,14 @@

// MARK: Notifications

private let notificationCellIdentifier: String = {
if #available(iOS 18, *) {
return "ListCell"
} else {
return "NotificationCell"
}
}()

func openNotifications() throws {
// TODO: Check if works on iPhones without notch

Expand Down Expand Up @@ -667,7 +675,7 @@
func getNotifications() throws -> [Notification] {
var notifications = [Notification]()
runAction("getting notifications") {
let cells = self.springboard.buttons.matching(identifier: "NotificationCell")
let cells = self.springboard.buttons.matching(identifier: self.notificationCellIdentifier)
.allElementsBoundByIndex
for (i, cell) in cells.enumerated() {
Logger.shared.i("found notification at index \(i) with label \(format: cell.label)")
Expand All @@ -681,7 +689,8 @@

func tapOnNotification(byIndex index: Int, withTimeout timeout: TimeInterval?) throws {
try runAction("tapping on notification at index \(index)") {
let cellsQuery = self.springboard.buttons.matching(identifier: "NotificationCell")
let cellsQuery = self.springboard.buttons.matching(
identifier: self.notificationCellIdentifier)
guard
let cell = self.waitFor(query: cellsQuery, index: index, timeout: timeout ?? self.timeout)
else {
Expand All @@ -703,7 +712,8 @@
try runAction("tapping on notification containing text \(format: substring)") {
let cellsQuery = self.springboard.buttons.matching(
NSPredicate(
format: "identifier == %@ AND label CONTAINS %@", "NotificationCell", substring)
format: "identifier == %@ AND label CONTAINS %@", self.notificationCellIdentifier,
substring)
)

guard let cell = self.waitFor(query: cellsQuery, index: 0, timeout: timeout ?? self.timeout)
Expand Down
Loading