Skip to content

Commit

Permalink
Update UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed May 2, 2024
1 parent 3eb04e4 commit 0dc1695
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ struct PostNoticePublishSuccessView: View {
.font(.headline)
.frame(maxWidth: .infinity, minHeight: 44)
})
.accessibilityIdentifier("doneButton")
.background(
RoundedRectangle(cornerRadius: 8, style: .continuous)
.fill(.secondary.opacity(0.15))
Expand All @@ -33,14 +34,16 @@ struct PostNoticePublishSuccessView: View {
}

private var header: some View {
HStack(alignment: .center, spacing: 24) {
HStack(alignment: .center, spacing: 12) {
VStack(alignment: .leading, spacing: 8) {
Text(Strings.title)
.font(.title3.weight(.semibold))
.accessibilityIdentifier("publishedPostStatusLabel")

Text(post.titleForDisplay())
.font(.subheadline)
.lineLimit(2)
.accessibilityIdentifier("postTitle")

let domain = post.blog.primaryDomainAddress
if !domain.isEmpty {
Expand All @@ -49,6 +52,7 @@ struct PostNoticePublishSuccessView: View {
.font(.footnote)
.lineLimit(1)
}
.accessibilityIdentifier("siteUrl")
.tint(.secondary)
}
}
Expand All @@ -74,13 +78,17 @@ struct PostNoticePublishSuccessView: View {
Image(systemName: "safari")
}
})
.accessibilityIdentifier("viewPostButton")

Button(action: buttonShareTapped, label: {
HStack {
Text(Strings.share)
Spacer()
Image(systemName: "square.and.arrow.up")
}
})
.accessibilityIdentifier("sharePostButton")

if BlazeHelper.isBlazeFlagEnabled() && post.canBlaze {
Button(action: buttonBlazeTapped, label: {
HStack {
Expand All @@ -89,6 +97,7 @@ struct PostNoticePublishSuccessView: View {
Image("icon-blaze")
}
})
.accessibilityIdentifier("blazePostButton")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import XCTest
public class EditorPublishEpilogueScreen: ScreenObject {

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

private let viewButtonGetter: (XCUIApplication) -> XCUIElement = {
Expand All @@ -20,7 +20,7 @@ public class EditorPublishEpilogueScreen: ScreenObject {
}

private let siteUrlGetter: (XCUIApplication) -> XCUIElement = {
$0.staticTexts["siteUrl"]
$0.buttons["siteUrl"]
}

var doneButton: XCUIElement { doneButtonGetter(app) }
Expand All @@ -43,7 +43,7 @@ public class EditorPublishEpilogueScreen: ScreenObject {

public func verifyEpilogueDisplays(postTitle expectedPostTitle: String, siteAddress expectedSiteAddress: String) -> EditorPublishEpilogueScreen {
let actualPostTitle = app.staticTexts["postTitle"].label
let actualSiteUrl = app.staticTexts["siteUrl"].label
let actualSiteUrl = app.buttons["siteUrl"].label

XCTAssertEqual(expectedPostTitle, actualPostTitle, "Post title doesn't match expected title")
XCTAssertEqual(expectedSiteAddress, actualSiteUrl, "Site URL doesn't match expected URL")
Expand Down

0 comments on commit 0dc1695

Please sign in to comment.