SPB Git

Repository Public BSD-3-Clause

ScreenshotTour.swift 10.2 KB 231 lines swift

1// =============================================================================2//                  SP BOUCHER | SOFTWARE & RESEARCH3//             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project          : ORIX Maps9// File             : Apps/ORIXMaps/Tests/ORIXMapsUITests/ScreenshotTour.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 CoreLocation89import XCTest9091/// Walks through every screen and keeps a capture of each, in English and French, light and dark.92/// `scripts/uitest.sh iphone|ipad --screenshots -only-testing:ORIXMapsUITests/ScreenshotTour` copies them to docs/screenshots.93/// Navigation uses identifiers only, so that the same walk works in both languages.94@MainActor95final class ScreenshotTour: ORIXUITestCase {96    func testEnglishLight() throws { try requireLightPhase(); tour() }97    func testEnglishDark() throws { try requireDarkPhase(); tour() }98    func testFrenchLight() throws { try requireLightPhase(); language = ("fr", "fr_CA"); tour() }99    func testFrenchDark() throws { try requireDarkPhase(); language = ("fr", "fr_CA"); tour() }100101    private func shot(_ name: String) { usleep(700_000); documentationScreenshot(name) }102103    private func tour() {104        XCUIDevice.shared.location = XCUILocation(location: CLLocation(latitude: 45.5017, longitude: -73.5673))105106        // Onboarding.107        launch(onboarding: true, camera: nil)108        require(app.buttons["onboarding.next"])109        shot("01-onboarding-1")110        app.buttons["onboarding.next"].tap(); shot("02-onboarding-2")111        app.buttons["onboarding.next"].tap(); shot("03-onboarding-3")112        app.buttons["onboarding.next"].tap()113114        // No region yet.115        require(app.buttons["home.browse"])116        shot("04-map-empty-state")117        app.buttons["home.browse"].tap()118        require(app.buttons["downloads.get.\(Place.region)"])119        shot("05-downloads-catalog")120        app.buttons["downloads.get.\(Place.region)"].tap()121        require(element("downloads.installed.\(Place.region)"), timeout: 180)122        shot("06-downloads-installed")123        closeModal()124        app.terminate()125126        // Map, search, place.127        launch(reset: false)128        waitForRegion()129        sleep(2)130        shot("07-map-region")131        app.buttons["category.cafe"].tap()132        require(app.buttons.matching(identifier: "search.result").firstMatch)133        sleep(2)134        shot("08-search-category")135        app.buttons["search.clear"].tap()136        search("Stade olympique")137        require(app.buttons.matching(identifier: "search.result").firstMatch)138        shot("09-search-results")139        app.buttons.matching(identifier: "search.result").firstMatch.tap()140        require(app.buttons["place.directions"])141        sleep(2)142        shot("10-place-card")143        app.buttons["place.save"].tap()144        require(app.buttons["save.confirm"])145        shot("11-save-place")146        app.buttons["save.confirm"].tap()147        require(app.buttons["panel.close"]).tap()148        app.buttons["search.clear"].tap()149        require(app.buttons.matching(identifier: "home.saved").firstMatch)150        shot("12-home-saved-and-recents")151        search("zzqxjkvwpt")152        shot("13-search-nothing-found")153        app.buttons["search.clear"].tap()154155        // Menu screens.156        openMenu(.collections); require(app.buttons["collections.new"]); shot("14-collections")157        app.descendants(matching: .any).matching(NSPredicate(format: "identifier BEGINSWITH %@", "collections.row.")).firstMatch.tap(); shot("15-collection-detail")158        app.navigationBars.buttons.firstMatch.tap()159        closeModal()160        app.buttons["map.layers"].tap(); require(app.buttons["theme.orix.day"]); shot("16-layers-themes")161        closeModal()162        openMenu(.studio); require(app.buttons["studio.duplicate.orix.day"]); shot("17-map-studio")163        app.buttons["studio.duplicate.orix.day"].tap()164        require(app.descendants(matching: .any).matching(NSPredicate(format: "identifier BEGINSWITH %@", "studio.custom.")).firstMatch).tap()165        shot("18-theme-editor")166        app.swipeUp(velocity: .fast); app.swipeUp(velocity: .fast); app.swipeUp(velocity: .fast)167        shot("19-theme-editor-colours")168        app.navigationBars.buttons.firstMatch.tap()169        closeModal()170        app.buttons["map.layers"].tap(); require(app.buttons["theme.orix.day"]).tap(); closeModal()171        openMenu(.tracks); require(app.buttons["tracks.record"]); shot("20-tracks")172        closeModal()173        openMenu(.compass); sleep(3); shot("21-compass")174        closeModal()175        openMenu(.explorer); sleep(3); shot("22-explorer")176        closeModal()177        openMenu(.settings); require(app.navigationBars.firstMatch); shot("23-settings")178        app.swipeUp(); shot("24-settings-guidance")179        scrollTo(element("settings.privacy")).tap(); shot("25-privacy")180        app.navigationBars.buttons.firstMatch.tap()181        closeModal()182        openMenu(.about); require(element("about.list")); shot("26-about")183        closeModal()184        openMenu(.measure)185        // One tap at a time: two quick taps would be a double tap (zoom).186        for (dx, dy) in [(0.25, 0.18), (0.65, 0.18), (0.45, 0.36)] { mapPoint(dx: dx, dy: dy).tap(); sleep(1) }187        shot("27-measure")188        app.buttons["panel.close"].tap()189190        // Track recording.191        openMenu(.tracks)192        app.buttons["tracks.record"].tap()193        _ = answerLocationPrompt(allow: true, timeout: 2)194        for step in 1...8 { XCUIDevice.shared.location = XCUILocation(location: CLLocation(latitude: 45.5017 + Double(step) * 0.0001, longitude: -73.5673)); sleep(2) }195        shot("28-track-recording")196        app.buttons["track.stop"].tap()197        require(app.buttons["track.stop.confirm"].firstMatch).tap()198        openMenu(.tracks)199        require(app.buttons.matching(identifier: "tracks.row").firstMatch).tap()200        shot("29-track-statistics")201        app.navigationBars.buttons.firstMatch.tap()202        closeModal()203        app.terminate()204205        // Directions, planner, guidance.206        let trip = ["-ORIXRouteFrom", Place.downtown, "-ORIXRouteTo", Place.olympicStadium]207        launch(reset: false, extra: trip)208        require(app.buttons["directions.route.0"], timeout: 60)209        sleep(2)210        shot("30-directions")211        app.swipeUp()212        require(element("directions.steps")).tap()213        shot("31-directions-steps")214        app.terminate()215        launch(reset: false, extra: trip + ["-ORIXScreen", "planner"])216        require(element("planner.list"), timeout: 60)217        sleep(3)218        shot("32-trip-planner")219        app.terminate()220        launch(reset: false, extra: trip + ["-ORIXSimulate", "YES"])221        require(element("navigation.banner"), timeout: 60)222        sleep(6)223        shot("33-guidance")224        app.buttons["navigation.end"].tap()225        app.terminate()226        launch(reset: false, extra: ["-ORIXRouteFrom", Place.downtown, "-ORIXRouteTo", "45.5040,-73.5700", "-ORIXMode", "walk", "-ORIXSimulate", "YES"])227        require(app.buttons["navigation.done"], timeout: 180)228        shot("34-guidance-arrived")229    }230}231
Files main
Menu

Theme