SPB Git

Repository Public License

AppUITests.swift 5.1 KB 111 lines swift

1// =============================================================================2//                  SP BOUCHER | SOFTWARE & RESEARCH3//             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project          : ORIX OS Automation9// File             : Packages/ORIXAppUI/Tests/ORIXAppUITests/AppUITests.swift10// Description      : Renders the shared approval card off screen and checks the11//                    app model wiring against real services in a temp folder.12// Module           : ORIXAppUITests13// Repository       : https://git.spboucher.ai/orix-automation14// Created          : 2026-11-2115// Last Modified    : 2026-11-2116//17// =============================================================================18// AUTHOR & PROFESSIONAL AFFILIATION19// =============================================================================20//21// Author           : Simon-Pierre Boucher22// Position         : Professor of Finance23// Institution      : Université du Québec en Outaouais (UQO)24// Department       : Département des sciences administratives25// Organization     : SP Boucher26//27// Website          : https://spboucher.ai28// Git              : https://git.spboucher.ai29//30// =============================================================================31// OFFICIAL CONTACT DIRECTORY32// =============================================================================33//34// General          : info@spboucher.ai35// Professional     : contact@spboucher.ai36// Direct           : simon@spboucher.ai37// Research         : research@spboucher.ai38// Development      : dev@spboucher.ai39// Support          : support@spboucher.ai40// Security/Admin   : admin@spboucher.ai41// Notifications    : notifications@spboucher.ai42//43// Preferred Contact: support@spboucher.ai44//45// =============================================================================46// COPYRIGHT & INTELLECTUAL PROPERTY47// =============================================================================48//49// Copyright (c) 202650// Simon-Pierre Boucher51//52// All rights reserved where applicable.53//54// This file is governed by the applicable project license,55// copyright notices, institutional agreements and relevant law.56//57// Unless expressly authorized by the applicable license or58// rights holder, copying, redistribution, sublicensing,59// publication and commercial exploitation are not permitted.60//61// Existing third-party rights and notices remain unaffected.62//63// =============================================================================64// CONFIDENTIALITY & SECURITY65// =============================================================================66//67// Classification   : Public68// Distribution     : Public repository; use is governed by the project license69// Security Contact : admin@spboucher.ai70//71// Access to this source does not independently grant permission72// to redistribute or disclose confidential materials.73//74// Do not embed credentials, private keys, access tokens,75// certificates or confidential personal information.76//77// =============================================================================78// LICENSE & MAINTENANCE79// =============================================================================80//81// License          : Proprietary, all rights reserved (see license file)82// License File     : LICENSE83// Maintainer       : Simon-Pierre Boucher84// Technical Contact: dev@spboucher.ai85//86// =============================================================================87// END OF SP BOUCHER SOURCE HEADER88// =============================================================================8990import Foundation91import SwiftUI92import Testing93@testable import ORIXAppUI9495@Suite("Integration · app model") @MainActor struct AppUITests {96    @Test func modelLoadsSeededStateAndRendersTheApprovalCard() async throws {97        let model = try await PreviewEnvironment.make()98        #expect(model.settings.onboardingCompleted)99        #expect(try await model.services.store.runs(limit: 50).count == 6)100        let access = AccessRequest(runID: "r", callID: "c", toolID: "filesystem.move", capabilities: [.fileWrite(path: "/Users/x/Downloads/Sorted")],101                                   tier: .reversibleWrite, sideEffect: .write, mode: .guided, summary: "Move 14 files from ~/Downloads to ~/Downloads/Sorted",102                                   argumentsPreview: ["source": "~/Downloads", "destination": "~/Downloads/Sorted"])103        let req = ApprovalRequest(access: access, missing: access.capabilities, reason: "No grant covers writing to this folder.")104        let out = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("orix-approval-card.png")105        try await ShotRenderer.render(ApprovalCard(request: req) { _ in }.padding(24).environment(model), size: CGSize(width: 560, height: 420), to: out)106        let size = (try FileManager.default.attributesOfItem(atPath: out.path)[.size] as? Int) ?? 0107        #expect(size > 10_000)108        print("SHOT \(out.path)")109    }110}111
Files main
Menu

Theme