Add integration tests support for password saving, notifications and the analytics screen

This commit is contained in:
Stefan Ceriu
2023-04-20 15:54:41 +03:00
committed by Stefan Ceriu
parent 59a4e0ac7c
commit 0ed69d5649
4 changed files with 70 additions and 24 deletions
@@ -17,6 +17,7 @@
import Foundation
struct A11yIdentifiers {
static let analyticsPromptScreen = AnalyticsPromptScreen()
static let bugReportScreen = BugReportScreen()
static let changeServerScreen = ChangeServer()
static let homeScreen = HomeScreen()
@@ -30,6 +31,12 @@ struct A11yIdentifiers {
static let startChatScreen = StartChatScreen()
static let roomMemberDetailsScreen = RoomMemberDetailsScreen()
static let invitesScreen = InvitesScreen()
struct AnalyticsPromptScreen {
let title = "analytics_prompt-title"
let enable = "analytics_prompt-enable"
let notNow = "analytics_prompt-not_now"
}
struct BugReportScreen {
let report = "bug_report-report"
@@ -54,6 +61,12 @@ struct A11yIdentifiers {
"home_screen-room_name:\(name)"
}
}
struct InvitesScreen {
let noInvites = "invites-no_invites"
let accept = "invites-accept"
let decline = "invites-decline"
}
struct LoginScreen {
let emailUsername = "login-email_username"
@@ -84,6 +97,11 @@ struct A11yIdentifiers {
let people = "room_details-people"
}
struct RoomMemberDetailsScreen {
let ignore = "room_member_details-ignore"
let unignore = "room_member_details-unignore"
}
struct SessionVerificationScreen {
let requestVerification = "session_verification-request_verification"
let startSasVerification = "session_verification-start_sas_verification"
@@ -110,15 +128,4 @@ struct A11yIdentifiers {
let inviteFriends = "start_chat-invite_friends"
let searchNoResults = "start_chat-search_no_results"
}
struct RoomMemberDetailsScreen {
let ignore = "room_member_details-ignore"
let unignore = "room_member_details-unignore"
}
struct InvitesScreen {
let noInvites = "invites-no_invites"
let accept = "invites-accept"
let decline = "invites-decline"
}
}
@@ -32,4 +32,13 @@ extension XCUIElement {
typeText(String(character))
}
}
func forceTap() {
if isHittable {
tap()
} else {
let coordinate: XCUICoordinate = coordinate(withNormalizedOffset: .init(dx: 0.0, dy: 0.0))
coordinate.tap()
}
}
}
@@ -64,6 +64,7 @@ struct AnalyticsPrompt: View {
.multilineTextAlignment(.center)
.foregroundColor(.element.primaryContent)
.padding(.bottom, 2)
.accessibilityIdentifier(A11yIdentifiers.analyticsPromptScreen.title)
Text(context.viewState.strings.optInContent)
.font(.element.body)
@@ -100,12 +101,14 @@ struct AnalyticsPrompt: View {
.font(.element.bodyBold)
}
.buttonStyle(.elementAction(.xLarge))
.accessibilityIdentifier(A11yIdentifiers.analyticsPromptScreen.enable)
Button { context.send(viewAction: .disable) } label: {
Text(L10n.actionNotNow)
.font(.element.bodyBold)
.padding(12)
}
.accessibilityIdentifier(A11yIdentifiers.analyticsPromptScreen.notNow)
}
}
}