diff --git a/.buildkite/cache-builder.yml b/.buildkite/cache-builder.yml index 3e11fb963796..405b5c32eae3 100644 --- a/.buildkite/cache-builder.yml +++ b/.buildkite/cache-builder.yml @@ -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/" diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 2db9e6d19145..ac9e016e4030 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -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/" diff --git a/.buildkite/release-builds.yml b/.buildkite/release-builds.yml index 1003df4508be..53447e466cdc 100644 --- a/.buildkite/release-builds.yml +++ b/.buildkite/release-builds.yml @@ -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/" diff --git a/WordPress/UITestsFoundation/Screens/Editor/BlockEditorScreen.swift b/WordPress/UITestsFoundation/Screens/Editor/BlockEditorScreen.swift index b0272f6fe174..bfe10257977b 100644 --- a/WordPress/UITestsFoundation/Screens/Editor/BlockEditorScreen.swift +++ b/WordPress/UITestsFoundation/Screens/Editor/BlockEditorScreen.swift @@ -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 } @@ -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 } @@ -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() + } }