Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update UI tests
Browse files Browse the repository at this point in the history
kean committed Feb 14, 2024
1 parent be788a9 commit f304e08
Showing 5 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -11,9 +11,11 @@ extension PostEditor {
settingsViewController = PostSettingsViewController(post: post)
}
settingsViewController.featuredImageDelegate = self as? FeaturedImageDelegate
settingsViewController.navigationItem.leftBarButtonItem = UIBarButtonItem(systemItem: .close, primaryAction: .init(handler: { [weak self] _ in
let closeButton = UIBarButtonItem(systemItem: .close, primaryAction: .init(handler: { [weak self] _ in
self?.navigationController?.dismiss(animated: true)
}))
closeButton.accessibilityIdentifier = "close"
settingsViewController.navigationItem.leftBarButtonItem = closeButton

let navigation = UINavigationController(rootViewController: settingsViewController)
self.navigationController?.present(navigation, animated: true)
Original file line number Diff line number Diff line change
@@ -60,7 +60,7 @@ final class PrepublishingViewController: UIViewController, UITableViewDataSource
let publishButton: NUXButton = {
let nuxButton = NUXButton()
nuxButton.isPrimary = true

nuxButton.accessibilityIdentifier = "publish"
return nuxButton
}()

Original file line number Diff line number Diff line change
@@ -41,6 +41,8 @@ final class SchedulingDatePickerViewController: UIViewController {
])
view.backgroundColor = .systemBackground

navigationItem.backBarButtonItem?.accessibilityIdentifier = "back"

updateNavigationItems()
}

Original file line number Diff line number Diff line change
@@ -290,7 +290,7 @@ public class BlockEditorScreen: ScreenObject {
} else if postType == .page && XCUIDevice.isPhone {
postNowButton = app.scrollViews.buttons[action.rawValue]
} else {
postNowButton = app.buttons["\(action.rawValue) Now"]
postNowButton = app.buttons["publish"]
}

waitForExistenceAndTap(postButton)
Original file line number Diff line number Diff line change
@@ -47,20 +47,20 @@ public class EditorPostSettings: ScreenObject {
$0.buttons.containing(.staticText, identifier: "1").element
}

private let doneButtonGetter: (XCUIApplication) -> XCUIElement = {
$0.buttons["Done"]
private let closeButtonGetter: (XCUIApplication) -> XCUIElement = {
$0.navigationBars.buttons["close"]
}

private let backButtonGetter: (XCUIApplication) -> XCUIElement = {
$0.navigationBars.buttons.element(boundBy: 0)
private let backButtonGetter: (XCUIApplication) -> XCUIElement? = {
$0.navigationBars.lastMatch?.buttons.element(boundBy: 0)
}

var categoriesSection: XCUIElement { categoriesSectionGetter(app) }
var chooseFromMediaButton: XCUIElement { chooseFromMediaButtonGetter(app) }
var currentFeaturedImage: XCUIElement { currentFeaturedImageGetter(app) }
var dateSelector: XCUIElement { dateSelectorGetter(app) }
var doneButton: XCUIElement { doneButtonGetter(app) }
var backButton: XCUIElement { backButtonGetter(app) }
var closeButton: XCUIElement { closeButtonGetter(app) }
var backButton: XCUIElement? { backButtonGetter(app) }
var featuredImageButton: XCUIElement { featuredImageButtonGetter(app) }
var firstCalendarDayButton: XCUIElement { firstCalendarDayButtonGetter(app) }
var monthLabel: XCUIElement { monthLabelGetter(app) }
@@ -136,7 +136,7 @@ public class EditorPostSettings: ScreenObject {

@discardableResult
public func closePostSettings() throws -> BlockEditorScreen {
navigateBack()
closeButton.tap()

return try BlockEditorScreen()
}
@@ -160,7 +160,8 @@ public class EditorPostSettings: ScreenObject {
firstCalendarDayButton.tapUntil(.selected, failureMessage: "First Day button not selected!")
}

backButton.tap()
// Grab the top-most navigation bar
backButton?.tap()
return self
}

0 comments on commit f304e08

Please sign in to comment.