Skip to content

Commit

Permalink
add more UI tests
Browse files Browse the repository at this point in the history
add more UI tests
  • Loading branch information
AlexPerathoner committed Mar 25, 2023
1 parent 8425351 commit 497188c
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions SlimHUDUITests/HudsUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,15 @@ import Foundation
import XCTest

final class HudsUITest: SparkleUITests {

func testTriggerVolumeHud() throws {
let app = XCUIApplication()
app.shouldContinuouslyCheck()
app.launch()

XCTAssert(app.windows.count == 0)
DispatchQueue.global().async {
do {
try self.changeVolume()
} catch {
XCTAssertEqual(error.localizedDescription, "")
}
try! self.changeVolume()
}
sleep(1)
XCTAssertTrue(isVolumeHudVisible(app: app))
Expand All @@ -38,4 +35,30 @@ final class HudsUITest: SparkleUITests {
"-e set volume output volume 20"]
try task.run()
}

func testFullscreen() throws {
let app = XCUIApplication()
let finder = XCUIApplication(bundleIdentifier: "com.apple.finder")
app.shouldContinuouslyCheck()
app.launch()
finder.launch()

try openWindowInFullscreenMode()
sleep(1)

DispatchQueue.global().async {
try! self.changeVolume()
}
sleep(1)
XCTAssertTrue(isVolumeHudVisible(app: app))
}

private func openWindowInFullscreenMode() throws {
let task = Process()
task.launchPath = "/usr/bin/osascript"
task.arguments = ["-e tell application \"Finder\" to make new Finder window",
"-e delay 1",
"-e tell application \"System Events\" to tell process \"Finder\" to set value of attribute \"AXFullScreen\" of window 1 to true"]
try task.run()
}
}

0 comments on commit 497188c

Please sign in to comment.