diff --git a/firefox-ios/Client/Frontend/Library/Bookmarks/Legacy/BookmarksPanelViewModel.swift b/firefox-ios/Client/Frontend/Library/Bookmarks/Legacy/BookmarksPanelViewModel.swift index 70d2bda75dc6..0398cd4c8bd7 100644 --- a/firefox-ios/Client/Frontend/Library/Bookmarks/Legacy/BookmarksPanelViewModel.swift +++ b/firefox-ios/Client/Frontend/Library/Bookmarks/Legacy/BookmarksPanelViewModel.swift @@ -91,8 +91,13 @@ class BookmarksPanelViewModel: BookmarksRefactorFeatureFlagProvider { /// we need to account for this when saving bookmark index in A-S. This is done by subtracting /// the Local Desktop Folder number of rows it takes to the actual index. func getNewIndex(from index: Int) -> Int { - guard bookmarkFolderGUID == BookmarkRoots.MobileFolderGUID, isBookmarkRefactorEnabled ? - hasDesktopFolders : true else { + var isDesktopFolderPresent: Bool = false + if isBookmarkRefactorEnabled && hasDesktopFolders { + isDesktopFolderPresent = true + } else if isBookmarkRefactorEnabled == false { + isDesktopFolderPresent = true + } + guard bookmarkFolderGUID == BookmarkRoots.MobileFolderGUID, isDesktopFolderPresent else { return max(index, 0) } diff --git a/firefox-ios/firefox-ios-tests/Tests/ClientTests/Library/Bookmarks/BookmarkPanelViewModelTests.swift b/firefox-ios/firefox-ios-tests/Tests/ClientTests/Library/Bookmarks/BookmarkPanelViewModelTests.swift index 3bb5390979b6..50e0aeb4bad8 100644 --- a/firefox-ios/firefox-ios-tests/Tests/ClientTests/Library/Bookmarks/BookmarkPanelViewModelTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/ClientTests/Library/Bookmarks/BookmarkPanelViewModelTests.swift @@ -59,6 +59,7 @@ class BookmarksPanelViewModelTests: XCTestCase, FeatureFlaggable { func testShouldReload_whenMobileEmptyBookmarks() throws { profile.reopen() + featureFlags.set(feature: .bookmarksRefactor, to: false, isDebug: true) let subject = createSubject(guid: BookmarkRoots.MobileFolderGUID) let expectation = expectation(description: "Subject reloaded") subject.reloadData { @@ -84,7 +85,7 @@ class BookmarksPanelViewModelTests: XCTestCase, FeatureFlaggable { func testShouldReload_whenDesktopBookmarksExist() throws { profile.reopen() - featureFlags.set(feature: .bookmarksRefactor, to: true) + featureFlags.set(feature: .bookmarksRefactor, to: false, isDebug: true) let subject = createSubject(guid: BookmarkRoots.MobileFolderGUID) createDesktopBookmark(subject: subject) { @@ -157,6 +158,7 @@ class BookmarksPanelViewModelTests: XCTestCase, FeatureFlaggable { func testMoveRowAtGetNewIndex_MobileGuid_atFive() { let subject = createSubject(guid: BookmarkRoots.MobileFolderGUID) + featureFlags.set(feature: .bookmarksRefactor, to: false, isDebug: true) let index = subject.getNewIndex(from: 5) XCTAssertEqual(index, 4) } @@ -181,16 +183,6 @@ class BookmarksPanelViewModelTests: XCTestCase, FeatureFlaggable { } } - func testMoveRowAtGetNewIndex_MobileGuid_showingDesktopFolder_atFive_bookmarksRefactor() { - let subject = createSubject(guid: BookmarkRoots.MobileFolderGUID) - featureFlags.set(feature: .bookmarksRefactor, to: true) - - createDesktopBookmark(subject: subject) { - let index = subject.getNewIndex(from: 5) - XCTAssertEqual(index, 4) - } - } - func testMoveRowAtGetNewIndex_MobileGuid_hidingDesktopFolder_zeroIndex_bookmarksRefactor() { let subject = createSubject(guid: BookmarkRoots.MobileFolderGUID) featureFlags.set(feature: .bookmarksRefactor, to: true) @@ -206,14 +198,6 @@ class BookmarksPanelViewModelTests: XCTestCase, FeatureFlaggable { let index = subject.getNewIndex(from: -1) XCTAssertEqual(index, 0) } - - func testMoveRowAtGetNewIndex_MobileGuid_hidingDesktopFolder_atFive_bookmarksRefactor() { - let subject = createSubject(guid: BookmarkRoots.MobileFolderGUID) - featureFlags.set(feature: .bookmarksRefactor, to: true) - - let index = subject.getNewIndex(from: 5) - XCTAssertEqual(index, 4) - } } extension BookmarksPanelViewModelTests { diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/BookmarksTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/BookmarksTests.swift index 8468fbe947fe..91033c1796a3 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/BookmarksTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/BookmarksTests.swift @@ -23,9 +23,9 @@ class BookmarksTests: BaseTestCase { } private func undoBookmarkRemoval() { - navigator.goto(SaveBrowserTabMenu) - app.tables.cells[AccessibilityIdentifiers.MainMenu.bookmarkThisPage].waitAndTap() - app.staticTexts["Delete Bookmark"].waitAndTap() + navigator.goto(LibraryPanel_Bookmarks) + app.buttons["More options"].waitAndTap() + app.tables["Context Menu"].otherElements["bookmarkSlashLarge"].waitAndTap() app.buttons["Undo"].waitAndTap() navigator.nowAt(BrowserTab) } @@ -251,7 +251,8 @@ class BookmarksTests: BaseTestCase { bookmark() checkBookmarked() undoBookmarkRemoval() - checkBookmarked() + app.buttons["Done"].waitAndTap() + navigator.nowAt(BrowserTab) } private func addNewBookmark() { @@ -291,7 +292,7 @@ class BookmarksTests: BaseTestCase { navigator.goto(LibraryPanel_Bookmarks) // There is only one row in the bookmarks panel, which is the desktop folder mozWaitForElementToExist(app.tables["Bookmarks List"]) - XCTAssertEqual(app.tables["Bookmarks List"].cells.count, 1) + XCTAssertEqual(app.tables["Bookmarks List"].cells.count, 0) // Add a bookmark navigator.nowAt(LibraryPanel_Bookmarks) @@ -320,12 +321,14 @@ class BookmarksTests: BaseTestCase { navigator.goto(LibraryPanel_Bookmarks) // There is only one folder at the root of the bookmarks mozWaitForElementToExist(app.tables["Bookmarks List"]) - XCTAssertEqual(app.tables["Bookmarks List"].cells.count, 1) + XCTAssertEqual(app.tables["Bookmarks List"].cells.count, 0) // There is only three folders inside the desktop bookmarks - app.tables["Bookmarks List"].cells.firstMatch.waitAndTap() - mozWaitForElementToExist(app.tables["Bookmarks List"]) - XCTAssertEqual(app.tables["Bookmarks List"].cells.count, 3) + // New experiment behaviour, no folders are shown anymore + // Need to establish the new UI for the experiment +// app.tables["Bookmarks List"].cells.firstMatch.waitAndTap() +// mozWaitForElementToExist(app.tables["Bookmarks List"]) +// XCTAssertEqual(app.tables["Bookmarks List"].cells.count, 3) } // https://mozilla.testrail.io/index.php?/cases/view/2306911 diff --git a/firefox-ios/nimbus-features/bookmarkRefactorFeature.yaml b/firefox-ios/nimbus-features/bookmarkRefactorFeature.yaml index 3be696721b9d..28160cf12f2a 100644 --- a/firefox-ios/nimbus-features/bookmarkRefactorFeature.yaml +++ b/firefox-ios/nimbus-features/bookmarkRefactorFeature.yaml @@ -14,5 +14,5 @@ features: enabled: false - channel: developer value: - enabled: false + enabled: true