Add UI tests

This commit is contained in:
Alfonso Grillo
2022-10-26 18:49:47 +02:00
parent d26c919f80
commit 9336079cf2
6 changed files with 65 additions and 22 deletions
@@ -19,19 +19,19 @@ import XCTest
class UserSessionOverviewUITests: MockScreenTestCase {
func test_whenCurrentSessionSelected_correctNavTittleDisplayed() {
app.goToScreenWithIdentifier(MockUserSessionOverviewScreenState.currentSession.title)
app.goToScreenWithIdentifier(MockUserSessionOverviewScreenState.currentSession(sessionState: .unverified).title)
let navTitle = VectorL10n.userSessionOverviewCurrentSessionTitle
XCTAssertTrue(app.navigationBars[navTitle].staticTexts[navTitle].exists)
}
func test_whenOtherSessionSelected_correctNavTittleDisplayed() {
app.goToScreenWithIdentifier(MockUserSessionOverviewScreenState.otherSession.title)
app.goToScreenWithIdentifier(MockUserSessionOverviewScreenState.otherSession(sessionState: .verified).title)
let navTitle = VectorL10n.userSessionOverviewSessionTitle
XCTAssertTrue(app.navigationBars[navTitle].staticTexts[navTitle].exists)
}
func test_whenSessionOverviewPresented_sessionDetailsButtonExists() {
app.goToScreenWithIdentifier(MockUserSessionOverviewScreenState.currentSession.title)
app.goToScreenWithIdentifier(MockUserSessionOverviewScreenState.currentSession(sessionState: .unverified).title)
XCTAssertTrue(app.buttons[VectorL10n.userSessionOverviewSessionDetailsButtonTitle].exists)
}
@@ -61,4 +61,30 @@ class UserSessionOverviewUITests: MockScreenTestCase {
XCTAssertTrue(app.staticTexts[VectorL10n.userSessionPushNotifications].exists)
XCTAssertTrue(app.staticTexts[VectorL10n.userSessionPushNotificationsMessage].exists)
}
func test_whenOtherSessionSelected_learnMoreButtonDoesnExist() {
let title = MockUserSessionOverviewScreenState.currentSession(sessionState: .verified).title
app.goToScreenWithIdentifier(title)
let buttonId = "\(VectorL10n.userOtherSessionVerifiedAdditionalInfo) \(VectorL10n.userSessionLearnMore)"
let button = app.buttons[buttonId]
XCTAssertFalse(button.exists)
}
func test_whenOtherVerifiedSessionSelected_learnMoreButtonExists() {
app.goToScreenWithIdentifier(MockUserSessionOverviewScreenState.otherSession(sessionState: .verified).title)
let buttonId = "\(VectorL10n.userOtherSessionVerifiedAdditionalInfo) \(VectorL10n.userSessionLearnMore)"
let button = app.buttons[buttonId]
XCTAssertTrue(button.exists)
button.tap()
XCTAssertTrue(app.staticTexts[VectorL10n.userSessionVerifiedSessionTitle].exists)
}
func test_whenOtherUnverifiedSessionSelected_learnMoreButtonExists() {
app.goToScreenWithIdentifier(MockUserSessionOverviewScreenState.otherSession(sessionState: .unverified).title)
let buttonId = "\(VectorL10n.userOtherSessionUnverifiedAdditionalInfo) \(VectorL10n.userSessionLearnMore)"
let button = app.buttons[buttonId]
XCTAssertTrue(button.exists)
button.tap()
XCTAssertTrue(app.staticTexts[VectorL10n.userSessionUnverifiedSessionTitle].exists)
}
}