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
2 changes: 1 addition & 1 deletion .buildkite/cache-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
common_params:
# Common plugin settings to use with the `plugins` key.
- &common_plugins
- automattic/a8c-ci-toolkit#2.17.0
- automattic/a8c-ci-toolkit#2.18.1
- automattic/git-s3-cache#1.1.4:
bucket: "a8c-repo-mirrors"
repo: "automattic/wordpress-ios/"
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
common_params:
# Common plugin settings to use with the `plugins` key.
- &common_plugins
- automattic/a8c-ci-toolkit#2.17.0
- automattic/a8c-ci-toolkit#2.18.1
- automattic/git-s3-cache#1.1.4:
bucket: "a8c-repo-mirrors"
repo: "automattic/wordpress-ios/"
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/release-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
common_params:
# Common plugin settings to use with the `plugins` key.
- &common_plugins
- automattic/a8c-ci-toolkit#2.17.0
- automattic/a8c-ci-toolkit#2.18.1
- automattic/git-s3-cache#1.1.4:
bucket: "a8c-repo-mirrors"
repo: "automattic/wordpress-ios/"
Expand Down
46 changes: 42 additions & 4 deletions WordPress/UITestsFoundation/Screens/Editor/BlockEditorScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ public class BlockEditorScreen: ScreenObject {
public func enterTextInTitle(text: String) -> BlockEditorScreen {
let titleView = app.otherElements["Post title. Empty"].firstMatch // Uses a localized string
XCTAssert(titleView.waitForExistence(timeout: 3), "Title View does not exist!")

titleView.tap()
titleView.typeText(text)
type(text: text, in: titleView)

return self
}
Expand All @@ -72,7 +70,7 @@ public class BlockEditorScreen: ScreenObject {
addBlock("Paragraph block")

let paragraphView = app.otherElements["Paragraph Block. Row 1. Empty"].textViews.element(boundBy: 0)
paragraphView.typeText(text)
type(text: text, in: paragraphView)

return self
}
Expand Down Expand Up @@ -368,4 +366,44 @@ public class BlockEditorScreen: ScreenObject {
editorCloseButton.coordinate(withNormalizedOffset: CGVector(dx: 0, dy: 0)).tap()
return try BlockEditorScreen()
}

// This could be moved as an XCUIApplication method via an extension if needed elsewhere.
private func type(text: String, in element: XCUIElement) {
// A simple implementation here would be:
//
// element.tap()
// element.typeText(text)
//
// But as of a recent (but not pinpointed at the time of writing) Gutenberg update, that is not enough.
// The test would fail with: Neither element nor any descendant has keyboard focus.
// (E.g.: https://buildkite.com/automattic/wordpress-ios/builds/15598)
//
// The following is a convoluted but seemingly robust approach that bypasses the keyboard by using the pasteboard instead.
UIPasteboard.general.string = text

// Safety check
XCTAssertTrue(element.waitForExistence(timeout: 1))

element.doubleTap()

let pasteButton = app.menuItems["Paste"]

if pasteButton.waitForExistence(timeout: 1) == false {
// Drill in hierarchy looking for it
var found = false
element.descendants(matching: .any).enumerated().forEach { e in
guard found == false else { return }

e.element.firstMatch.doubleTap()

if pasteButton.waitForExistence(timeout: 1) {
found = true
}
}
}

XCTAssertTrue(pasteButton.exists, "Could not find menu item paste button.")

pasteButton.tap()
}
}