Skip to content

Commit

Permalink
test: Assert media block position and attachments
Browse files Browse the repository at this point in the history
Asserting the block position in addition to the media attachment
increases the robustness of the test.
  • Loading branch information
dcalhoun committed Sep 28, 2023
1 parent aa80b66 commit d0a0f2a
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions WordPress/UITestsFoundation/Screens/Editor/BlockEditorScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,19 @@ public class BlockEditorScreen: ScreenObject {

@discardableResult
public func verifyMediaBlocksDisplayed() -> Self {
let imagePredicate = NSPredicate(format: "label == 'Image caption. Empty'")
let videoPredicate = NSPredicate(format: "label == 'Video caption. Empty'")
let audioPredicate = NSPredicate(format: "label == 'Audio Player'")

XCTAssertTrue(app.buttons.containing(imagePredicate).firstMatch.exists)
XCTAssertTrue(app.buttons.containing(videoPredicate).firstMatch.exists)
XCTAssertTrue(app.buttons.containing(audioPredicate).firstMatch.exists)
let imageBlock = NSPredicate(format: "label == 'Image Block. Row 1'")
let imageCaption = NSPredicate(format: "label == 'Image caption. Empty'")
let videoBlock = NSPredicate(format: "label == 'Video Block. Row 2'")
let videoCaption = NSPredicate(format: "label == 'Video caption. Empty'")
let audioBlock = NSPredicate(format: "label == 'Audio Block. Row 3'")
let audioPlayer = NSPredicate(format: "label == 'Audio Player'")

XCTAssertTrue(app.buttons.containing(imageBlock).firstMatch.exists)
XCTAssertTrue(app.buttons.containing(imageCaption).firstMatch.exists)
XCTAssertTrue(app.buttons.containing(videoBlock).firstMatch.exists)
XCTAssertTrue(app.buttons.containing(audioBlock).firstMatch.exists)
XCTAssertTrue(app.buttons.containing(videoCaption).firstMatch.exists)
XCTAssertTrue(app.buttons.containing(audioPlayer).firstMatch.exists)

return self
}
Expand Down

0 comments on commit d0a0f2a

Please sign in to comment.