Files
dotdenote/UITests/AccountDeletionUITests.swift
andros 2989d746fa Fix unresponsive account deletion button (App Store 2.1a), bump to build 5
The account deletion button reset credentials synchronously, which
flipped isConfigured to false and tore down the view hosting the
settings sheet mid-dismissal, leaving the sheet stuck on screen so the
button appeared unresponsive.

Now the button shows a confirmation dialog and the credential reset is
deferred until the sheet finishes dismissing. Add a UI test covering the
full delete flow and bump the build number to 5 for resubmission.
2026-07-15 11:44:48 +02:00

53 lines
2.2 KiB
Swift

import XCTest
/// Regression test for the App Store rejection (Guideline 2.1a): the
/// "disconnect & delete account data" button was unresponsive. This drives the
/// full flow: open settings, tap delete, confirm, and verify the app returns to
/// the initial connect screen with the account data cleared.
final class AccountDeletionUITests: XCTestCase {
override func setUpWithError() throws {
continueAfterFailure = false
}
private func launchConfigured() -> XCUIApplication {
let app = XCUIApplication()
// Argument-domain overrides win over the app's persisted UserDefaults,
// so the app starts already connected to the test server.
app.launchArguments = [
"-webdav.url", "https://test-denote.andros.dev",
"-webdav.username", "reviewer",
"-webdav.notesPath", "/notes/",
"-debug.password", "DenoteTest2026",
]
app.launch()
return app
}
func testDeleteAccountButtonIsResponsiveAndClearsData() throws {
let app = launchConfigured()
// We start on the note list.
let settingsButton = app.buttons["M-x settings"]
XCTAssertTrue(settingsButton.waitForExistence(timeout: 10), "note list did not appear")
settingsButton.tap()
// Reach the delete button (scroll if needed).
let deleteButton = app.buttons["[ disconnect & delete account data ]"]
XCTAssertTrue(deleteButton.waitForExistence(timeout: 5), "delete button not found in settings")
if !deleteButton.isHittable {
app.swipeUp()
}
deleteButton.tap()
// The button must respond by showing the confirmation alert.
let alert = app.alerts["Delete account data?"]
XCTAssertTrue(alert.waitForExistence(timeout: 5), "delete button was unresponsive: no confirmation alert")
alert.buttons["Delete"].tap()
// After deletion we land back on the initial connect screen.
let testConnection = app.buttons["[ test connection ]"]
XCTAssertTrue(testConnection.waitForExistence(timeout: 5), "did not return to connect screen after deletion")
XCTAssertFalse(app.buttons["M-x settings"].exists, "still showing the note list after deletion")
}
}