mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Simplify the screen templates
This commit is contained in:
committed by
Stefan Ceriu
parent
28c2490910
commit
6e5854abf9
@@ -19,25 +19,12 @@ import XCTest
|
||||
|
||||
@MainActor
|
||||
class TemplateScreenUITests: XCTestCase {
|
||||
func testRegularScreen() async throws {
|
||||
let app = Application.launch(.simpleRegular)
|
||||
func testScreen() async throws {
|
||||
let app = Application.launch(.templateScreen)
|
||||
|
||||
let title = app.staticTexts["title"]
|
||||
let title = app.staticTexts["Template title"]
|
||||
XCTAssert(title.exists)
|
||||
|
||||
XCTAssertEqual(title.label, "Make this chat public?")
|
||||
|
||||
try await app.assertScreenshot(.simpleRegular)
|
||||
}
|
||||
|
||||
func testUpgradeScreen() async throws {
|
||||
let app = Application.launch(.simpleUpgrade)
|
||||
|
||||
let title = app.staticTexts["title"]
|
||||
XCTAssert(title.exists)
|
||||
|
||||
XCTAssertEqual(title.label, "Privacy warning")
|
||||
|
||||
try await app.assertScreenshot(.simpleUpgrade)
|
||||
try await app.assertScreenshot(.templateScreen)
|
||||
}
|
||||
}
|
||||
|
||||
+6
-14
@@ -20,10 +20,6 @@ import XCTest
|
||||
|
||||
@MainActor
|
||||
class TemplateScreenViewModelTests: XCTestCase {
|
||||
private enum Constants {
|
||||
static let counterInitialValue = 0
|
||||
}
|
||||
|
||||
var viewModel: TemplateScreenViewModelProtocol!
|
||||
|
||||
var context: TemplateScreenViewModelType.Context {
|
||||
@@ -31,21 +27,17 @@ class TemplateScreenViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
override func setUpWithError() throws {
|
||||
viewModel = TemplateScreenViewModel(promptType: .regular, initialCount: Constants.counterInitialValue)
|
||||
viewModel = TemplateScreenViewModel()
|
||||
}
|
||||
|
||||
func testInitialState() {
|
||||
XCTAssertEqual(context.viewState.count, Constants.counterInitialValue)
|
||||
XCTAssertFalse(context.viewState.placeholder.isEmpty)
|
||||
XCTAssertFalse(context.composerText.isEmpty)
|
||||
}
|
||||
|
||||
func testCounter() async throws {
|
||||
context.send(viewAction: .incrementCount)
|
||||
XCTAssertEqual(context.viewState.count, 1)
|
||||
|
||||
context.send(viewAction: .incrementCount)
|
||||
XCTAssertEqual(context.viewState.count, 2)
|
||||
|
||||
context.send(viewAction: .decrementCount)
|
||||
XCTAssertEqual(context.viewState.count, 1)
|
||||
context.composerText = "123"
|
||||
context.send(viewAction: .textChanged)
|
||||
XCTAssertEqual(context.composerText, "123")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user