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/PlacesTests.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@MainActor91final class PlacesTests: ORIXUITestCase {92 private var title: XCUIElement { app.staticTexts["panel.title"] }9394 func testSaveAPlaceEditItsNoteAndDeleteIt() {95 launch(region: true)96 search("Biodôme de Montréal")97 require(app.buttons.matching(identifier: "search.result").containing(NSPredicate(format: "label CONTAINS[c] %@", "Biodôme")).firstMatch).tap()98 require(title)99100 // Save.101 let save = require(app.buttons["place.save"])102 XCTAssertEqual(save.label, "Save")103 save.tap()104 require(app.navigationBars["Save place"])105 let name = require(app.textFields["save.name"])106 XCTAssertTrue((name.value as? String ?? "").contains("Biodôme"))107 app.buttons["save.confirm"].tap()108 wait("the card shows the place as saved") { app.buttons["place.save"].exists && app.buttons["place.save"].label == "Saved" }109110 // It appears in Collections.111 require(app.buttons["panel.close"]).tap()112 openMenu(.collections)113 require(app.navigationBars["Collections"])114 require(element("collections.row.Favourites")).tap()115 let row = require(app.buttons.containing(NSPredicate(format: "label CONTAINS[c] %@", "Biodôme")).firstMatch, "the saved place is listed in its collection")116 screenshot("collection-detail")117 row.tap()118119 // Edit the note from the card.120 require(title)121 require(app.buttons["place.save"]).tap()122 require(app.navigationBars["Edit saved place"])123 let note = require(element("save.note"))124 note.tap()125 note.typeText("Pingouins au sous-sol")126 app.buttons["save.confirm"].tap()127 require(text(containing: "Pingouins au sous-sol"), "the note is shown on the card")128 screenshot("place-card-saved-note")129130 // Delete.131 app.buttons["place.save"].tap()132 require(app.buttons["save.remove"]).tap()133 wait("the card shows the place as not saved") { app.buttons["place.save"].exists && app.buttons["place.save"].label == "Save" }134 XCTAssertFalse(text(containing: "Pingouins au sous-sol").exists)135 app.buttons["panel.close"].tap()136 openMenu(.collections)137 require(element("collections.row.Favourites")).tap()138 require(app.staticTexts["No place saved here"])139 }140141 func testLongPressDropsAPinWithCoordinatesAndTheNearestAddress() {142 launch(region: true, camera: "45.5088,-73.5540,16")143 require(map)144 mapPoint().press(forDuration: 1.2)145 require(title, "a long press opens the card of a dropped pin")146 XCTAssertTrue(title.label.hasPrefix("45.5") && title.label.contains("-73.5"), "the title is the coordinates: \(title.label)")147 let subtitle = require(app.staticTexts["panel.subtitle"], "the nearest address is looked up in the installed region")148 XCTAssertFalse(subtitle.label.isEmpty)149 screenshot("dropped-pin")150 // Tapping the empty map dismisses a dropped pin.151 app.buttons["panel.close"].tap()152 require(app.textFields["search.field"])153 }154155 func testLongPressWithNoRegionStillGivesCoordinates() {156 launch(camera: "45.5088,-73.5540,5")157 require(map)158 mapPoint().press(forDuration: 1.2)159 require(title)160 XCTAssertFalse(app.staticTexts["panel.subtitle"].exists, "no address is invented without a region")161 require(app.buttons.containing(NSPredicate(format: "label BEGINSWITH %@", "Copy ")).firstMatch)162 }163164 func testNewCollectionAndBackup() {165 launch()166 openMenu(.collections)167 require(app.buttons["collections.new"]).tap()168 let name = require(app.textFields["collection.name"])169 name.tap()170 name.typeText("Voyage")171 app.buttons["collection.save"].tap()172 require(element("collections.row.Voyage"))173 // Nothing saved yet: the backup says so instead of producing an empty file.174 app.buttons["Back up everything to a file"].tap()175 require(app.buttons["Share the backup file"], "a backup file is offered (collections exist)")176 }177}178