Repository Public BSD-3-Clause
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : ORIX Maps9// File : Apps/ORIXMaps/Tests/ORIXMapsUITests/PadTests.swift10// Module : ORIXMapsUITests11// Repository : https://git.spboucher.ai/orix-maps12// Created : 2026-11-2513// Last Modified : 2026-11-2514//15// =============================================================================16// AUTHOR & PROFESSIONAL AFFILIATION17// =============================================================================18//19// Author : Simon-Pierre Boucher20// Position : Professor of Finance21// Institution : Université du Québec en Outaouais (UQO)22// Department : Département des sciences administratives23// Organization : SP Boucher24//25// Website : https://spboucher.ai26// Git : https://git.spboucher.ai27//28// =============================================================================29// OFFICIAL CONTACT DIRECTORY30// =============================================================================31//32// General : info@spboucher.ai33// Professional : contact@spboucher.ai34// Direct : simon@spboucher.ai35// Research : research@spboucher.ai36// Development : dev@spboucher.ai37// Support : support@spboucher.ai38// Security/Admin : admin@spboucher.ai39// Notifications : notifications@spboucher.ai40//41// Preferred Contact: support@spboucher.ai42//43// =============================================================================44// COPYRIGHT & INTELLECTUAL PROPERTY45// =============================================================================46//47// Copyright (c) 202648// Simon-Pierre Boucher49//50// All rights reserved where applicable.51//52// This file is governed by the applicable project license,53// copyright notices, institutional agreements and relevant law.54//55// Unless expressly authorized by the applicable license or56// rights holder, copying, redistribution, sublicensing,57// publication and commercial exploitation are not permitted.58//59// Existing third-party rights and notices remain unaffected.60//61// =============================================================================62// CONFIDENTIALITY & SECURITY63// =============================================================================64//65// Classification : Public66// Distribution : Public repository; use is governed by the project license67// Security Contact : admin@spboucher.ai68//69// Access to this source does not independently grant permission70// to redistribute or disclose confidential materials.71//72// Do not embed credentials, private keys, access tokens,73// certificates or confidential personal information.74//75// =============================================================================76// LICENSE & MAINTENANCE77// =============================================================================78//79// License : Proprietary, all rights reserved (see license file)80// License File : LICENSE81// Maintainer : Simon-Pierre Boucher82// Technical Contact: dev@spboucher.ai83//84// =============================================================================85// END OF SP BOUCHER SOURCE HEADER86// =============================================================================8788import XCTest8990/// iPad layout: the panel is a side column, not a sheet, and the main flows work. Runs on "ORIXMaps iPad" (scripts/uitest.sh ipad).91@MainActor92final class PadTests: ORIXUITestCase {93 override func setUp() async throws {94 try await super.setUp()95 try XCTSkipUnless(isPad, "iPad only — run scripts/uitest.sh ipad")96 }9798 private var grabber: XCUIElement { app.buttons["Sheet Grabber"] }99100 func testThePanelIsASideColumn() {101 launch()102 let field = require(app.textFields["search.field"])103 let window = app.windows.firstMatch.frame104 XCTAssertFalse(grabber.exists, "no bottom sheet on iPad")105 XCTAssertLessThan(field.frame.maxX, 420, "the search field is in the side panel")106 XCTAssertLessThan(field.frame.minY, 140, "the side panel starts at the top")107 XCTAssertEqual(require(map).frame.width, window.width, accuracy: 1, "the map fills the window behind the panel")108 XCTAssertGreaterThan(app.buttons["map.layers"].frame.minX, window.width - 80, "map controls stay at the top right")109 screenshot("ipad-side-panel")110 // Portrait keeps the side panel.111 XCUIDevice.shared.orientation = .portrait112 sleep(1)113 XCTAssertFalse(grabber.exists)114 XCTAssertLessThan(app.textFields["search.field"].frame.maxX, 420)115 screenshot("ipad-side-panel-portrait")116 XCUIDevice.shared.orientation = .landscapeLeft117 }118119 func testDownloadSearchPlaceAndSaveInTheSidePanel() {120 launch()121 require(app.staticTexts["No map downloaded yet"])122 app.buttons["home.browse"].tap()123 require(app.buttons["downloads.get.\(Place.region)"]).tap()124 require(element("downloads.installed.\(Place.region)"), timeout: 180)125 closeModal()126 waitForRegion(timeout: 30)127128 search("Stade olympique")129 let hit = require(app.buttons.matching(identifier: "search.result").firstMatch)130 XCTAssertLessThan(hit.frame.maxX, 420, "results are listed in the side panel")131 hit.tap()132 let title = require(app.staticTexts["panel.title"])133 XCTAssertLessThan(title.frame.maxX, 420, "the place card replaces the panel content")134 XCTAssertTrue(title.label.contains("Stade olympique"))135 app.buttons["place.save"].tap()136 require(app.buttons["save.confirm"]).tap()137 wait("the place is saved") { self.app.buttons["place.save"].label == "Saved" }138 screenshot("ipad-place-card")139 app.buttons["panel.close"].tap()140 openMenu(.collections)141 require(app.buttons["collections.new"])142 closeModal()143 }144145 func testDirectionsAndSimulatedGuidance() {146 launch(region: true, extra: ["-ORIXRouteFrom", Place.downtown, "-ORIXRouteTo", Place.olympicStadium])147 let card = require(app.buttons["directions.route.0"], timeout: 60)148 XCTAssertLessThan(card.frame.maxX, 420)149 require(app.buttons["directions.route.1"])150 screenshot("ipad-directions")151 app.buttons["Walk"].tap()152 wait("a walking route is computed", timeout: 60) { self.app.buttons["directions.route.0"].exists && self.app.buttons["directions.route.0"].label.contains(" h ") }153 app.buttons["Drive"].tap()154 require(app.buttons["directions.simulate"], timeout: 30).tap()155 require(element("navigation.banner"), timeout: 30)156 screenshot("ipad-guidance")157 app.buttons["navigation.end"].tap()158 require(app.textFields["search.field"])159 }160161 func testLongPressAndMeasureOnTheWideMap() {162 launch(region: true, camera: "45.5088,-73.5540,16")163 mapPoint().press(forDuration: 1.2)164 let title = require(app.staticTexts["panel.title"])165 XCTAssertTrue(title.label.hasPrefix("45.5"))166 app.buttons["panel.close"].tap()167 openMenu(.measure)168 // One tap at a time: two quick taps would be a double tap (zoom).169 mapPoint(dx: 0.3, dy: 0.3).tap()170 wait("one point is measured") { self.app.descendants(matching: .any).matching(NSPredicate(format: "label BEGINSWITH %@ AND label ENDSWITH %@", "1", "Points")).firstMatch.exists }171 mapPoint(dx: 0.7, dy: 0.3).tap()172 wait("two points are measured") { self.app.descendants(matching: .any).matching(NSPredicate(format: "label BEGINSWITH %@ AND label ENDSWITH %@", "2", "Points")).firstMatch.exists }173 screenshot("ipad-measure")174 }175176 func testSettingsAndThemesOpenAsSheets() {177 launch(region: true)178 app.buttons["map.layers"].tap()179 require(app.buttons["theme.orix.midnight"]).tap()180 closeModal()181 openMenu(.settings)182 require(app.navigationBars.firstMatch)183 screenshot("ipad-settings")184 closeModal()185 XCTAssertEqual(app.state, .runningForeground)186 }187}188