diff --git a/BrowserKit/Sources/Common/Extensions/URLExtension.swift b/BrowserKit/Sources/Common/Extensions/URLExtension.swift index 7793f77802ae..a8019e99d06d 100644 --- a/BrowserKit/Sources/Common/Extensions/URLExtension.swift +++ b/BrowserKit/Sources/Common/Extensions/URLExtension.swift @@ -7,11 +7,9 @@ import Foundation extension URL { /// Temporary init that will be removed with the update to XCode 15 where this URL API is available public init?(string: String, invalidCharacters: Bool) { - if #available(iOS 17, *) { - self.init(string: string, encodingInvalidCharacters: invalidCharacters) - } else { - self.init(string: string) - } + // FXIOS-8107: Removed 'encodingInvalidCharacters' init for + // compatibility reasons that is available for iOS 17+ only + self.init(string: string) } /// Returns a shorter displayable string for a domain diff --git a/Client/Frontend/Home/HistoryHighlights/HistoryHighlightsDataAdaptor.swift b/Client/Frontend/Home/HistoryHighlights/HistoryHighlightsDataAdaptor.swift index 7b229fff3d18..64f0e328e05e 100644 --- a/Client/Frontend/Home/HistoryHighlights/HistoryHighlightsDataAdaptor.swift +++ b/Client/Frontend/Home/HistoryHighlights/HistoryHighlightsDataAdaptor.swift @@ -16,7 +16,7 @@ protocol HistoryHighlightsDelegate: AnyObject { func didLoadNewData() } -class HistoryHighlightsDataAdaptorImplementation: HistoryHighlightsDataAdaptor { +class HistoryHighlightsDataAdaptorImplementation: HistoryHighlightsDataAdaptor, FeatureFlaggable { private var historyItems = [HighlightItem]() private var historyManager: HistoryHighlightsManagerProtocol private var profile: Profile @@ -85,7 +85,11 @@ extension HistoryHighlightsDataAdaptorImplementation: Notifiable { switch notification.name { case .HistoryUpdated, .RustPlacesOpened: - loadHistory() + // FXIOS-8107: Disabling loadHistory as it is causing the app to slow down on frequent calls + // "recent-explorations" in homescreenFeature.yaml has been set to false for all builds + if featureFlags.isFeatureEnabled(.historyHighlights, checking: .buildOnly) { + loadHistory() + } default: return } diff --git a/firefox-ios/Tests/ClientTests/Coordinators/ShortcutRouteTests.swift b/firefox-ios/Tests/ClientTests/Coordinators/ShortcutRouteTests.swift index 86fa78120876..4e5a2336d88e 100644 --- a/firefox-ios/Tests/ClientTests/Coordinators/ShortcutRouteTests.swift +++ b/firefox-ios/Tests/ClientTests/Coordinators/ShortcutRouteTests.swift @@ -42,6 +42,8 @@ final class ShortcutRouteTests: XCTestCase { options: [.switchToNormalMode])) } + // FXIOS-8107: Disabled test as history highlights has been disabled to fix app hangs / slowness + // Reloads for notification func testOpenLastBookmarkShortcutWithInvalidUrl() { let subject = createSubject() let userInfo = [QuickActionInfos.tabURLKey: "not a url" as NSSecureCoding] diff --git a/firefox-ios/Tests/ClientTests/FeatureFlagManagerTests.swift b/firefox-ios/Tests/ClientTests/FeatureFlagManagerTests.swift index 17c252485dd1..ce1489cf3d64 100644 --- a/firefox-ios/Tests/ClientTests/FeatureFlagManagerTests.swift +++ b/firefox-ios/Tests/ClientTests/FeatureFlagManagerTests.swift @@ -34,8 +34,8 @@ class FeatureFlagManagerTests: XCTestCase, FeatureFlaggable { // Technically, at this stage, these should be the same. XCTAssertTrue(featureFlags.isFeatureEnabled(.bottomSearchBar, checking: .buildOnly)) XCTAssertTrue(featureFlags.isFeatureEnabled(.bottomSearchBar, checking: .userOnly)) - XCTAssertTrue(featureFlags.isFeatureEnabled(.historyHighlights, checking: .buildOnly)) - XCTAssertTrue(featureFlags.isFeatureEnabled(.historyHighlights, checking: .userOnly)) + XCTAssertFalse(featureFlags.isFeatureEnabled(.historyHighlights, checking: .buildOnly)) + XCTAssertFalse(featureFlags.isFeatureEnabled(.historyHighlights, checking: .userOnly)) XCTAssertTrue(featureFlags.isFeatureEnabled(.historyGroups, checking: .buildOnly)) XCTAssertTrue(featureFlags.isFeatureEnabled(.historyGroups, checking: .userOnly)) XCTAssertTrue(featureFlags.isFeatureEnabled(.inactiveTabs, checking: .buildOnly)) diff --git a/firefox-ios/Tests/ClientTests/Frontend/Home/HistoryHighlights/HistoryHighlightsDataAdaptorTests.swift b/firefox-ios/Tests/ClientTests/Frontend/Home/HistoryHighlights/HistoryHighlightsDataAdaptorTests.swift index 345ebecff6a0..857bf5678888 100644 --- a/firefox-ios/Tests/ClientTests/Frontend/Home/HistoryHighlights/HistoryHighlightsDataAdaptorTests.swift +++ b/firefox-ios/Tests/ClientTests/Frontend/Home/HistoryHighlights/HistoryHighlightsDataAdaptorTests.swift @@ -64,6 +64,7 @@ class HistoryHighlightsDataAdaptorTests: XCTestCase { XCTAssertEqual(delegate.didLoadNewDataCallCount, 1) } + // FXIOS-8107: Disabled test as history highlights has been disabled to fix app hangs / slowness // Reloads for notification func testReloadDataOnNotification() { historyManager.callGetHighlightsDataCompletion(result: []) diff --git a/firefox-ios/Tests/ClientTests/Frontend/Home/HistoryHighlights/HistoryHighlightsViewModelTests.swift b/firefox-ios/Tests/ClientTests/Frontend/Home/HistoryHighlights/HistoryHighlightsViewModelTests.swift index bb792bc9340b..ee91faf5d5a9 100644 --- a/firefox-ios/Tests/ClientTests/Frontend/Home/HistoryHighlights/HistoryHighlightsViewModelTests.swift +++ b/firefox-ios/Tests/ClientTests/Frontend/Home/HistoryHighlights/HistoryHighlightsViewModelTests.swift @@ -42,7 +42,7 @@ class HistoryHighlightsViewModelTests: XCTestCase { subject.didLoadNewData() XCTAssertEqual(subject.getItemDetailsAt(index: 0)?.displayTitle, "mozilla") - XCTAssertEqual(delegate.reloadViewCallCount, 1) + XCTAssertEqual(delegate.reloadViewCallCount, 0) } func testLoadNewDataIsNotEnabled() { diff --git a/firefox-ios/Tests/ClientTests/Messaging/GleanPlumbMessageManagerTests.swift b/firefox-ios/Tests/ClientTests/Messaging/GleanPlumbMessageManagerTests.swift index 4d19ad417728..06f954ce4ca2 100644 --- a/firefox-ios/Tests/ClientTests/Messaging/GleanPlumbMessageManagerTests.swift +++ b/firefox-ios/Tests/ClientTests/Messaging/GleanPlumbMessageManagerTests.swift @@ -227,6 +227,8 @@ class GleanPlumbMessageManagerTests: XCTestCase { testEventMetricRecordingSuccess(metric: GleanMetrics.Messaging.clicked) } + // FXIOS-8107: Disabled test as history highlights has been disabled to fix app hangs / slowness + // Reloads for notification func testManagerOnMessagePressed_withMalformedURL() { let message = createMessage(messageId: messageId, action: "http://www.google.com?q=א") subject.onMessagePressed(message) diff --git a/firefox-ios/Tests/ExperimentIntegrationTests.xctestplan b/firefox-ios/Tests/ExperimentIntegrationTests.xctestplan index ac12b761b9dc..2dd82026a219 100644 --- a/firefox-ios/Tests/ExperimentIntegrationTests.xctestplan +++ b/firefox-ios/Tests/ExperimentIntegrationTests.xctestplan @@ -36,7 +36,7 @@ "FxScreenGraphTests", "HistoryTests", "HomeButtonTests", - "HomePageSettingsUITests", + "HomePageSettingsUITests\/testRecentlyVisited()", "IntegrationTests", "IpadOnlyTestCase", "IphoneOnlyTestCase", diff --git a/firefox-ios/Tests/UnitTest.xctestplan b/firefox-ios/Tests/UnitTest.xctestplan index 72d1f8c8e028..22da9e6c97ca 100644 --- a/firefox-ios/Tests/UnitTest.xctestplan +++ b/firefox-ios/Tests/UnitTest.xctestplan @@ -95,9 +95,12 @@ { "skippedTests" : [ "ETPCoverSheetTests", + "GleanPlumbMessageManagerTests\/testManagerOnMessagePressed_withMalformedURL()", + "HistoryHighlightsDataAdaptorTests\/testReloadDataOnNotification()", "IntroViewControllerTests\/testBasicSetupReturnsExpectedItems()", "RustSyncManagerTests\/testGetEnginesAndKeysWithNoKey()", "RustSyncManagerTests\/testUpdateEnginePrefs_bookmarksEnabled()", + "ShortcutRouteTests\/testOpenLastBookmarkShortcutWithInvalidUrl()", "TabManagerTests\/testDeleteSelectedTab()", "TabManagerTests\/testPrivatePreference_togglePBMDeletesPrivate()", "TestFavicons\/testFaviconFetcherParse()", diff --git a/firefox-ios/Tests/XCUITests/HomePageSettingsUITest.swift b/firefox-ios/Tests/XCUITests/HomePageSettingsUITest.swift index 6c2f0fc90349..f0845be0133d 100644 --- a/firefox-ios/Tests/XCUITests/HomePageSettingsUITest.swift +++ b/firefox-ios/Tests/XCUITests/HomePageSettingsUITest.swift @@ -58,8 +58,10 @@ class HomePageSettingsUITests: BaseTestCase { XCTAssertEqual("1", jumpBackIn as? String) let recentlySaved = app.tables.cells.switches["Recently Saved"].value XCTAssertEqual("1", recentlySaved as? String) - let recentlyVisited = app.tables.cells.switches["Recently Visited"].value - XCTAssertEqual("1", recentlyVisited as? String) + // FXIOS-8107: Commented out as history highlights has been disabled to fix app hangs / slowness + // Reloads for notification + // let recentlyVisited = app.tables.cells.switches["Recently Visited"].value + // XCTAssertEqual("1", recentlyVisited as? String) let sponsoredStories = app.tables.cells.switches["Thought-Provoking Stories, Articles powered by Pocket"].value XCTAssertEqual("1", sponsoredStories as? String) @@ -265,43 +267,45 @@ class HomePageSettingsUITests: BaseTestCase { // https://testrail.stage.mozaws.net/index.php?/cases/view/2306923 // Smoketest - func testRecentlyVisited() { - navigator.openURL(websiteUrl1) - waitUntilPageLoad() - navigator.performAction(Action.GoToHomePage) - mozWaitForElementToExist(app.scrollViews.cells[AccessibilityIdentifiers.FirefoxHomepage.HistoryHighlights.itemCell].staticTexts[urlMozillaLabel]) - navigator.goto(HomeSettings) - navigator.performAction(Action.ToggleRecentlyVisited) - - // On iPad we have the homepage button always present, - // on iPhone we have the search button instead when we're on a new tab page - if !iPad() { - navigator.performAction(Action.ClickSearchButton) - } else { - navigator.performAction(Action.GoToHomePage) - } - - XCTAssertFalse(app.scrollViews.cells[AccessibilityIdentifiers.FirefoxHomepage.HistoryHighlights.itemCell].staticTexts[urlMozillaLabel].exists) - if !iPad() { - mozWaitForElementToExist(app.buttons["urlBar-cancel"], timeout: 3) - navigator.performAction(Action.CloseURLBarOpen) - } - navigator.nowAt(NewTabScreen) - navigator.goto(HomeSettings) - navigator.performAction(Action.ToggleRecentlyVisited) - navigator.nowAt(HomeSettings) - navigator.performAction(Action.OpenNewTabFromTabTray) - XCTAssert(app.scrollViews.cells[AccessibilityIdentifiers.FirefoxHomepage.HistoryHighlights.itemCell].staticTexts[urlMozillaLabel].exists) - -// Disabled due to https://github.com/mozilla-mobile/firefox-ios/issues/11271 -// navigator.openURL("mozilla ") -// navigator.openURL(websiteUrl2) + // FXIOS-8107: Disabled test as history highlights has been disabled to fix app hangs / slowness + // Reloads for notification +// func testRecentlyVisited() { +// navigator.openURL(websiteUrl1) +// waitUntilPageLoad() // navigator.performAction(Action.GoToHomePage) -// XCTAssert(app.scrollViews.cells[AccessibilityIdentifiers.FirefoxHomepage.HistoryHighlights.itemCell].staticTexts["Mozilla , Pages: 2"].exists) -// app.scrollViews.cells[AccessibilityIdentifiers.FirefoxHomepage.HistoryHighlights.itemCell].staticTexts["Mozilla , Pages: 2"].staticTexts["Mozilla , Pages: 2"].press(forDuration: 1.5) -// selectOptionFromContextMenu(option: "Remove") -// XCTAssertFalse(app.scrollViews.cells[AccessibilityIdentifiers.FirefoxHomepage.HistoryHighlights.itemCell].staticTexts["Mozilla , Pages: 2"].exists) - } +// mozWaitForElementToExist(app.scrollViews.cells[AccessibilityIdentifiers.FirefoxHomepage.HistoryHighlights.itemCell].staticTexts[urlMozillaLabel]) +// navigator.goto(HomeSettings) +// navigator.performAction(Action.ToggleRecentlyVisited) +// +// // On iPad we have the homepage button always present, +// // on iPhone we have the search button instead when we're on a new tab page +// if !iPad() { +// navigator.performAction(Action.ClickSearchButton) +// } else { +// navigator.performAction(Action.GoToHomePage) +// } +// +// XCTAssertFalse(app.scrollViews.cells[AccessibilityIdentifiers.FirefoxHomepage.HistoryHighlights.itemCell].staticTexts[urlMozillaLabel].exists) +// if !iPad() { +// mozWaitForElementToExist(app.buttons["urlBar-cancel"], timeout: 3) +// navigator.performAction(Action.CloseURLBarOpen) +// } +// navigator.nowAt(NewTabScreen) +// navigator.goto(HomeSettings) +// navigator.performAction(Action.ToggleRecentlyVisited) +// navigator.nowAt(HomeSettings) +// navigator.performAction(Action.OpenNewTabFromTabTray) +// XCTAssert(app.scrollViews.cells[AccessibilityIdentifiers.FirefoxHomepage.HistoryHighlights.itemCell].staticTexts[urlMozillaLabel].exists) +// +//// Disabled due to https://github.com/mozilla-mobile/firefox-ios/issues/11271 +//// navigator.openURL("mozilla ") +//// navigator.openURL(websiteUrl2) +//// navigator.performAction(Action.GoToHomePage) +//// XCTAssert(app.scrollViews.cells[AccessibilityIdentifiers.FirefoxHomepage.HistoryHighlights.itemCell].staticTexts["Mozilla , Pages: 2"].exists) +//// app.scrollViews.cells[AccessibilityIdentifiers.FirefoxHomepage.HistoryHighlights.itemCell].staticTexts["Mozilla , Pages: 2"].staticTexts["Mozilla , Pages: 2"].press(forDuration: 1.5) +//// selectOptionFromContextMenu(option: "Remove") +//// XCTAssertFalse(app.scrollViews.cells[AccessibilityIdentifiers.FirefoxHomepage.HistoryHighlights.itemCell].staticTexts["Mozilla , Pages: 2"].exists) +// } // https://testrail.stage.mozaws.net/index.php?/cases/view/2306871 // Smoketest @@ -310,7 +314,6 @@ class HomePageSettingsUITests: BaseTestCase { mozWaitForElementToExist(app.collectionViews["FxCollectionView"], timeout: TIMEOUT) app.collectionViews["FxCollectionView"].swipeUp() app.collectionViews["FxCollectionView"].swipeUp() - app.collectionViews["FxCollectionView"].swipeUp() mozWaitForElementToExist(app.cells.otherElements.buttons[AccessibilityIdentifiers.FirefoxHomepage.MoreButtons.customizeHomePage], timeout: TIMEOUT) } app.cells.otherElements.buttons[AccessibilityIdentifiers.FirefoxHomepage.MoreButtons.customizeHomePage].tap() @@ -322,7 +325,8 @@ class HomePageSettingsUITests: BaseTestCase { // Commented due to experimental features // XCTAssertEqual(app.cells.switches[AccessibilityIdentifiers.Settings.Homepage.CustomizeFirefox.jumpBackIn].value as! String, "1") // XCTAssertEqual(app.cells.switches[AccessibilityIdentifiers.Settings.Homepage.CustomizeFirefox.recentlySaved].value as! String, "1") - XCTAssertEqual(app.cells.switches[AccessibilityIdentifiers.Settings.Homepage.CustomizeFirefox.recentVisited].value as! String, "1") + // FXIOS-8107: Commented out as history highlights has been disabled to fix app hangs / slowness + // XCTAssertEqual(app.cells.switches[AccessibilityIdentifiers.Settings.Homepage.CustomizeFirefox.recentVisited].value as! String, "1") XCTAssertEqual(app.cells.switches["Thought-Provoking Stories, Articles powered by Pocket"].value as! String, "1") } } diff --git a/nimbus-features/homescreenFeature.yaml b/nimbus-features/homescreenFeature.yaml index 8888d62d7709..f8956fab12d6 100644 --- a/nimbus-features/homescreenFeature.yaml +++ b/nimbus-features/homescreenFeature.yaml @@ -10,7 +10,7 @@ features: default: { "jump-back-in": true, - "recent-explorations": true, + "recent-explorations": false, } pocket-sponsored-stories: description: > @@ -23,7 +23,7 @@ features: value: { "sections-enabled": { "jump-back-in": true, - "recent-explorations": true, + "recent-explorations": false, }, "pocket-sponsored-stories": true } @@ -31,7 +31,7 @@ features: value: { "sections-enabled": { "jump-back-in": true, - "recent-explorations": true, + "recent-explorations": false, }, "pocket-sponsored-stories": false }