2023-03-14 10:50:09 +01:00
|
|
|
//
|
2024-09-06 16:34:30 +03:00
|
|
|
// Copyright 2022-2024 New Vector Ltd.
|
2023-03-14 10:50:09 +01:00
|
|
|
//
|
2025-01-06 11:27:37 +01:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
|
|
// Please see LICENSE files in the repository root for full details.
|
2023-03-14 10:50:09 +01:00
|
|
|
//
|
|
|
|
|
|
|
|
import XCTest
|
|
|
|
|
2023-05-15 15:42:40 +02:00
|
|
|
@MainActor
|
2023-03-14 10:50:09 +01:00
|
|
|
class StartChatScreenUITests: XCTestCase {
|
2023-05-15 15:42:40 +02:00
|
|
|
func testLanding() async throws {
|
2023-03-14 10:50:09 +01:00
|
|
|
let app = Application.launch(.startChat)
|
2023-05-15 15:42:40 +02:00
|
|
|
try await app.assertScreenshot(.startChat)
|
2023-03-14 10:50:09 +01:00
|
|
|
}
|
2023-03-29 14:29:25 +02:00
|
|
|
|
2023-05-15 15:42:40 +02:00
|
|
|
func testSearchWithNoResults() async throws {
|
2023-03-29 14:29:25 +02:00
|
|
|
let app = Application.launch(.startChat)
|
|
|
|
let searchField = app.searchFields.firstMatch
|
2024-10-10 08:38:40 +01:00
|
|
|
searchField.clearAndTypeText("None\n", app: app)
|
2023-03-29 14:29:25 +02:00
|
|
|
XCTAssert(app.staticTexts[A11yIdentifiers.startChatScreen.searchNoResults].waitForExistence(timeout: 1.0))
|
2025-01-08 10:55:26 +02:00
|
|
|
try await app.assertScreenshot(.startChat, step: 1, delay: .seconds(0.5))
|
2023-03-29 14:29:25 +02:00
|
|
|
}
|
|
|
|
|
2023-05-15 15:42:40 +02:00
|
|
|
func testSearchWithResults() async throws {
|
2023-03-29 14:29:25 +02:00
|
|
|
let app = Application.launch(.startChatWithSearchResults)
|
|
|
|
let searchField = app.searchFields.firstMatch
|
2024-10-10 08:38:40 +01:00
|
|
|
searchField.clearAndTypeText("Bob\n", app: app)
|
2023-04-04 10:47:41 +02:00
|
|
|
XCTAssertFalse(app.staticTexts[A11yIdentifiers.startChatScreen.searchNoResults].waitForExistence(timeout: 1.0))
|
|
|
|
XCTAssertEqual(app.collectionViews.firstMatch.cells.count, 2)
|
2025-01-08 10:55:26 +02:00
|
|
|
try await app.assertScreenshot(.startChat, step: 2, delay: .seconds(0.5))
|
2023-04-04 10:47:41 +02:00
|
|
|
}
|
2023-03-14 10:50:09 +01:00
|
|
|
}
|