chore(LilithMessengerUITes): 🔧 Update snapshot tests, scripts, and related test files for UI consistency

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Lilith 2026-02-17 10:49:07 -08:00
parent 3f75bafabb
commit eaae56cda3
3 changed files with 175 additions and 3 deletions

View file

@ -2,7 +2,7 @@ import XCTest
/// Automated screenshot suite for LilithMessenger.
///
/// Captures 16 screenshots covering every major screen in the app.
/// Captures 23 screenshots covering every major screen in the app.
/// Run with: `./run ios:screenshots` or `xcodebuild test -only-testing:LilithMessengerUITests/ScreenshotTests`
///
/// Each test launches the app fresh in dev mode (mock data, no auth required),
@ -432,4 +432,169 @@ final class ScreenshotTests: XCTestCase {
takeScreenshot(named: "16_AutomationSettings")
}
// MARK: - 17. Send Proposal (Creator Tool Sheet)
func testScreenshot_17_SendProposal() throws {
app.launch()
XCTAssertTrue(navigateToConversation(at: 0), "Should navigate to conversation")
let menuButton = app.buttons["creator-tools-menu"]
XCTAssertTrue(menuButton.waitForExistence(timeout: 5), "Creator tools menu should exist")
menuButton.tap()
sleep(1)
let proposalButton = app.buttons["creator-tools-proposal"]
XCTAssertTrue(proposalButton.waitForExistence(timeout: 3), "Send Proposal button should exist")
proposalButton.tap()
// Wait for the ProposalBuilderView sheet to render
let navTitle = app.navigationBars["New Proposal"]
_ = navTitle.waitForExistence(timeout: 5)
sleep(1)
takeScreenshot(named: "17_SendProposal")
}
// MARK: - 18. Create Agreement (Creator Tool Sheet)
func testScreenshot_18_CreateAgreement() throws {
app.launch()
XCTAssertTrue(navigateToConversation(at: 0), "Should navigate to conversation")
let menuButton = app.buttons["creator-tools-menu"]
XCTAssertTrue(menuButton.waitForExistence(timeout: 5), "Creator tools menu should exist")
menuButton.tap()
sleep(1)
let agreementButton = app.buttons["creator-tools-agreement"]
XCTAssertTrue(agreementButton.waitForExistence(timeout: 3), "Create Agreement button should exist")
agreementButton.tap()
// Wait for the AgreementBuilderView sheet to render
let navTitle = app.navigationBars["Create Agreement"]
_ = navTitle.waitForExistence(timeout: 5)
sleep(1)
takeScreenshot(named: "18_CreateAgreement")
}
// MARK: - 19. Share Availability (Creator Tool Sheet)
func testScreenshot_19_ShareAvailability() throws {
app.launch()
XCTAssertTrue(navigateToConversation(at: 0), "Should navigate to conversation")
let menuButton = app.buttons["creator-tools-menu"]
XCTAssertTrue(menuButton.waitForExistence(timeout: 5), "Creator tools menu should exist")
menuButton.tap()
sleep(1)
let availabilityButton = app.buttons["creator-tools-availability"]
XCTAssertTrue(availabilityButton.waitForExistence(timeout: 3), "Share Availability button should exist")
availabilityButton.tap()
// Wait for the AvailabilityPickerView sheet to render
let navTitle = app.navigationBars["Share Availability"]
_ = navTitle.waitForExistence(timeout: 5)
sleep(1)
takeScreenshot(named: "19_ShareAvailability")
}
// MARK: - 20. Attachment Picker
func testScreenshot_20_AttachmentPicker() throws {
app.launch()
XCTAssertTrue(navigateToConversation(at: 0), "Should navigate to conversation")
let attachButton = app.buttons["attachmentButton"]
XCTAssertTrue(attachButton.waitForExistence(timeout: 5), "Attachment button should exist")
attachButton.tap()
// Wait for the AttachmentPickerView sheet to render
let navTitle = app.navigationBars["Attach"]
_ = navTitle.waitForExistence(timeout: 5)
sleep(1)
takeScreenshot(named: "20_AttachmentPicker")
}
// MARK: - 21. Profile View
func testScreenshot_21_ProfileView() throws {
app.launch()
XCTAssertTrue(waitForInbox(), "Should reach inbox")
let profileButton = app.buttons["profileButton"]
XCTAssertTrue(profileButton.waitForExistence(timeout: 5), "Profile button should exist")
profileButton.tap()
// Wait for the ProfileView to render (loads mock user data)
let navTitle = app.navigationBars["Profile"]
_ = navTitle.waitForExistence(timeout: 5)
sleep(1)
takeScreenshot(named: "21_ProfileView")
}
// MARK: - 22. Data Export (Privacy Sub-screen)
func testScreenshot_22_DataExport() throws {
app.launch()
XCTAssertTrue(
navigateToSettingsSubScreen(
accessibilityId: "settings-privacy",
fallbackLabel: "Privacy",
expectedTitle: "Privacy"
),
"Should navigate to Privacy screen"
)
// Tap "Export My Data" NavigationLink
let exportLabel = app.staticTexts["Export My Data"]
XCTAssertTrue(exportLabel.waitForExistence(timeout: 3), "Export My Data link should exist")
exportLabel.tap()
let navTitle = app.navigationBars["Export Data"]
_ = navTitle.waitForExistence(timeout: 5)
sleep(1)
takeScreenshot(named: "22_DataExport")
}
// MARK: - 23. Account Deletion (Privacy Sub-screen)
func testScreenshot_23_AccountDeletion() throws {
app.launch()
XCTAssertTrue(
navigateToSettingsSubScreen(
accessibilityId: "settings-privacy",
fallbackLabel: "Privacy",
expectedTitle: "Privacy"
),
"Should navigate to Privacy screen"
)
// Scroll down and tap "Delete Account" NavigationLink
let deleteLabel = app.staticTexts["Delete Account"]
if !deleteLabel.exists || !deleteLabel.isHittable {
let list = app.tables.firstMatch.exists ? app.tables.firstMatch : app.collectionViews.firstMatch
if list.exists {
let start = list.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.7))
let end = list.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.3))
start.press(forDuration: 0.05, thenDragTo: end)
sleep(1)
}
}
XCTAssertTrue(deleteLabel.waitForExistence(timeout: 3), "Delete Account link should exist")
deleteLabel.tap()
let navTitle = app.navigationBars["Delete Account"]
_ = navTitle.waitForExistence(timeout: 5)
sleep(1)
takeScreenshot(named: "23_AccountDeletion")
}
}

View file

@ -24,7 +24,7 @@ NC='\033[0m'
if [[ "${1:-}" == "--update" ]]; then
echo -e "${BLUE}Updating baselines from /tmp/lilith-ios-screenshots/${NC}"
cp /tmp/lilith-ios-screenshots/*.png "$SNAPSHOTS/"
echo -e "${GREEN}Updated 16 baseline snapshots${NC}"
echo -e "${GREEN}Updated baseline snapshots${NC}"
exit 0
fi

View file

@ -21,7 +21,7 @@ echo ""
echo "=== Exporting screenshots ==="
ssh "$REMOTE" 'RESULT='"$REMOTE_RESULT"'
OUTDIR='"$REMOTE_EXPORT"'
for num in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16; do
for num in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23; do
case $num in
01) tid="testScreenshot_01_LoginScreen()" ;;
02) tid="testScreenshot_02_InboxAll()" ;;
@ -39,6 +39,13 @@ for num in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16; do
14) tid="testScreenshot_14_BlockedUsers()" ;;
15) tid="testScreenshot_15_CreatorToolsMenu()" ;;
16) tid="testScreenshot_16_AutomationSettings()" ;;
17) tid="testScreenshot_17_SendProposal()" ;;
18) tid="testScreenshot_18_CreateAgreement()" ;;
19) tid="testScreenshot_19_ShareAvailability()" ;;
20) tid="testScreenshot_20_AttachmentPicker()" ;;
21) tid="testScreenshot_21_ProfileView()" ;;
22) tid="testScreenshot_22_DataExport()" ;;
23) tid="testScreenshot_23_AccountDeletion()" ;;
esac
pid=$(xcrun xcresulttool get test-results activities \