2022-08-18 16:32:29 +03:00
|
|
|
//
|
2024-09-06 16:34:30 +03:00
|
|
|
// Copyright 2022-2024 New Vector Ltd.
|
2022-08-18 16:32:29 +03: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.
|
2022-08-18 16:32:29 +03:00
|
|
|
//
|
|
|
|
|
|
|
|
import XCTest
|
|
|
|
|
2022-12-15 15:22:39 +02:00
|
|
|
@MainActor
|
|
|
|
class UserSessionScreenTests: XCTestCase {
|
2023-11-13 16:44:29 +00:00
|
|
|
let firstRoomName = "Foundation 🔭🪐🌌"
|
|
|
|
|
2022-12-15 15:22:39 +02:00
|
|
|
func testUserSessionFlows() async throws {
|
2023-02-14 16:25:24 +00:00
|
|
|
let app = Application.launch(.userSessionScreen)
|
2024-11-07 10:54:12 +02:00
|
|
|
|
|
|
|
app.swipeDown() // Make sure the header shows a large title
|
|
|
|
|
2025-03-04 17:17:52 +02:00
|
|
|
try await app.assertScreenshot(step: 1)
|
2023-09-05 17:39:54 +02:00
|
|
|
|
2023-11-13 16:44:29 +00:00
|
|
|
app.buttons[A11yIdentifiers.homeScreen.roomName(firstRoomName)].tap()
|
|
|
|
XCTAssert(app.staticTexts[firstRoomName].waitForExistence(timeout: 5.0))
|
2022-12-15 15:22:39 +02:00
|
|
|
try await Task.sleep(for: .seconds(1))
|
2025-03-04 17:17:52 +02:00
|
|
|
try await app.assertScreenshot(step: 2)
|
2023-09-05 17:39:54 +02:00
|
|
|
|
2024-10-01 18:50:11 +03:00
|
|
|
app.buttons[A11yIdentifiers.roomScreen.composerToolbar.openComposeOptions].tapCenter()
|
2025-03-04 17:17:52 +02:00
|
|
|
try await app.assertScreenshot(step: 3)
|
2022-08-18 16:32:29 +03:00
|
|
|
}
|
2023-09-05 17:39:54 +02:00
|
|
|
|
|
|
|
func testUserSessionReply() async throws {
|
|
|
|
let app = Application.launch(.userSessionScreenReply, disableTimelineAccessibility: false)
|
2023-11-13 16:44:29 +00:00
|
|
|
app.buttons[A11yIdentifiers.homeScreen.roomName(firstRoomName)].tap()
|
|
|
|
XCTAssert(app.staticTexts[firstRoomName].waitForExistence(timeout: 5.0))
|
2023-09-05 17:39:54 +02:00
|
|
|
try await Task.sleep(for: .seconds(1))
|
|
|
|
|
2024-02-14 17:21:44 +02:00
|
|
|
let cell = app.cells.element(boundBy: 1) // Skip the typing indicator cell
|
2023-09-05 17:39:54 +02:00
|
|
|
cell.swipeRight(velocity: .fast)
|
|
|
|
|
2025-03-04 17:17:52 +02:00
|
|
|
try await app.assertScreenshot()
|
2023-09-05 17:39:54 +02:00
|
|
|
}
|
2023-09-11 09:54:37 +02:00
|
|
|
|
2024-01-25 17:08:14 +02:00
|
|
|
func testElementCall() async throws {
|
|
|
|
let app = Application.launch(.userSessionScreen)
|
|
|
|
|
|
|
|
app.buttons[A11yIdentifiers.homeScreen.roomName(firstRoomName)].tap()
|
|
|
|
XCTAssert(app.staticTexts[firstRoomName].waitForExistence(timeout: 5.0))
|
|
|
|
|
|
|
|
app.buttons[A11yIdentifiers.roomScreen.joinCall].tap()
|
|
|
|
|
|
|
|
let textField = app.textFields["Display name"]
|
|
|
|
XCTAssert(textField.waitForExistence(timeout: 10))
|
|
|
|
|
2024-11-07 10:10:17 +02:00
|
|
|
let joinButton = app.buttons["Continue"]
|
2024-01-25 17:08:14 +02:00
|
|
|
XCTAssert(joinButton.waitForExistence(timeout: 10))
|
|
|
|
}
|
2022-08-18 16:32:29 +03:00
|
|
|
}
|