testing:like all fail
This commit is contained in:
86
GazeUITests/AccessibilityUITests.swift
Normal file
86
GazeUITests/AccessibilityUITests.swift
Normal file
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// AccessibilityUITests.swift
|
||||
// GazeUITests
|
||||
//
|
||||
// Created by Mike Freno on 1/8/26.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
final class AccessibilityUITests: XCTestCase {
|
||||
|
||||
var app: XCUIApplication!
|
||||
|
||||
override func setUpWithError() throws {
|
||||
continueAfterFailure = false
|
||||
app = XCUIApplication()
|
||||
app.launchArguments.append("--skip-onboarding")
|
||||
app.launch()
|
||||
}
|
||||
|
||||
override func tearDownWithError() throws {
|
||||
app = nil
|
||||
}
|
||||
|
||||
func testMenuBarAccessibilityLabels() throws {
|
||||
let menuBar = app.menuBarItems.firstMatch
|
||||
if menuBar.waitForExistence(timeout: 5) {
|
||||
menuBar.click()
|
||||
|
||||
for button in app.buttons.allElementsBoundByIndex {
|
||||
XCTAssertFalse(button.label.isEmpty, "Button should have accessibility label")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testKeyboardNavigation() throws {
|
||||
let menuBar = app.menuBarItems.firstMatch
|
||||
if menuBar.waitForExistence(timeout: 5) {
|
||||
menuBar.click()
|
||||
|
||||
app.typeKey(XCUIKeyboardKey.tab, modifierFlags: [])
|
||||
|
||||
let focusedElement = app.descendants(matching: .any).element(matching: NSPredicate(format: "hasKeyboardFocus == true"))
|
||||
XCTAssertTrue(focusedElement.exists || app.buttons.count > 0)
|
||||
}
|
||||
}
|
||||
|
||||
func testAllButtonsAreHittable() throws {
|
||||
let menuBar = app.menuBarItems.firstMatch
|
||||
if menuBar.waitForExistence(timeout: 5) {
|
||||
menuBar.click()
|
||||
|
||||
sleep(1)
|
||||
|
||||
let buttons = app.buttons.allElementsBoundByIndex
|
||||
for button in buttons where button.exists && button.isEnabled {
|
||||
XCTAssertTrue(button.isHittable || !button.isEnabled, "Enabled button should be hittable: \(button.label)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testVoiceOverElementsHaveLabels() throws {
|
||||
let menuBar = app.menuBarItems.firstMatch
|
||||
if menuBar.waitForExistence(timeout: 5) {
|
||||
menuBar.click()
|
||||
|
||||
let staticTexts = app.staticTexts.allElementsBoundByIndex
|
||||
for text in staticTexts where text.exists {
|
||||
XCTAssertFalse(text.label.isEmpty, "Static text should have label")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testImagesHaveAccessibilityTraits() throws {
|
||||
let menuBar = app.menuBarItems.firstMatch
|
||||
if menuBar.waitForExistence(timeout: 5) {
|
||||
menuBar.click()
|
||||
|
||||
let images = app.images.allElementsBoundByIndex
|
||||
for image in images where image.exists {
|
||||
XCTAssertFalse(image.label.isEmpty, "Image should have accessibility label")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
102
GazeUITests/MenuBarUITests.swift
Normal file
102
GazeUITests/MenuBarUITests.swift
Normal file
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// MenuBarUITests.swift
|
||||
// GazeUITests
|
||||
//
|
||||
// Created by Mike Freno on 1/8/26.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
final class MenuBarUITests: XCTestCase {
|
||||
|
||||
var app: XCUIApplication!
|
||||
|
||||
override func setUpWithError() throws {
|
||||
continueAfterFailure = false
|
||||
app = XCUIApplication()
|
||||
app.launchArguments.append("--skip-onboarding")
|
||||
app.launch()
|
||||
}
|
||||
|
||||
override func tearDownWithError() throws {
|
||||
app = nil
|
||||
}
|
||||
|
||||
func testMenuBarExtraExists() throws {
|
||||
let menuBar = app.menuBarItems.firstMatch
|
||||
XCTAssertTrue(menuBar.waitForExistence(timeout: 5))
|
||||
}
|
||||
|
||||
func testMenuBarCanBeOpened() throws {
|
||||
let menuBar = app.menuBarItems.firstMatch
|
||||
if menuBar.waitForExistence(timeout: 5) {
|
||||
menuBar.click()
|
||||
|
||||
let gazeTitle = app.staticTexts["Gaze"]
|
||||
XCTAssertTrue(gazeTitle.waitForExistence(timeout: 2) || app.staticTexts.count > 0)
|
||||
}
|
||||
}
|
||||
|
||||
func testMenuBarHasTimerStatus() throws {
|
||||
let menuBar = app.menuBarItems.firstMatch
|
||||
if menuBar.waitForExistence(timeout: 5) {
|
||||
menuBar.click()
|
||||
|
||||
let activeTimersText = app.staticTexts["Active Timers"]
|
||||
let hasTimerInfo = activeTimersText.exists || app.staticTexts.count > 3
|
||||
|
||||
XCTAssertTrue(hasTimerInfo)
|
||||
}
|
||||
}
|
||||
|
||||
func testMenuBarHasPauseResumeControl() throws {
|
||||
let menuBar = app.menuBarItems.firstMatch
|
||||
if menuBar.waitForExistence(timeout: 5) {
|
||||
menuBar.click()
|
||||
|
||||
let pauseButton = app.buttons.containing(NSPredicate(format: "label CONTAINS 'Pause' OR label CONTAINS 'Resume'")).firstMatch
|
||||
XCTAssertTrue(pauseButton.waitForExistence(timeout: 2))
|
||||
}
|
||||
}
|
||||
|
||||
func testMenuBarHasSettingsButton() throws {
|
||||
let menuBar = app.menuBarItems.firstMatch
|
||||
if menuBar.waitForExistence(timeout: 5) {
|
||||
menuBar.click()
|
||||
|
||||
let settingsButton = app.buttons["Settings"]
|
||||
let settingsMenuItem = app.menuItems["Settings"]
|
||||
|
||||
XCTAssertTrue(settingsButton.exists || settingsMenuItem.exists)
|
||||
}
|
||||
}
|
||||
|
||||
func testMenuBarHasQuitButton() throws {
|
||||
let menuBar = app.menuBarItems.firstMatch
|
||||
if menuBar.waitForExistence(timeout: 5) {
|
||||
menuBar.click()
|
||||
|
||||
let quitButton = app.buttons.containing(NSPredicate(format: "label CONTAINS 'Quit'")).firstMatch
|
||||
XCTAssertTrue(quitButton.waitForExistence(timeout: 2))
|
||||
}
|
||||
}
|
||||
|
||||
func testPauseResumeToggle() throws {
|
||||
let menuBar = app.menuBarItems.firstMatch
|
||||
if menuBar.waitForExistence(timeout: 5) {
|
||||
menuBar.click()
|
||||
|
||||
let pauseButton = app.buttons.containing(NSPredicate(format: "label CONTAINS 'Pause'")).firstMatch
|
||||
let resumeButton = app.buttons.containing(NSPredicate(format: "label CONTAINS 'Resume'")).firstMatch
|
||||
|
||||
if pauseButton.exists && pauseButton.isHittable {
|
||||
pauseButton.tap()
|
||||
XCTAssertTrue(resumeButton.waitForExistence(timeout: 2))
|
||||
} else if resumeButton.exists && resumeButton.isHittable {
|
||||
resumeButton.tap()
|
||||
XCTAssertTrue(pauseButton.waitForExistence(timeout: 2))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
92
GazeUITests/OnboardingUITests.swift
Normal file
92
GazeUITests/OnboardingUITests.swift
Normal file
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// OnboardingUITests.swift
|
||||
// GazeUITests
|
||||
//
|
||||
// Created by Mike Freno on 1/8/26.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
final class OnboardingUITests: XCTestCase {
|
||||
|
||||
var app: XCUIApplication!
|
||||
|
||||
override func setUpWithError() throws {
|
||||
continueAfterFailure = false
|
||||
app = XCUIApplication()
|
||||
app.launchArguments.append("--reset-onboarding")
|
||||
app.launch()
|
||||
}
|
||||
|
||||
override func tearDownWithError() throws {
|
||||
app = nil
|
||||
}
|
||||
|
||||
func testOnboardingWelcomeScreen() throws {
|
||||
XCTAssertTrue(app.staticTexts["Welcome to Gaze"].exists || app.staticTexts.containing(NSPredicate(format: "label CONTAINS 'Welcome'")).firstMatch.exists)
|
||||
}
|
||||
|
||||
func testOnboardingNavigationFromWelcome() throws {
|
||||
let continueButton = app.buttons["Continue"]
|
||||
|
||||
if continueButton.waitForExistence(timeout: 2) {
|
||||
continueButton.tap()
|
||||
|
||||
let nextScreen = app.staticTexts.containing(NSPredicate(format: "label CONTAINS 'Setup' OR label CONTAINS 'Configure'")).firstMatch
|
||||
XCTAssertTrue(nextScreen.waitForExistence(timeout: 2))
|
||||
}
|
||||
}
|
||||
|
||||
func testOnboardingBackNavigation() throws {
|
||||
let continueButton = app.buttons["Continue"]
|
||||
if continueButton.waitForExistence(timeout: 2) {
|
||||
continueButton.tap()
|
||||
|
||||
let backButton = app.buttons["Back"]
|
||||
if backButton.waitForExistence(timeout: 1) {
|
||||
backButton.tap()
|
||||
|
||||
XCTAssertTrue(app.staticTexts.containing(NSPredicate(format: "label CONTAINS 'Welcome'")).firstMatch.waitForExistence(timeout: 1))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testOnboardingCompleteFlow() throws {
|
||||
let continueButtons = app.buttons.matching(identifier: "Continue")
|
||||
let nextButtons = app.buttons.matching(identifier: "Next")
|
||||
|
||||
var currentStep = 0
|
||||
let maxSteps = 10
|
||||
|
||||
while currentStep < maxSteps {
|
||||
if continueButtons.firstMatch.exists && continueButtons.firstMatch.isHittable {
|
||||
continueButtons.firstMatch.tap()
|
||||
currentStep += 1
|
||||
sleep(1)
|
||||
} else if nextButtons.firstMatch.exists && nextButtons.firstMatch.isHittable {
|
||||
nextButtons.firstMatch.tap()
|
||||
currentStep += 1
|
||||
sleep(1)
|
||||
} else if app.buttons["Get Started"].exists {
|
||||
app.buttons["Get Started"].tap()
|
||||
break
|
||||
} else if app.buttons["Done"].exists {
|
||||
app.buttons["Done"].tap()
|
||||
break
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
XCTAssertLessThan(currentStep, maxSteps, "Onboarding flow should complete")
|
||||
}
|
||||
|
||||
func testOnboardingHasRequiredElements() throws {
|
||||
let hasText = app.staticTexts.count > 0
|
||||
let hasButtons = app.buttons.count > 0
|
||||
|
||||
XCTAssertTrue(hasText, "Onboarding should have text elements")
|
||||
XCTAssertTrue(hasButtons, "Onboarding should have buttons")
|
||||
}
|
||||
}
|
||||
88
GazeUITests/PerformanceUITests.swift
Normal file
88
GazeUITests/PerformanceUITests.swift
Normal file
@@ -0,0 +1,88 @@
|
||||
//
|
||||
// PerformanceUITests.swift
|
||||
// GazeUITests
|
||||
//
|
||||
// Created by Mike Freno on 1/8/26.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
final class PerformanceUITests: XCTestCase {
|
||||
|
||||
var app: XCUIApplication!
|
||||
|
||||
override func setUpWithError() throws {
|
||||
continueAfterFailure = false
|
||||
app = XCUIApplication()
|
||||
app.launchArguments.append("--skip-onboarding")
|
||||
}
|
||||
|
||||
override func tearDownWithError() throws {
|
||||
app = nil
|
||||
}
|
||||
|
||||
func testAppLaunchPerformance() throws {
|
||||
measure(metrics: [XCTApplicationLaunchMetric()]) {
|
||||
app.launch()
|
||||
app.terminate()
|
||||
}
|
||||
}
|
||||
|
||||
func testMenuBarOpenPerformance() throws {
|
||||
app.launch()
|
||||
|
||||
measure {
|
||||
let menuBar = app.menuBarItems.firstMatch
|
||||
if menuBar.waitForExistence(timeout: 5) {
|
||||
menuBar.click()
|
||||
_ = app.staticTexts["Gaze"].waitForExistence(timeout: 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testSettingsWindowOpenPerformance() throws {
|
||||
app.launch()
|
||||
|
||||
let menuBar = app.menuBarItems.firstMatch
|
||||
if menuBar.waitForExistence(timeout: 5) {
|
||||
menuBar.click()
|
||||
|
||||
measure {
|
||||
let settingsButton = app.menuItems["Settings"]
|
||||
if settingsButton.waitForExistence(timeout: 2) {
|
||||
settingsButton.click()
|
||||
|
||||
let settingsWindow = app.windows["Settings"]
|
||||
_ = settingsWindow.waitForExistence(timeout: 3)
|
||||
|
||||
if settingsWindow.exists {
|
||||
let closeButton = settingsWindow.buttons[XCUIIdentifierCloseWindow]
|
||||
if closeButton.exists {
|
||||
closeButton.click()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
menuBar.click()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testMemoryUsageDuringOperation() throws {
|
||||
app.launch()
|
||||
|
||||
let menuBar = app.menuBarItems.firstMatch
|
||||
if menuBar.waitForExistence(timeout: 5) {
|
||||
measure(metrics: [XCTMemoryMetric()]) {
|
||||
for _ in 0..<5 {
|
||||
menuBar.click()
|
||||
sleep(1)
|
||||
|
||||
menuBar.click()
|
||||
sleep(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
83
GazeUITests/SettingsUITests.swift
Normal file
83
GazeUITests/SettingsUITests.swift
Normal file
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// SettingsUITests.swift
|
||||
// GazeUITests
|
||||
//
|
||||
// Created by Mike Freno on 1/8/26.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
final class SettingsUITests: XCTestCase {
|
||||
|
||||
var app: XCUIApplication!
|
||||
|
||||
override func setUpWithError() throws {
|
||||
continueAfterFailure = false
|
||||
app = XCUIApplication()
|
||||
app.launchArguments.append("--skip-onboarding")
|
||||
app.launch()
|
||||
}
|
||||
|
||||
override func tearDownWithError() throws {
|
||||
app = nil
|
||||
}
|
||||
|
||||
func testOpenSettingsWindow() throws {
|
||||
let menuBar = app.menuBarItems.firstMatch
|
||||
if menuBar.exists {
|
||||
menuBar.click()
|
||||
|
||||
let settingsButton = app.menuItems["Settings"]
|
||||
if settingsButton.waitForExistence(timeout: 2) {
|
||||
settingsButton.click()
|
||||
|
||||
let settingsWindow = app.windows["Settings"]
|
||||
XCTAssertTrue(settingsWindow.waitForExistence(timeout: 3))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testSettingsWindowHasTimerControls() throws {
|
||||
let menuBar = app.menuBarItems.firstMatch
|
||||
if menuBar.exists {
|
||||
menuBar.click()
|
||||
|
||||
let settingsButton = app.menuItems["Settings"]
|
||||
if settingsButton.waitForExistence(timeout: 2) {
|
||||
settingsButton.click()
|
||||
|
||||
sleep(1)
|
||||
|
||||
let hasSliders = app.sliders.count > 0
|
||||
let hasTextFields = app.textFields.count > 0
|
||||
let hasSwitches = app.switches.count > 0
|
||||
|
||||
let hasControls = hasSliders || hasTextFields || hasSwitches
|
||||
XCTAssertTrue(hasControls, "Settings should have timer controls")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testSettingsWindowCanBeClosed() throws {
|
||||
let menuBar = app.menuBarItems.firstMatch
|
||||
if menuBar.exists {
|
||||
menuBar.click()
|
||||
|
||||
let settingsButton = app.menuItems["Settings"]
|
||||
if settingsButton.waitForExistence(timeout: 2) {
|
||||
settingsButton.click()
|
||||
|
||||
let settingsWindow = app.windows["Settings"]
|
||||
if settingsWindow.waitForExistence(timeout: 3) {
|
||||
let closeButton = settingsWindow.buttons[XCUIIdentifierCloseWindow]
|
||||
if closeButton.exists {
|
||||
closeButton.click()
|
||||
|
||||
XCTAssertFalse(settingsWindow.exists)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user