1

What I'm doing.

  1. I am creating a paragraph block/row
  2. Filling that row with random text
  3. Copying and pasting that row using the built-in copy and paste block feature
  4. Then trying to assert the newly pasted row to check it matches the text in the first block of the text

Currently how I am asserting, but failing:

func confirmPastedParagraphBlock() -> BlockEditorScreen {
    XCTAssert(pastedBlockView.isEqual(copiedBlockView))

    return self
}

I am also using the following objects:

let copiedBlockView = XCUIApplication().otherElements["Paragraph Block. Row 1."]
let pastedBlockView = XCUIApplication().otherElements["Paragraph Block. Row 2."]

I know how I want to assert, but just not sure where I am going wrong - it fails at the confirmPastedParagraphBlock step when it's called.

Jon Reid
  • 20,545
  • 2
  • 64
  • 95

1 Answers1

0

XCUIApplication().otherElements["Paragraph Block. Row 1."] Returns an XCUIElement.

What you want to assert is the content of those elements.

If you look into XCUIElementAttributes you have a few properties at your disposal.

 /** The raw value attribute of the element. Depending on the element, the actual type can vary. */
    var value: Any? { get }

    /** The title attribute of the element. */
    var title: String { get }

    /** The label attribute of the element. */
    var label: String { get }
vibrazy
  • 91
  • 2