Companion to EmptyStateScreenshotUITests: seeds a fresh verified account with realistic data (residences, tasks across kanban columns, contractors, documents + warranties) and screenshots each populated tab. Exploratory visual harness. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,74 @@
|
|||||||
|
import XCTest
|
||||||
|
|
||||||
|
/// Exploratory companion to `EmptyStateScreenshotUITests`: capture every main
|
||||||
|
/// tab for a FRESH, verified user whose account has been seeded with realistic
|
||||||
|
/// data (residences, tasks across kanban columns, contractors, documents +
|
||||||
|
/// warranties). Used to eyeball how the populated views look. Not part of the
|
||||||
|
/// regular run — kept as a quick visual harness.
|
||||||
|
final class PopulatedStateScreenshotUITests: AuthenticatedUITestCase {
|
||||||
|
|
||||||
|
/// Seed a full, realistic dataset under the fresh account's token BEFORE the
|
||||||
|
/// app logs in, so the post-login fetch loads everything (anything seeded
|
||||||
|
/// after login is invisible until a manual refresh).
|
||||||
|
override func seedAccountPreconditions(_ account: TestAccount) {
|
||||||
|
// --- Residences (two, so the list shows multiple cards) ---
|
||||||
|
let home = TestDataSeeder.createResidenceWithAddress(
|
||||||
|
token: account.token,
|
||||||
|
name: "Maple Street House",
|
||||||
|
street: "412 Maple Street",
|
||||||
|
city: "Austin",
|
||||||
|
state: "TX",
|
||||||
|
postalCode: "78704"
|
||||||
|
)
|
||||||
|
_ = TestDataSeeder.createResidenceWithAddress(
|
||||||
|
token: account.token,
|
||||||
|
name: "Lakeside Cabin",
|
||||||
|
street: "9 Birch Trail",
|
||||||
|
city: "Marble Falls",
|
||||||
|
state: "TX",
|
||||||
|
postalCode: "78654"
|
||||||
|
)
|
||||||
|
|
||||||
|
// --- Tasks (spread across overdue / due-soon / upcoming / no-date) ---
|
||||||
|
TestDataSeeder.createTaskWithDueDate(token: account.token, residenceId: home.id, title: "Clean gutters", daysFromNow: -2)
|
||||||
|
TestDataSeeder.createTaskWithDueDate(token: account.token, residenceId: home.id, title: "Replace HVAC filter", daysFromNow: 3)
|
||||||
|
TestDataSeeder.createTaskWithDueDate(token: account.token, residenceId: home.id, title: "Service water heater", daysFromNow: 12)
|
||||||
|
TestDataSeeder.createTaskWithDueDate(token: account.token, residenceId: home.id, title: "Test smoke detectors", daysFromNow: 30)
|
||||||
|
TestDataSeeder.createTaskWithDueDate(token: account.token, residenceId: home.id, title: "Reseal driveway", daysFromNow: 45)
|
||||||
|
TestDataSeeder.createTask(token: account.token, residenceId: home.id, title: "Touch up exterior paint")
|
||||||
|
|
||||||
|
// --- Contractors (with contact info so cards look complete) ---
|
||||||
|
TestDataSeeder.createContractor(token: account.token, name: "Bob's Plumbing",
|
||||||
|
fields: ["company": "Bob's Plumbing LLC", "phone": "512-555-0142", "email": "bob@bobsplumbing.test"])
|
||||||
|
TestDataSeeder.createContractor(token: account.token, name: "Spark Electric",
|
||||||
|
fields: ["company": "Spark Electric Co", "phone": "512-555-0188", "email": "hello@sparkelectric.test"])
|
||||||
|
TestDataSeeder.createContractor(token: account.token, name: "GreenLeaf Landscaping",
|
||||||
|
fields: ["company": "GreenLeaf Landscaping", "phone": "512-555-0203", "email": "team@greenleaf.test"])
|
||||||
|
|
||||||
|
// --- Documents + Warranties (the Documents tab has both segments) ---
|
||||||
|
TestDataSeeder.createDocument(token: account.token, residenceId: home.id, title: "Home Insurance Policy", documentType: "general")
|
||||||
|
TestDataSeeder.createDocument(token: account.token, residenceId: home.id, title: "Mortgage Agreement", documentType: "general")
|
||||||
|
TestDataSeeder.createDocument(token: account.token, residenceId: home.id, title: "Roof Inspection Report", documentType: "general")
|
||||||
|
TestDataSeeder.createDocument(token: account.token, residenceId: home.id, title: "HVAC System Warranty", documentType: "warranty")
|
||||||
|
TestDataSeeder.createDocument(token: account.token, residenceId: home.id, title: "Refrigerator Warranty", documentType: "warranty")
|
||||||
|
}
|
||||||
|
|
||||||
|
func test_capturePopulatedTabStates() {
|
||||||
|
let tabs: [(name: String, nav: () -> Void)] = [
|
||||||
|
("01-Residences", { self.navigateToResidences() }),
|
||||||
|
("02-Tasks", { self.navigateToTasks() }),
|
||||||
|
("03-Contractors",{ self.navigateToContractors() }),
|
||||||
|
("04-Documents", { self.navigateToDocuments() }),
|
||||||
|
]
|
||||||
|
|
||||||
|
for tab in tabs {
|
||||||
|
tab.nav()
|
||||||
|
// Let the screen's data fetch land and the list render fully.
|
||||||
|
RunLoop.current.run(until: Date().addingTimeInterval(2.5))
|
||||||
|
let shot = XCTAttachment(screenshot: app.screenshot())
|
||||||
|
shot.name = "Populated-\(tab.name)"
|
||||||
|
shot.lifetime = .keepAlways
|
||||||
|
add(shot)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user