mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Fixed UI test problems introduced after the accessibility identifier … (#586)
* Fixed UI test problems introduced after the accessibility identifier changes * Disable parallel UITests, they don't seem to work properly * Fix UITests `elementFallbackLanguage`
This commit is contained in:
@@ -23,6 +23,7 @@ struct A11yIdentifiers {
|
|||||||
static let loginScreen = LoginScreen()
|
static let loginScreen = LoginScreen()
|
||||||
static let onboardingScreen = OnboardingScreen()
|
static let onboardingScreen = OnboardingScreen()
|
||||||
static let roomScreen = RoomScreen()
|
static let roomScreen = RoomScreen()
|
||||||
|
static let roomDetailsScreen = RoomDetailsScreen()
|
||||||
static let sessionVerificationScreen = SessionVerificationScreen()
|
static let sessionVerificationScreen = SessionVerificationScreen()
|
||||||
static let softLogoutScreen = SoftLogoutScreen()
|
static let softLogoutScreen = SoftLogoutScreen()
|
||||||
|
|
||||||
@@ -64,15 +65,20 @@ struct A11yIdentifiers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct RoomScreen {
|
struct RoomScreen {
|
||||||
let name = "room_name"
|
let name = "room-name"
|
||||||
let avatar = "room_avatar"
|
let avatar = "room-avatar"
|
||||||
|
}
|
||||||
|
|
||||||
|
struct RoomDetailsScreen {
|
||||||
|
let avatar = "room_details-avatar"
|
||||||
|
let people = "room_details-people"
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SessionVerificationScreen {
|
struct SessionVerificationScreen {
|
||||||
let requestVerification = "session_verification-request_verification"
|
let requestVerification = "session_verification-request_verification"
|
||||||
let startSasVerification = "session_verification-start_sas_verification"
|
let startSasVerification = "session_verification-start_sas_verification"
|
||||||
let acceptChallenge = "session_verification-accept_challenge"
|
let acceptChallenge = "session_verification-accept_challenge"
|
||||||
let declineChallenge = "session_verification-accept_challenge"
|
let declineChallenge = "session_verification-decline_challenge"
|
||||||
let close = "session_verification-close"
|
let close = "session_verification-close"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ struct RoomDetailsScreen: View {
|
|||||||
contentID: context.viewState.roomId,
|
contentID: context.viewState.roomId,
|
||||||
avatarSize: .room(on: .details),
|
avatarSize: .room(on: .details),
|
||||||
imageProvider: context.imageProvider)
|
imageProvider: context.imageProvider)
|
||||||
|
.accessibilityIdentifier(A11yIdentifiers.roomDetailsScreen.avatar)
|
||||||
|
|
||||||
Text(context.viewState.title)
|
Text(context.viewState.title)
|
||||||
.foregroundColor(.element.primaryContent)
|
.foregroundColor(.element.primaryContent)
|
||||||
@@ -119,6 +120,7 @@ struct RoomDetailsScreen: View {
|
|||||||
}
|
}
|
||||||
.listRowInsets(listRowInsets)
|
.listRowInsets(listRowInsets)
|
||||||
.foregroundColor(.element.primaryContent)
|
.foregroundColor(.element.primaryContent)
|
||||||
|
.accessibilityIdentifier(A11yIdentifiers.roomDetailsScreen.people)
|
||||||
.disabled(context.viewState.isLoadingMembers)
|
.disabled(context.viewState.isLoadingMembers)
|
||||||
} header: {
|
} header: {
|
||||||
Text(ElementL10n.roomDetailsAboutSectionTitle)
|
Text(ElementL10n.roomDetailsAboutSectionTitle)
|
||||||
|
|||||||
@@ -34,13 +34,13 @@ class UITestsAppCoordinator: AppCoordinatorProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start() {
|
||||||
|
Bundle.elementFallbackLanguage = "en"
|
||||||
|
|
||||||
guard let screenID = Tests.screenID else { fatalError("Unable to launch with unknown screen.") }
|
guard let screenID = Tests.screenID else { fatalError("Unable to launch with unknown screen.") }
|
||||||
|
|
||||||
let mockScreen = MockScreen(id: screenID)
|
let mockScreen = MockScreen(id: screenID)
|
||||||
navigationRootCoordinator.setRootCoordinator(mockScreen.coordinator)
|
navigationRootCoordinator.setRootCoordinator(mockScreen.coordinator)
|
||||||
self.mockScreen = mockScreen
|
self.mockScreen = mockScreen
|
||||||
|
|
||||||
Bundle.elementFallbackLanguage = "en"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func toPresentable() -> AnyView {
|
func toPresentable() -> AnyView {
|
||||||
|
|||||||
@@ -24,7 +24,10 @@ struct Application {
|
|||||||
"IS_RUNNING_UI_TESTS": "1",
|
"IS_RUNNING_UI_TESTS": "1",
|
||||||
"UI_TESTS_SCREEN": identifier.rawValue
|
"UI_TESTS_SCREEN": identifier.rawValue
|
||||||
]
|
]
|
||||||
|
|
||||||
|
// Use the same fallback language as the real app so translation comparison works
|
||||||
Bundle.elementFallbackLanguage = "en"
|
Bundle.elementFallbackLanguage = "en"
|
||||||
|
|
||||||
app.launch()
|
app.launch()
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,14 +21,16 @@ class RoomDetailsScreenUITests: XCTestCase {
|
|||||||
func testInitialStateComponents() {
|
func testInitialStateComponents() {
|
||||||
let app = Application.launch(.roomDetailsScreen)
|
let app = Application.launch(.roomDetailsScreen)
|
||||||
|
|
||||||
XCTAssert(app.staticTexts[A11yIdentifiers.roomScreen.avatar].exists)
|
XCTAssert(app.staticTexts[A11yIdentifiers.roomDetailsScreen.avatar].exists)
|
||||||
|
XCTAssert(app.buttons[A11yIdentifiers.roomDetailsScreen.people].waitForExistence(timeout: 1))
|
||||||
app.assertScreenshot(.roomDetailsScreen)
|
app.assertScreenshot(.roomDetailsScreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testInitialStateComponentsWithRoomAvatar() {
|
func testInitialStateComponentsWithRoomAvatar() {
|
||||||
let app = Application.launch(.roomDetailsScreenWithRoomAvatar)
|
let app = Application.launch(.roomDetailsScreenWithRoomAvatar)
|
||||||
|
|
||||||
XCTAssert(app.images[A11yIdentifiers.roomScreen.avatar].waitForExistence(timeout: 1))
|
XCTAssert(app.images[A11yIdentifiers.roomDetailsScreen.avatar].waitForExistence(timeout: 1))
|
||||||
|
XCTAssert(app.buttons[A11yIdentifiers.roomDetailsScreen.people].waitForExistence(timeout: 1))
|
||||||
app.assertScreenshot(.roomDetailsScreenWithRoomAvatar)
|
app.assertScreenshot(.roomDetailsScreenWithRoomAvatar)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,6 @@
|
|||||||
},
|
},
|
||||||
"testTargets" : [
|
"testTargets" : [
|
||||||
{
|
{
|
||||||
"parallelizable" : true,
|
|
||||||
"target" : {
|
"target" : {
|
||||||
"containerPath" : "container:ElementX.xcodeproj",
|
"containerPath" : "container:ElementX.xcodeproj",
|
||||||
"identifier" : "0E28CD62691FDBC63147D5E3",
|
"identifier" : "0E28CD62691FDBC63147D5E3",
|
||||||
|
|||||||
Reference in New Issue
Block a user