From 123b60451505febb4fe7d4c5b0377d9ed0aae190 Mon Sep 17 00:00:00 2001 From: Sabrina Tardio Date: Tue, 7 May 2024 13:14:23 +0200 Subject: [PATCH] fix test in CI --- DuckDuckGo/Common/Localizables/UserText.swift | 1 + DuckDuckGo/NavigationBar/View/ZoomPopover.swift | 2 +- UnitTests/Tab/ViewModel/ZoomPopoverViewModelTests.swift | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/DuckDuckGo/Common/Localizables/UserText.swift b/DuckDuckGo/Common/Localizables/UserText.swift index b6c361c836..09b266cea2 100644 --- a/DuckDuckGo/Common/Localizables/UserText.swift +++ b/DuckDuckGo/Common/Localizables/UserText.swift @@ -490,6 +490,7 @@ struct UserText { static let mobileBookmarksImportedFolderTitle = NSLocalizedString("bookmarks.imported.mobile.folder.title", value: "Mobile bookmarks", comment: "Name of the \"Mobile bookmarks\" folder imported from other browser") static let zoom = NSLocalizedString("zoom", value: "Zoom", comment: "Menu with Zooming commands") + static let resetZoom = NSLocalizedString("reset-zoom", value: "Reset", comment: "Button that allows the user to reset the zoom level of the browser page") static let emailOptionsMenuItem = NSLocalizedString("email.optionsMenu", value: "Email Protection", comment: "Menu item email feature") static let emailOptionsMenuCreateAddressSubItem = NSLocalizedString("email.optionsMenu.createAddress", value: "Generate Private Duck Address", comment: "Create an email alias sub menu item") diff --git a/DuckDuckGo/NavigationBar/View/ZoomPopover.swift b/DuckDuckGo/NavigationBar/View/ZoomPopover.swift index d4ff4e8bc0..6fe6a76305 100644 --- a/DuckDuckGo/NavigationBar/View/ZoomPopover.swift +++ b/DuckDuckGo/NavigationBar/View/ZoomPopover.swift @@ -31,7 +31,7 @@ struct ZoomPopoverContentView: View { Button { viewModel.reset() } label: { - Text("Reset") + Text(UserText.resetZoom) .frame(height: 28) .padding(.horizontal, 8) } diff --git a/UnitTests/Tab/ViewModel/ZoomPopoverViewModelTests.swift b/UnitTests/Tab/ViewModel/ZoomPopoverViewModelTests.swift index c821229139..c7e72e3579 100644 --- a/UnitTests/Tab/ViewModel/ZoomPopoverViewModelTests.swift +++ b/UnitTests/Tab/ViewModel/ZoomPopoverViewModelTests.swift @@ -70,12 +70,14 @@ final class ZoomPopoverViewModelTests: XCTestCase { @MainActor func test_WhenResetZoomFromPopover_ThenWebViewIsReset() { + let expectation = self.expectation(forNotification: AccessibilityPreferences.zoomPerWebsiteUpdated, object: nil, handler: nil) let randomZoomLevel = DefaultZoomValue.allCases.randomElement()! tabVM.tab.webView.defaultZoomValue = .percent100 tabVM.tab.webView.zoomLevel = randomZoomLevel zoomPopover.reset() + waitForExpectations(timeout: 5) XCTAssertEqual(.percent100, tabVM.tab.webView.zoomLevel) XCTAssertEqual(.percent100, zoomPopover.zoomLevel) }