Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend mention test to cell rendering #1883

Merged
merged 1 commit into from
Nov 19, 2024
Merged
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
26 changes: 24 additions & 2 deletions NextcloudTalkTests/UI/UIRoomTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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() {
Expand Down
Loading