Repository Public
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : Vrai-Prix iOS9// File : VraiPrixUITests/MainFlowUITests.swift10// Description : parcours principaux contre l'API de préproduction —11// adresse → estimation, favoris, registre, carte, marché,12// propriétés à vendre, hors ligne, audit d'accessibilité.13// Captures jointes au résultat.14// Module : VraiPrixUITests15// Repository : https://git.spboucher.ai/vrai-prix-ios-v316// Project Website : https://www.vrai-prix.com17// Created : 2026-11-2618// Last Modified : 2026-11-2819//20// =============================================================================21// AUTHOR & PROFESSIONAL AFFILIATION22// =============================================================================23//24// Author : Simon-Pierre Boucher25// Position : Professor of Finance26// Institution : Université du Québec en Outaouais (UQO)27// Department : Département des sciences administratives28// Organization : SP Boucher29//30// Website : https://spboucher.ai31// Git : https://git.spboucher.ai32//33// =============================================================================34// OFFICIAL CONTACT DIRECTORY35// =============================================================================36//37// General : info@spboucher.ai38// Professional : contact@spboucher.ai39// Direct : simon@spboucher.ai40// Research : research@spboucher.ai41// Development : dev@spboucher.ai42// Support : support@spboucher.ai43// Security/Admin : admin@spboucher.ai44// Notifications : notifications@spboucher.ai45//46// Preferred Contact: support@spboucher.ai47//48// =============================================================================49// COPYRIGHT & INTELLECTUAL PROPERTY50// =============================================================================51//52// Copyright (c) 202653// Simon-Pierre Boucher54//55// All rights reserved where applicable.56//57// This file is governed by the applicable project license,58// copyright notices, institutional agreements and relevant law.59//60// Unless expressly authorized by the applicable license or61// rights holder, copying, redistribution, sublicensing,62// publication and commercial exploitation are not permitted.63//64// Existing third-party rights and notices remain unaffected.65//66// =============================================================================67// CONFIDENTIALITY & SECURITY68// =============================================================================69//70// Classification : Public71// Distribution : Public repository; use is governed by the project license72// Security Contact : admin@spboucher.ai73//74// Access to this source does not independently grant permission75// to redistribute or disclose confidential materials.76//77// Do not embed credentials, private keys, access tokens,78// certificates or confidential personal information.79//80// =============================================================================81// LICENSE & MAINTENANCE82// =============================================================================83//84// License : None specified (no license file in this repository)85// Maintainer : Simon-Pierre Boucher86// Technical Contact: dev@spboucher.ai87//88// =============================================================================89// END OF SP BOUCHER SOURCE HEADER90// =============================================================================9192import XCTest9394@MainActor95final class MainFlowUITests: XCTestCase {96 private let unit = "23027459435665110000000" // 5681, rue des Campanules, Québec9798 private func launch(_ args: [String]) -> XCUIApplication {99 continueAfterFailure = false100 let app = XCUIApplication()101 // niveau API 2 imposé : ces parcours sont ceux du repli, valables que la production serve ou non la v3102 app.launchArguments = ["-VPInMemory", "YES", "-VPPlumb", "courte", "-VPHero", "gable", "-VPLevel", "v2"] + args103 app.launch()104 return app105 }106107 private func attach(_ app: XCUIApplication, _ name: String) {108 let a = XCTAttachment(screenshot: app.screenshot())109 a.name = name; a.lifetime = .keepAlways110 add(a)111 }112113 func testHomeShowsSearchAndRecentSales() {114 let app = launch(["-VPTab", "home"])115 XCTAssertTrue(app.textFields["address-search"].waitForExistence(timeout: 15))116 XCTAssertTrue(app.staticTexts["Ventes récentes"].waitForExistence(timeout: 15))117 XCTAssertTrue(app.staticTexts["Registre des ventes"].waitForExistence(timeout: 15))118 attach(app, "accueil")119 }120121 func testAddressSearchRevealsEstimate() {122 let app = launch(["-VPTab", "home", "-VPQuery", "5681 campan"])123 let first = app.buttons["search-result-0"]124 XCTAssertTrue(first.waitForExistence(timeout: 20), "l'autocomplétion propose l'adresse")125 first.tap()126 XCTAssertTrue(app.staticTexts["property-title"].waitForExistence(timeout: 20))127 XCTAssertTrue(app.otherElements["plumb-scene"].waitForExistence(timeout: 20), "la mesure s'affiche")128 let label = app.otherElements["plumb-scene"].label129 XCTAssertTrue(label.contains("Valeur estimée") && label.contains("Fourchette"), label)130 XCTAssertTrue(app.staticTexts["Fiabilité de l'estimation"].waitForExistence(timeout: 10) || app.staticTexts["Caractéristiques"].exists)131 attach(app, "estimation")132 }133134 func testFavoriteAppearsInLibrary() {135 let app = launch(["-VPOpen", "propriete/\(unit)"])136 let heart = app.buttons["favorite-button"]137 XCTAssertTrue(heart.waitForExistence(timeout: 20))138 heart.tap()139 app.buttons["Favoris"].firstMatch.tap()140 XCTAssertTrue(app.staticTexts["5681 Rue Campanules"].waitForExistence(timeout: 10), "le favori figure dans la bibliothèque")141 attach(app, "favoris")142 }143144 func testSalesRegistryListsSales() {145 let app = launch(["-VPTab", "sales"])146 XCTAssertTrue(app.buttons["sale-row-0"].waitForExistence(timeout: 20))147 XCTAssertTrue(app.staticTexts["sales-count"].label.contains("vente"))148 attach(app, "registre")149 }150151 func testMapLoadsSales() {152 let app = launch(["-VPTab", "map"])153 let status = app.staticTexts["map-status"].firstMatch154 XCTAssertTrue(status.waitForExistence(timeout: 20))155 let loaded = NSPredicate(format: "label CONTAINS 'vente'")156 expectation(for: loaded, evaluatedWith: status)157 waitForExpectations(timeout: 25)158 XCTAssertTrue(app.buttons["map-marker"].firstMatch.waitForExistence(timeout: 15) || status.label.contains("0"))159 attach(app, "carte")160 }161162 func testMarketShowsIndex() {163 let app = launch(["-VPTab", "market"])164 XCTAssertTrue(app.staticTexts["Indice des prix"].waitForExistence(timeout: 20))165 XCTAssertTrue(app.staticTexts["Variation sur 12 mois"].waitForExistence(timeout: 20))166 attach(app, "marche")167 }168169 func testListingOpensWithPriceReading() {170 let app = launch(["-VPTab", "market", "-VPRoute", "listings"])171 let row = app.buttons["listing-row-0"]172 XCTAssertTrue(row.waitForExistence(timeout: 25))173 row.tap()174 XCTAssertTrue(app.staticTexts["listing-title"].waitForExistence(timeout: 25))175 XCTAssertTrue(app.staticTexts["Prix demandé"].firstMatch.waitForExistence(timeout: 15))176 attach(app, "a-vendre")177 }178179 func testOfflineIsSaidPlainly() {180 // adresse injoignable : soit la dernière version en cache avec son bandeau, soit l'état « Hors ligne »181 let app = launch(["-VPTab", "sales", "-VPBaseURL", "http://127.0.0.1:9"])182 let said = app.staticTexts.matching(NSPredicate(format: "label BEGINSWITH 'Hors ligne'")).firstMatch183 XCTAssertTrue(said.waitForExistence(timeout: 25), "la panne de réseau est dite")184 attach(app, "hors-ligne")185 }186187 func testAccessibilityAuditOnHomeAndSettings() throws {188 let app = launch(["-VPTab", "home"])189 XCTAssertTrue(app.staticTexts["Ventes récentes"].waitForExistence(timeout: 15))190 try app.performAccessibilityAudit(for: [.sufficientElementDescription, .elementDetection])191 let settings = launch(["-VPTab", "market", "-VPRoute", "settings"])192 XCTAssertTrue(settings.staticTexts["Réglages"].firstMatch.waitForExistence(timeout: 15))193 try settings.performAccessibilityAudit(for: [.sufficientElementDescription, .elementDetection])194 }195}196