Stabilize browser import hint UI tests

This commit is contained in:
Lawrence Chen 2026-03-17 03:14:23 -07:00
parent b9de0f0446
commit 9807cb087b
No known key found for this signature in database
2 changed files with 18 additions and 4 deletions

View file

@ -1443,6 +1443,7 @@ struct BrowserPanelView: View {
}
.buttonStyle(.bordered)
.controlSize(.small)
.accessibilityIdentifier("BrowserImportHintImportButton")
}
private var browserImportHintSettingsButton: some View {

View file

@ -120,7 +120,7 @@ final class BrowserImportProfilesUITests: XCTestCase {
settingsButton.click()
XCTAssertTrue(
app.otherElements["SettingsBrowserSection"].waitForExistence(timeout: 5.0),
app.switches["SettingsBrowserImportHintToggle"].waitForExistence(timeout: 5.0),
"Expected Browser Settings to open from the blank-tab import hint"
)
}
@ -141,13 +141,16 @@ final class BrowserImportProfilesUITests: XCTestCase {
private func launchApp() -> XCUIApplication {
let app = XCUIApplication()
app.launchEnvironment["CMUX_UI_TEST_MODE"] = "1"
app.launchEnvironment["CMUX_UI_TEST_BROWSER_IMPORT_AUTO_OPEN"] = "1"
app.launchEnvironment["CMUX_UI_TEST_BROWSER_IMPORT_FIXTURE"] = #"{"browserName":"Helium","profiles":["You","austin"]}"#
app.launchEnvironment["CMUX_UI_TEST_BROWSER_IMPORT_DESTINATIONS"] = #"["Default"]"#
app.launchEnvironment["CMUX_UI_TEST_BROWSER_IMPORT_MODE"] = "capture-only"
app.launchEnvironment["CMUX_UI_TEST_BROWSER_IMPORT_CAPTURE_PATH"] = capturePath
app.launchEnvironment["CMUX_UI_TEST_BROWSER_IMPORT_HINT_VARIANT"] = "inlineStrip"
app.launchEnvironment["CMUX_UI_TEST_BROWSER_IMPORT_HINT_SHOW"] = "1"
app.launchEnvironment["CMUX_UI_TEST_BROWSER_IMPORT_HINT_DISMISSED"] = "0"
app.launchEnvironment["CMUX_UI_TEST_BROWSER_IMPORT_HINT_OPEN_BLANK_BROWSER"] = "1"
launchAndActivate(app)
waitForImportWizard(app)
openImportWizardFromBlankImportHint(app)
return app
}
@ -172,11 +175,21 @@ final class BrowserImportProfilesUITests: XCTestCase {
private func waitForBlankImportHint(_ app: XCUIApplication) {
let hintOpened = browserImportPollUntil(timeout: 5.0) {
app.buttons["BrowserImportHintDismissButton"].exists
app.buttons["BrowserImportHintImportButton"].exists
}
XCTAssertTrue(hintOpened, "Expected the blank browser import hint to appear")
}
private func openImportWizardFromBlankImportHint(_ app: XCUIApplication) {
waitForBlankImportHint(app)
let importButton = app.buttons["BrowserImportHintImportButton"]
XCTAssertTrue(importButton.waitForExistence(timeout: 5.0))
importButton.click()
waitForImportWizard(app)
}
private func waitForCapturedSelection(timeout: TimeInterval) -> [String: Any]? {
let url = URL(fileURLWithPath: capturePath)
let foundCapture = browserImportPollUntil(timeout: timeout) {