From 267355a3f28f9823fd7aa231f5ef10776461b94a Mon Sep 17 00:00:00 2001 From: Momo Ozawa Date: Tue, 5 Dec 2023 11:50:21 +0000 Subject: [PATCH] fix ui test --- .../Detail Header/BlogDetailHeaderView.swift | 4 ++-- .../UITestsFoundation/Screens/MySiteScreen.swift | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Blog/Blog Details/Detail Header/BlogDetailHeaderView.swift b/WordPress/Classes/ViewRelated/Blog/Blog Details/Detail Header/BlogDetailHeaderView.swift index bd13a7e53598..5b0566b8c9da 100644 --- a/WordPress/Classes/ViewRelated/Blog/Blog Details/Detail Header/BlogDetailHeaderView.swift +++ b/WordPress/Classes/ViewRelated/Blog/Blog Details/Detail Header/BlogDetailHeaderView.swift @@ -288,7 +288,7 @@ fileprivate extension BlogDetailHeaderView { button.tintColor = .secondaryLabel button.accessibilityLabel = NSLocalizedString("mySite.siteActions.button", value: "Site Actions", comment: "Button that reveals more site actions") button.accessibilityHint = NSLocalizedString("mySite.siteActions.hint", value: "Tap to show more site actions", comment: "Accessibility hint for button used to show more site actions") - button.accessibilityIdentifier = .switchSiteAccessibilityId + button.accessibilityIdentifier = .siteActionAccessibilityId return button }() @@ -368,7 +368,7 @@ private extension String { // MARK: Accessibility Identifiers static let siteTitleAccessibilityId = "site-title-button" static let siteUrlAccessibilityId = "site-url-button" - static let switchSiteAccessibilityId = "switch-site-button" + static let siteActionAccessibilityId = "site-action-button" } private enum Strings { diff --git a/WordPress/UITestsFoundation/Screens/MySiteScreen.swift b/WordPress/UITestsFoundation/Screens/MySiteScreen.swift index 20150438cda6..2a8ebfaff004 100644 --- a/WordPress/UITestsFoundation/Screens/MySiteScreen.swift +++ b/WordPress/UITestsFoundation/Screens/MySiteScreen.swift @@ -96,10 +96,13 @@ public class MySiteScreen: ScreenObject { $0.buttons["site-url-button"] } - private let switchSiteButtonGetter: (XCUIApplication) -> XCUIElement = { - $0.buttons["switch-site-button"] + private let siteActionButtonGetter: (XCUIApplication) -> XCUIElement = { + $0.buttons["site-action-button"] } + private let switchSiteButtonGetter: (XCUIApplication) -> XCUIElement = { + $0.buttons["Switch site"] + } var activityLogCard: XCUIElement { activityLogCardGetter(app) } var activityLogCardHeaderButton: XCUIElement { activityLogCardHeaderButtonGetter(app) } var blogDetailsRemoveSiteButton: XCUIElement { blogDetailsRemoveSiteButtonGetter(app) } @@ -121,6 +124,7 @@ public class MySiteScreen: ScreenObject { var segmentedControlMenuButton: XCUIElement { segmentedControlMenuButtonGetter(app) } var siteTitleButton: XCUIElement { siteTitleButtonGetter(app) } var siteUrlButton: XCUIElement { siteUrlButtonGetter(app) } + var siteActionButton: XCUIElement { siteActionButtonGetter(app) } var switchSiteButton: XCUIElement { switchSiteButtonGetter(app) } // Timeout duration to overwrite value defined in XCUITestHelpers @@ -129,7 +133,7 @@ public class MySiteScreen: ScreenObject { public init(app: XCUIApplication = XCUIApplication()) throws { try super.init( expectedElementGetters: [ - switchSiteButtonGetter, + siteActionButtonGetter, createButtonGetter ], app: app @@ -137,6 +141,7 @@ public class MySiteScreen: ScreenObject { } public func showSiteSwitcher() throws -> MySitesScreen { + siteActionButton.tap() switchSiteButton.tap() return try MySitesScreen() }