Skip to content

Commit

Permalink
Bugfix FXIOS-8672 Disable tests for "Close Private Tabs" from settings (
Browse files Browse the repository at this point in the history
#19991)

* empty commit

* Disable the code that toggles "Close Private Tabs" from settings (for now!)

* Fix swiftlint

* Save the code that still works without "Save Private Tabs" option so that the tests have some protection in the future
  • Loading branch information
clarmso committed Apr 25, 2024
1 parent 360edc3 commit 560c312
Showing 1 changed file with 10 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,8 @@ class PrivateBrowsingTest: BaseTestCase {
navigator.nowAt(NewTabScreen)
mozWaitForElementToExist(app.buttons[AccessibilityIdentifiers.Toolbar.settingsMenuButton], timeout: TIMEOUT)
navigator.goto(SettingsScreen)
let settingsTableView = app.tables[AccessibilityIdentifiers.Settings.tableViewController]

while settingsTableView.staticTexts["Close Private Tabs"].isHittable == false {
settingsTableView.swipeUp()
}

let closePrivateTabsSwitch = settingsTableView.switches["settings.closePrivateTabs"]
XCTAssertFalse(closePrivateTabsSwitch.isSelected)
// FXIOS-8672: "Close Private Tabs" has been removed from the settings.

// Open a Private tab
navigator.toggleOn(userState.isPrivate, withAction: Action.TogglePrivateMode)
Expand All @@ -123,38 +117,6 @@ class PrivateBrowsingTest: BaseTestCase {
.range(of: url2Label)
)
checkOpenTabsBeforeClosingPrivateMode()

// Now the enable the Close Private Tabs when closing the Private Browsing Button
if !iPad() {
app.cells.staticTexts[url2Label].tap()
} else {
app.otherElements["Tabs Tray"].collectionViews.cells.staticTexts[url2Label].tap()
}
waitForTabsButton()
mozWaitForElementToExist(
app.buttons[AccessibilityIdentifiers.Toolbar.settingsMenuButton],
timeout: TIMEOUT
)
navigator.nowAt(BrowserTab)
navigator.goto(SettingsScreen)
while settingsTableView.staticTexts["Close Private Tabs"].isHittable == false {
settingsTableView.swipeUp()
}
closePrivateTabsSwitch.tap()
navigator.goto(BrowserTab)
waitForTabsButton()

// Go back to regular browsing and check that the private tab has been closed and that the initial
// Private Browsing message appears when going back to Private Browsing
navigator.toggleOff(userState.isPrivate, withAction: Action.ToggleRegularMode)
app.cells.staticTexts["Homepage"].tap()
navigator.nowAt(NewTabScreen)

navigator.toggleOn(userState.isPrivate, withAction: Action.TogglePrivateMode)
mozWaitForElementToNotExist(
app.cells.staticTexts["Internet for people, not profit — Mozilla. Currently selected tab."]
)
checkOpenTabsAfterClosingPrivateMode()
}

/* Loads a page that checks if an db file exists already. It uses indexedDB on both the main document,
Expand All @@ -165,7 +127,8 @@ class PrivateBrowsingTest: BaseTestCase {
// https://testrail.stage.mozaws.net/index.php?/cases/view/2307011
func testClearIndexedDB() {
navigator.nowAt(NewTabScreen)
enableClosePrivateBrowsingOptionWhenLeaving()

// FXIOS-8672: "Close Private Tabs" has been removed from the settings.

func checkIndexedDBIsCreated() {
navigator.openURL(urlIndexedDB)
Expand All @@ -178,10 +141,12 @@ class PrivateBrowsingTest: BaseTestCase {
checkIndexedDBIsCreated()

navigator.toggleOff(userState.isPrivate, withAction: Action.ToggleRegularMode)
checkIndexedDBIsCreated()
// FXIOS-8672: "Close Private Tabs" has been removed from the settings.
// checkIndexedDBIsCreated()

navigator.toggleOn(userState.isPrivate, withAction: Action.TogglePrivateMode)
checkIndexedDBIsCreated()
// FXIOS-8672: "Close Private Tabs" has been removed from the settings.
// checkIndexedDBIsCreated()
}

// https://testrail.stage.mozaws.net/index.php?/cases/view/2307007
Expand Down Expand Up @@ -342,7 +307,8 @@ class PrivateBrowsingTestIpad: IpadOnlyTestCase {
navigator.toggleOn(userState.isPrivate, withAction: Action.TogglePrivateMode)
navigator.openURL(url2)
mozWaitForElementToExist(app.buttons[AccessibilityIdentifiers.Toolbar.settingsMenuButton], timeout: TIMEOUT)
enableClosePrivateBrowsingOptionWhenLeaving()

// FXIOS-8672: "Close Private Tabs" has been removed from the settings.
// Leave PM by tapping on PM shourt cut
navigator.toggleOff(userState.isPrivate, withAction: Action.TogglePrivateModeFromTabBarHomePanel)
waitForTabsButton()
Expand Down Expand Up @@ -371,7 +337,7 @@ class PrivateBrowsingTestIpad: IpadOnlyTestCase {
navigator.goto(LibraryPanel_History)
mozWaitForElementToExist(app.tables[HistoryPanelA11y.tableView])
// History without counting Clear Recent History, Recently Closed
let history = app.tables[HistoryPanelA11y.tableView].cells.count - 2
let history = app.tables[HistoryPanelA11y.tableView].cells.count - 1
XCTAssertEqual(history, 0, "History list should be empty")
}

Expand Down

0 comments on commit 560c312

Please sign in to comment.