Skip to content

Commit

Permalink
add test can remove data
Browse files Browse the repository at this point in the history
  • Loading branch information
SabrinaTardio committed Dec 18, 2023
1 parent 5ebd121 commit 3b896a9
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions SyncE2EUITests/CriticalPathsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,46 @@ final class CriticalPathsTests: XCTestCase {
XCTAssertTrue(beginSync.exists, "Begyn Sync text is not visible")
}

func testCanRemoveData() {
// Go to Sync Set up
let newTabWindow = app.windows["New Tab"]
newTabWindow.children(matching: .button).element(boundBy: 4).click()
newTabWindow.menuItems["openPreferences:"].click()
let settingsWindow = app.windows["Settings"]
settingsWindow.buttons["Sync & Backup"].click()

// Create Account
let sheetsQuery = settingsWindow.sheets
settingsWindow.staticTexts["Sync and Back Up This Device"].click()
sheetsQuery.buttons["Turn on Sync & Backup"].click()
sheetsQuery.buttons["Copy Code"].click()
sheetsQuery.buttons["Next"].click()
sheetsQuery.buttons["Done"].click()
let syncEnabledElement = settingsWindow.staticTexts["Sync Enabled"]
XCTAssertTrue(syncEnabledElement.exists, "Sync Enabled text is not visible")

// Delete Data
settingsWindow.swipeUp()
settingsWindow.buttons["Turn Off and Delete Server Data"].click()
sheetsQuery.buttons["Delete Data"].click()
let beginSync = settingsWindow.staticTexts["Begin Syncing"]
beginSync.click()
XCTAssertTrue(beginSync.exists, "Begyn Sync text is not visible")

// Log In and check error
settingsWindow.staticTexts["Sync with Another Device"].click()
let settingsSheetsQuery = settingsWindow.sheets
settingsSheetsQuery.staticTexts["Enter Code"].click()
settingsSheetsQuery.buttons["Paste"].click()
let alertSheet = sheetsQuery.sheets["alert"]
alertSheet.staticTexts["Sync Error"].click()
XCTAssertTrue(alertSheet.exists, "Sync Error text is not visible")

// Clean Up
debugMenuBarItem.click()
internaluserstateMenuItem.click()
}

func testCanLoginToExistingSyncAccount() {
guard let code = ProcessInfo.processInfo.environment["CODE"] else {
XCTFail("CODE not set")
Expand Down

0 comments on commit 3b896a9

Please sign in to comment.