diff --git a/RiotSwiftUI/Modules/UserSessions/UserOtherSessions/Test/UI/UserOtherSessionsUITests.swift b/RiotSwiftUI/Modules/UserSessions/UserOtherSessions/Test/UI/UserOtherSessionsUITests.swift index 45d43f3b3..17b1e01c5 100644 --- a/RiotSwiftUI/Modules/UserSessions/UserOtherSessions/Test/UI/UserOtherSessionsUITests.swift +++ b/RiotSwiftUI/Modules/UserSessions/UserOtherSessions/Test/UI/UserOtherSessionsUITests.swift @@ -20,9 +20,11 @@ import XCTest class UserOtherSessionsUITests: MockScreenTestCase { func test_whenOtherSessionsWithInactiveSessionFilterPresented_correctHeaderDisplayed() { app.goToScreenWithIdentifier(MockUserOtherSessionsScreenState.inactiveSessions.title) - XCTAssertTrue(app.staticTexts[VectorL10n.userOtherSessionFilterMenuInactive].exists) - XCTAssertTrue(app.staticTexts[VectorL10n.userSessionsOverviewSecurityRecommendationsInactiveInfo].exists) + let buttonLearnMore = app.buttons["\(VectorL10n.userSessionsOverviewSecurityRecommendationsInactiveInfo) \(VectorL10n.userSessionLearnMore)"] + XCTAssertTrue(buttonLearnMore.exists) + buttonLearnMore.tap() + XCTAssertTrue(app.staticTexts[VectorL10n.userSessionInactiveSessionTitle].exists) } func test_whenOtherSessionsWithInactiveSessionFilterPresented_correctItemsDisplayed() { @@ -33,9 +35,12 @@ class UserOtherSessionsUITests: MockScreenTestCase { func test_whenOtherSessionsWithUnverifiedSessionFilterPresented_correctHeaderDisplayed() { app.goToScreenWithIdentifier(MockUserOtherSessionsScreenState.unverifiedSessions.title) - XCTAssertTrue(app.staticTexts[VectorL10n.userSessionUnverifiedShort].exists) - XCTAssertTrue(app.staticTexts[VectorL10n.userOtherSessionUnverifiedSessionsHeaderSubtitle].exists) + XCTAssertTrue(app.staticTexts[VectorL10n.userOtherSessionFilterMenuUnverified].exists) + let buttonLearnMore = app.buttons["\(VectorL10n.userOtherSessionUnverifiedSessionsHeaderSubtitle) \(VectorL10n.userSessionLearnMore)"] + XCTAssertTrue(buttonLearnMore.exists) + buttonLearnMore.tap() + XCTAssertTrue(app.staticTexts[VectorL10n.userSessionUnverifiedSessionTitle].exists) } func test_whenOtherSessionsWithUnverifiedSessionFilterPresented_correctItemsDisplayed() { @@ -47,14 +52,17 @@ class UserOtherSessionsUITests: MockScreenTestCase { func test_whenOtherSessionsWithAllSessionFilterPresented_correctHeaderDisplayed() { app.goToScreenWithIdentifier(MockUserOtherSessionsScreenState.all.title) - XCTAssertTrue(app.staticTexts[VectorL10n.userSessionsOverviewOtherSessionsSectionInfo].exists) + XCTAssertTrue(app.buttons[VectorL10n.userSessionsOverviewOtherSessionsSectionInfo].exists) } func test_whenOtherSessionsWithVerifiedSessionFilterPresented_correctHeaderDisplayed() { app.goToScreenWithIdentifier(MockUserOtherSessionsScreenState.verifiedSessions.title) - XCTAssertTrue(app.staticTexts[VectorL10n.userSessionVerifiedShort].exists) - XCTAssertTrue(app.staticTexts[VectorL10n.userOtherSessionVerifiedSessionsHeaderSubtitle].exists) + XCTAssertTrue(app.staticTexts[VectorL10n.userOtherSessionFilterMenuVerified].exists) + let buttonLearnMore = app.buttons["\(VectorL10n.userOtherSessionVerifiedSessionsHeaderSubtitle) \(VectorL10n.userSessionLearnMore)"] + XCTAssertTrue(buttonLearnMore.exists) + buttonLearnMore.tap() + XCTAssertTrue(app.staticTexts[VectorL10n.userSessionVerifiedSessionTitle].exists) } func test_whenOtherSessionsMoreMenuButtonSelected_selectSessionsButtonExists() { @@ -92,4 +100,12 @@ class UserOtherSessionsUITests: MockScreenTestCase { } XCTAssertTrue(app.buttons["Deselect All"].exists) } + + func test_whenAllOtherSessionsAreShown_learnMoreButtonIsNotShown() { + app.goToScreenWithIdentifier(MockUserOtherSessionsScreenState.all.title) + let button = app.buttons[VectorL10n.userSessionsOverviewOtherSessionsSectionInfo] + let buttonLearnMore = app.buttons["\(VectorL10n.userSessionsOverviewOtherSessionsSectionInfo) + \(VectorL10n.userSessionLearnMore)"] + XCTAssertTrue(button.exists) + XCTAssertFalse(buttonLearnMore.exists) + } } diff --git a/RiotSwiftUI/Modules/UserSessions/UserOtherSessions/UserOtherSessionsModels.swift b/RiotSwiftUI/Modules/UserSessions/UserOtherSessions/UserOtherSessionsModels.swift index 30648c051..77224de45 100644 --- a/RiotSwiftUI/Modules/UserSessions/UserOtherSessions/UserOtherSessionsModels.swift +++ b/RiotSwiftUI/Modules/UserSessions/UserOtherSessions/UserOtherSessionsModels.swift @@ -42,7 +42,7 @@ struct UserOtherSessionsViewState: BindableState, Equatable { struct UserOtherSessionsBindings: Equatable { var filter: UserOtherSessionsFilter var isEditModeEnabled: Bool - var showBottomSheet: Bool = false + var showBottomSheet = false } enum UserOtherSessionsViewAction {