Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions WordPress/UITests/Tests/EditorGutenbergTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,6 @@ class EditorGutenbergTests: XCTestCase {
func testAddMediaBlocks() throws {
try BlockEditorScreen()
.addImage()
.verifyImageBlockDisplayed()

try XCTSkipIf(!XCUIDevice.isPad, "Test currently fails on iPhone in CI for add video and audio from URL - Tapping on the coordinate location results in a blank screen. Skipping rest of test on iPhone while investigation is in progress")

try BlockEditorScreen()
.addVideoFromUrl(urlPath: videoUrlPath)
.addAudioFromUrl(urlPath: audioUrlPath)
.verifyMediaBlocksDisplayed()
Expand Down
31 changes: 14 additions & 17 deletions WordPress/UITestsFoundation/Screens/Editor/BlockEditorScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -186,29 +186,26 @@ public class BlockEditorScreen: ScreenObject {
private func addMediaBlockFromUrl(blockType: String, UrlPath: String) {
addBlock(blockType)
insertFromUrlButton.tap()
app.textFields.element.typeText(UrlPath)
type(text: UrlPath, in: app.textFields.element)
// to dismiss media block URL prompt
tapTopOfScreen()
}

// Can be removed once `testAddMediaBlocks()` test is fixed on iPhone
@discardableResult
public func verifyImageBlockDisplayed() -> Self {
let imagePredicate = NSPredicate(format: "label == 'Image Block. Row 1'")
XCTAssertTrue(app.buttons.containing(imagePredicate).firstMatch.waitForExistence(timeout: 5))

return self
}

@discardableResult
public func verifyMediaBlocksDisplayed() -> Self {
let imagePredicate = NSPredicate(format: "label == 'Image Block. Row 1'")
let videoPredicate = NSPredicate(format: "label == 'Video Block. Row 2'")
let audioPredicate = NSPredicate(format: "label == 'Audio Block. Row 3'")

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