ui test improvements

This commit is contained in:
Mauro Romito
2022-10-13 03:10:25 +02:00
parent c1d06f2150
commit f382f4e1fb
2 changed files with 22 additions and 23 deletions
@@ -32,28 +32,6 @@ final class ComposerUITests: MockScreenTestCase {
XCTAssertFalse(app.buttons["editButton"].exists)
}
func testEditMode() throws {
app.goToScreenWithIdentifier(MockComposerScreenState.edit.title)
let wysiwygTextView = app.textViews.allElementsBoundByIndex[0]
XCTAssertTrue(wysiwygTextView.exists)
let editButton = app.buttons["editButton"]
XCTAssert(!editButton.exists)
let cancelButton = app.buttons["cancelButton"]
XCTAssertTrue(cancelButton.exists)
wysiwygTextView.tap()
wysiwygTextView.typeText("test")
XCTAssertTrue(editButton.exists)
XCTAssertFalse(app.buttons["sendButton"].exists)
cancelButton.tap()
let textViewContent = wysiwygTextView.value as! String
XCTAssertTrue(textViewContent.isEmpty)
XCTAssertFalse(cancelButton.exists)
}
func testReplyMode() throws {
app.goToScreenWithIdentifier(MockComposerScreenState.reply.title)
@@ -75,4 +53,26 @@ final class ComposerUITests: MockScreenTestCase {
XCTAssertFalse(textViewContent.isEmpty)
XCTAssertFalse(cancelButton.exists)
}
func testEditMode() throws {
app.goToScreenWithIdentifier(MockComposerScreenState.edit.title)
let wysiwygTextView = app.textViews.allElementsBoundByIndex[0]
XCTAssertTrue(wysiwygTextView.exists)
let editButton = app.buttons["editButton"]
XCTAssert(!editButton.exists)
let cancelButton = app.buttons["cancelButton"]
XCTAssertTrue(cancelButton.exists)
wysiwygTextView.tap()
wysiwygTextView.typeText("test")
XCTAssertTrue(editButton.exists)
XCTAssertFalse(app.buttons["sendButton"].exists)
cancelButton.tap()
let textViewContent = wysiwygTextView.value as! String
XCTAssertTrue(textViewContent.isEmpty)
XCTAssertFalse(cancelButton.exists)
}
}
@@ -89,7 +89,6 @@ struct Composer: View {
Image(Asset.Images.inputCloseIcon.name)
.foregroundColor(theme.colors.tertiaryContent)
}
.accessibilityAddTraits(.isButton)
.accessibilityIdentifier("cancelButton")
}
.padding(.top, 8)