From 5205d589542d7444f6bab5f98f18430fe2bdb486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Tue, 19 Nov 2024 10:25:12 +0100 Subject: [PATCH] Extend mention test to cell rendering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- NextcloudTalkTests/UI/UIRoomTest.swift | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/NextcloudTalkTests/UI/UIRoomTest.swift b/NextcloudTalkTests/UI/UIRoomTest.swift index 5d40759cf..71cc0d6c4 100644 --- a/NextcloudTalkTests/UI/UIRoomTest.swift +++ b/NextcloudTalkTests/UI/UIRoomTest.swift @@ -128,8 +128,8 @@ final class UIRoomTest: XCTestCase { textView.typeText("M") textView.typeText("e") - let predicate = NSPredicate(format: "label CONTAINS[c] %@", newConversationName) - let autoCompleteCell = app.tables.cells["AutoCompletionCellIdentifier"].staticTexts.containing(predicate).firstMatch + let predicateLabel = NSPredicate(format: "label CONTAINS[c] %@", newConversationName) + let autoCompleteCell = app.tables.cells["AutoCompletionCellIdentifier"].staticTexts.containing(predicateLabel).firstMatch XCTAssert(autoCompleteCell.waitForExistence(timeout: TestConstants.timeoutShort)) autoCompleteCell.tap() @@ -142,6 +142,28 @@ final class UIRoomTest: XCTestCase { // Check if the input field is now empty XCTAssertEqual(textView.value as? String ?? "", "") + + // Try to send a mention and check if it's rendered + textView.tap() + textView.typeText("@") + textView.typeText("M") + textView.typeText("e") + + XCTAssert(autoCompleteCell.waitForExistence(timeout: TestConstants.timeoutShort)) + + autoCompleteCell.tap() + + // Check if the mention was correctly inserted in the textView + XCTAssertEqual(textView.value as? String ?? "", "@\(newConversationName) ") + + let sendMessageButton = toolbar.buttons["Send message"] + sendMessageButton.tap() + + // Wait for temporary message to be replaced + XCTAssert(app.images["MessageSent"].waitForExistence(timeout: TestConstants.timeoutShort)) + + let tables = app.tables + XCTAssert(tables.textViews["@" + newConversationName].waitForExistence(timeout: TestConstants.timeoutShort)) } func testLobbyView() {