Repository Public License
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : ORIX OS Automation9// File : UITests/ORIXAutomationUITests.swift10// Description : Drives the real app: first-run onboarding, navigation11// through every section, and persistence of a setting across12// a relaunch. Uses a throwaway data folder and a test13// Keychain service.14// Module : UITests15// Repository : https://git.spboucher.ai/orix-automation16// Created : 2026-11-2117// Last Modified : 2026-11-2118//19// =============================================================================20// AUTHOR & PROFESSIONAL AFFILIATION21// =============================================================================22//23// Author : Simon-Pierre Boucher24// Position : Professor of Finance25// Institution : Université du Québec en Outaouais (UQO)26// Department : Département des sciences administratives27// Organization : SP Boucher28//29// Website : https://spboucher.ai30// Git : https://git.spboucher.ai31//32// =============================================================================33// OFFICIAL CONTACT DIRECTORY34// =============================================================================35//36// General : info@spboucher.ai37// Professional : contact@spboucher.ai38// Direct : simon@spboucher.ai39// Research : research@spboucher.ai40// Development : dev@spboucher.ai41// Support : support@spboucher.ai42// Security/Admin : admin@spboucher.ai43// Notifications : notifications@spboucher.ai44//45// Preferred Contact: support@spboucher.ai46//47// =============================================================================48// COPYRIGHT & INTELLECTUAL PROPERTY49// =============================================================================50//51// Copyright (c) 202652// Simon-Pierre Boucher53//54// All rights reserved where applicable.55//56// This file is governed by the applicable project license,57// copyright notices, institutional agreements and relevant law.58//59// Unless expressly authorized by the applicable license or60// rights holder, copying, redistribution, sublicensing,61// publication and commercial exploitation are not permitted.62//63// Existing third-party rights and notices remain unaffected.64//65// =============================================================================66// CONFIDENTIALITY & SECURITY67// =============================================================================68//69// Classification : Public70// Distribution : Public repository; use is governed by the project license71// Security Contact : admin@spboucher.ai72//73// Access to this source does not independently grant permission74// to redistribute or disclose confidential materials.75//76// Do not embed credentials, private keys, access tokens,77// certificates or confidential personal information.78//79// =============================================================================80// LICENSE & MAINTENANCE81// =============================================================================82//83// License : Proprietary, all rights reserved (see license file)84// License File : LICENSE85// Maintainer : Simon-Pierre Boucher86// Technical Contact: dev@spboucher.ai87//88// =============================================================================89// END OF SP BOUCHER SOURCE HEADER90// =============================================================================9192import XCTest9394final class ORIXAutomationUITests: XCTestCase {95 var dataDir = ""9697 override func setUp() {98 continueAfterFailure = false99 dataDir = NSTemporaryDirectory() + "orix-uitest-" + UUID().uuidString.prefix(8)100 }101102 func launch(skipOnboarding: Bool, section: String? = nil) -> XCUIApplication {103 let app = XCUIApplication()104 app.launchArguments = ["-ORIXDataDir", dataDir, "-ORIXUITest", "YES", "-AppleLanguages", "(en)", "-AppleLocale", "en_US", "-ApplePersistenceIgnoreState", "YES"]105 if skipOnboarding { app.launchArguments += ["-ORIXSkipOnboarding", "YES"] }106 if let section { app.launchArguments += ["-ORIXSection", section] }107 app.launch()108 return app109 }110111 func testFirstLaunchShowsOnboardingAndEverySectionOpens() {112 let first = launch(skipOnboarding: false)113 XCTAssertTrue(first.sheets.firstMatch.waitForExistence(timeout: 20), "the welcome guide should appear on first launch")114 first.terminate()115116 let app = launch(skipOnboarding: true)117 XCTAssertTrue(app.windows.firstMatch.waitForExistence(timeout: 20))118 // Navigation goes through the command palette (keyboard only), so the test does not depend on where the window sits.119 let expected: [(String, String)] = [120 ("Go to Dashboard", "Dashboard"), ("Go to Agent", "Say what you want done"), ("Go to Workflow Studio", "Workflows"), ("Go to Code Studio", "Code Studio"),121 ("Go to Runs", "Runs"), ("Go to Scheduler", "Scheduler"), ("Go to Agents", "Agents"), ("Go to Skills", "Skills"), ("Go to Watch", "Watch & Learn"),122 ("Go to Permissions", "Permissions"), ("Go to Settings", "Settings"),123 ]124 for (command, text) in expected {125 app.typeKey("k", modifierFlags: .command)126 let field = app.textFields["palette.search"].firstMatch127 XCTAssertTrue(field.waitForExistence(timeout: 10), "palette for \(command)")128 field.typeText(command + "\n")129 let label = app.staticTexts.containing(NSPredicate(format: "label CONTAINS[c] %@ OR value CONTAINS[c] %@", text, text)).firstMatch130 XCTAssertTrue(label.waitForExistence(timeout: 10), "\(command) should show “\(text)”")131 XCTAssertTrue(app.descendants(matching: .any)["sidebar.dashboard"].firstMatch.exists)132 }133 XCTAssertTrue(app.descendants(matching: .any)["app.emergencyStop"].firstMatch.exists)134 app.terminate()135 }136137 func testCommandPaletteOpensAndNavigates() {138 let app = launch(skipOnboarding: true)139 XCTAssertTrue(app.windows.firstMatch.waitForExistence(timeout: 20))140 app.typeKey("k", modifierFlags: .command)141 let field = app.textFields["palette.search"].firstMatch142 XCTAssertTrue(field.waitForExistence(timeout: 10))143 field.typeText("Go to Runs\n")144 XCTAssertTrue(app.staticTexts.containing(NSPredicate(format: "label CONTAINS[c] 'Runs' OR value CONTAINS[c] 'Runs'")).firstMatch.waitForExistence(timeout: 10))145 app.terminate()146 }147}148