Skip to content

Commit

Permalink
fix ui test
Browse files Browse the repository at this point in the history
  • Loading branch information
Momo Ozawa committed Dec 5, 2023
1 parent c918b4d commit 267355a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}()
Expand Down Expand Up @@ -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 {
Expand Down
11 changes: 8 additions & 3 deletions WordPress/UITestsFoundation/Screens/MySiteScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand All @@ -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
Expand All @@ -129,14 +133,15 @@ public class MySiteScreen: ScreenObject {
public init(app: XCUIApplication = XCUIApplication()) throws {
try super.init(
expectedElementGetters: [
switchSiteButtonGetter,
siteActionButtonGetter,
createButtonGetter
],
app: app
)
}

public func showSiteSwitcher() throws -> MySitesScreen {
siteActionButton.tap()
switchSiteButton.tap()
return try MySitesScreen()
}
Expand Down

0 comments on commit 267355a

Please sign in to comment.