this repo has no description
at main 47 lines 1.7 kB view raw
1import Testing 2import Foundation 3 4@Suite("Button Command Tests") 5struct ButtonTests { 6 @Test("Home button press") 7 func homeButtonPress() async throws { 8 // Arrange 9 try await TestHelpers.launchPlaygroundApp(to: "tap-test") 10 11 // Act 12 try await TestHelpers.runAxeCommand("button home", simulatorUDID: defaultSimulatorUDID) 13 14 // Note: Cannot assert UI state as home button takes us out of the app 15 // This test verifies the command executes without error 16 } 17 18 @Test("Lock button press") 19 func lockButtonPress() async throws { 20 // Act 21 try await TestHelpers.runAxeCommand("button lock", simulatorUDID: defaultSimulatorUDID) 22 23 // Note: Cannot assert UI state as lock button locks the device 24 // This test verifies the command executes without error 25 } 26 27 @Test("Side button press") 28 func sideButtonPress() async throws { 29 // Act 30 try await TestHelpers.runAxeCommand("button side-button", simulatorUDID: defaultSimulatorUDID) 31 32 // Note: Side button behavior varies by device 33 // This test verifies the command executes without error 34 } 35 36 @Test("Button press with duration") 37 func buttonPressWithDuration() async throws { 38 // Act 39 let startTime = Date() 40 try await TestHelpers.runAxeCommand("button lock --duration 2", simulatorUDID: defaultSimulatorUDID) 41 let endTime = Date() 42 43 // Assert timing 44 let duration = endTime.timeIntervalSince(startTime) 45 #expect(duration >= 2.0, "Command should take at least 2 seconds with delays") 46 } 47}