mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-20 16:42:44 +02:00
Add utility to run UI tests for Screen states, add screen states for template and finish unit test.
This commit is contained in:
+24
-22
@@ -15,33 +15,35 @@
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import RiotSwiftUI
|
||||
import RiotSwiftUI
|
||||
|
||||
@available(iOS 14.0, *)
|
||||
class TestUserProfileUITests: XCTestCase {
|
||||
|
||||
let app = XCUIApplication()
|
||||
class TestUserProfileUITests: MockScreenTest {
|
||||
|
||||
override func setUpWithError() throws {
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
|
||||
// In UI tests it is usually best to stop immediately when a failure occurs.
|
||||
continueAfterFailure = false
|
||||
|
||||
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
|
||||
app.launch()
|
||||
|
||||
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
|
||||
override class var screenType: MockScreenState.Type {
|
||||
return MockTemplateProfileUserScreenState.self
|
||||
}
|
||||
|
||||
override func tearDownWithError() throws {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
|
||||
func testTemplateUserProfileScreen() throws {
|
||||
guard let screenState = screenState as? MockTemplateProfileUserScreenState else { fatalError("no screen") }
|
||||
switch screenState {
|
||||
case .presence(let presence):
|
||||
testTemplateUserProfilePresence(presence: presence)
|
||||
case .longDisplayName(let name):
|
||||
testTemplateUserProfileLongName(name: name)
|
||||
}
|
||||
}
|
||||
|
||||
func testUserContentTextDisplayed() throws {
|
||||
let userContentText = app.staticTexts["More great user content!"]
|
||||
XCTAssert(userContentText.exists)
|
||||
|
||||
func testTemplateUserProfilePresence(presence: TemplateUserProfilePresence) {
|
||||
let presenceText = app.staticTexts["presenceText"]
|
||||
XCTAssert(presenceText.exists)
|
||||
XCTAssert(presenceText.label == presence.title)
|
||||
}
|
||||
|
||||
func testTemplateUserProfileLongName(name: String) {
|
||||
let displayNameText = app.staticTexts["displayNameText"]
|
||||
XCTAssert(displayNameText.exists)
|
||||
XCTAssert(displayNameText.label == name)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user