Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Audit a row's page of Background Items, Extensions, and Plug-ins too

Țugui Dragoșbd30cd43d215
diff --git a/AGENTS.md b/AGENTS.md
index 0f076492..1884d366 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -233,7 +233,8 @@ If you are unsure whether something belongs in the helper, it doesn't.
`--filter SuggestedSelectionOnThisMacTests` it scans every app installed on the Mac and checks that nothing Peel
would select is refused or shared, and without the filter three more read this Mac's system extensions, Trash, and
storage, the first of them failing on a Mac with no system extension. The `PeelUITests` scheme runs Xcode's
- accessibility audit on every page, in light and dark, moving the pointer, typing, and quitting a Peel that is open,
+ accessibility audit on every page, and on a row's page of Background Items, Extensions, and Plug-ins, in light and
+ dark, moving the pointer, typing, and quitting a Peel that is open,
so it runs on a Mac nobody is using; macOS asks once for Accessibility for the test runner, and for an
administrator's password each time Automation Mode turns on:
`xcodebuild test -project Peel.xcodeproj -scheme PeelUITests -destination "platform=macOS,arch=$(uname -m)"
diff --git a/PeelUITests/AccessibilityAuditTests.swift b/PeelUITests/AccessibilityAuditTests.swift
index 40fb0400..e5b3aa13 100644
--- a/PeelUITests/AccessibilityAuditTests.swift
+++ b/PeelUITests/AccessibilityAuditTests.swift
@@ -31,6 +31,9 @@ final class AccessibilityAuditTests: XCTestCase {
private static let settingsPanes = ["General", "Exclusions", "Privacy", "Helper"]
+ /// The pages whose list leads to a page of each row, audited once more with a row chosen.
+ private static let pagesOfRows: Set = ["Background Items", "Extensions", "Plug-ins"]
+
func testEverythingInTheLightAppearance() {
auditEverything(appearance: "Light")
}
@@ -69,6 +72,9 @@ final class AccessibilityAuditTests: XCTestCase {
waitForTheScan(of: page, in: app)
guard let tabs = Self.tabs[page] else {
audit(page, appearance: appearance, of: app)
+ if Self.pagesOfRows.contains(page), chooseARow(of: page, in: app) {
+ audit("\(page), a row's page", appearance: appearance, of: app)
+ }
continue
}
for tab in tabs where click(toolbarItem(tab, in: app), named: "\(page), \(tab)") {
@@ -254,6 +260,22 @@ final class AccessibilityAuditTests: XCTestCase {
title.menus.firstMatch.children(matching: .menuItem)[item].click()
}
+ /// Chooses a row of the page's list, whose own page the detail column then shows: a click below the rows gives the
+ /// list the keyboard, and Down Arrow chooses the next row that can be chosen, past a section's heading.
+ private func chooseARow(of page: String, in app: XCUIApplication) -> Bool {
+ let window = app.windows["main"]
+ let named = NSPredicate(format: "label == %@", page)
+ let outline = window.outlines.matching(named).firstMatch
+ let list = outline.exists ? outline : window.tables.matching(named).firstMatch
+ guard list.waitForExistence(timeout: 5) else {
+ XCTFail("\(page)'s list isn't there")
+ return false
+ }
+ list.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.97)).click()
+ list.typeKey(.downArrow, modifierFlags: [])
+ return true
+ }
+
/// Waits for the page's scan to end. While one runs, the toolbar's Rescan turns into Stop, a moment after the
/// scan starts.
private func waitForTheScan(of page: String, in app: XCUIApplication) {