Update UI tests (#730)

* Update snapshots.

* Fix timeline grouping and UI tests.

* Remove German UI tests with double-length pseudolanguage.

Avoids tests breaking when translations are updated.
This commit is contained in:
Doug 2023-03-28 14:06:53 +01:00 committed by GitHub
parent e1df5310b7
commit d7622ea731
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
230 changed files with 536 additions and 384 deletions

4
.gitignore vendored
View File

@ -56,7 +56,7 @@ Tools/Scripts/element-android
# ignore all
/UITests/Sources/__Snapshots__/Application/*
# but keep the references
!/UITests/Sources/__Snapshots__/Application/de-DE-iPad-9th-generation.*.png
!/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.*.png
!/UITests/Sources/__Snapshots__/Application/de-DE-iPhone-14.*.png
!/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.*.png
!/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.*.png
!/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.*.png

View File

@ -65,6 +65,12 @@ The project uses its own shared githooks stored in the .githooks folder, you wil
git config core.hooksPath .githooks
```
### Strings and Translations
The project uses Localazy and is sharing its translations with the ElementX Android project: https://localazy.com/p/element
Please read the [Android docs](https://github.com/vector-im/element-x-android/blob/develop/tools/localazy/README.md) for more information about how this works. Note: On iOS we don't have the additional step of filtering strings per module.
### Continuous Integration
ElementX uses Fastlane for running actions on the CI and tries to keep the configuration confined to either [fastlane](fastlane/Fastfile) or [xcodegen](project.yml).

View File

@ -128,7 +128,6 @@ struct RoomDetailsScreen: View {
private var securitySection: some View {
Section {
HStack(alignment: .top) {
Label {
VStack(alignment: .leading, spacing: 2) {
Text(L10n.screenRoomDetailsEncryptionEnabledTitle)
@ -140,12 +139,6 @@ struct RoomDetailsScreen: View {
Image(systemName: "lock.shield")
}
.labelStyle(FormRowLabelStyle(alignment: .top))
Spacer()
Image(systemName: "checkmark")
.foregroundColor(.element.quaternaryContent)
}
} header: {
Text(L10n.commonSecurity)
.formSectionHeader()

View File

@ -196,7 +196,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
}
// can be improved by adding a date threshold
return otherEventTimelineItem.properties.reactions.isEmpty && eventTimelineItem.sender == otherEventTimelineItem.sender
return eventTimelineItem.properties.reactions.isEmpty && eventTimelineItem.sender == otherEventTimelineItem.sender
}
private func sendCurrentMessage() async {

View File

@ -23,14 +23,10 @@ struct MockMediaProvider: MediaProviderProtocol {
return nil
}
#warning("Fix me. this is stupid!")
if let size {
if size == AvatarSize.room(on: .details).scaledSize
|| size == AvatarSize.room(on: .home).scaledSize
|| size == AvatarSize.room(on: .timeline).scaledSize {
if source?.url == .picturesDirectory {
return Asset.Images.appLogo.image
}
}
return UIImage(systemName: "photo")
}

View File

@ -161,7 +161,7 @@ extension RoomTimelineViewProvider: View {
}
}
private var timelineGroupStyle: TimelineGroupStyle {
var timelineGroupStyle: TimelineGroupStyle {
switch self {
case .text(_, let groupStyle),
.separator(_, let groupStyle),

View File

@ -62,7 +62,7 @@ extension XCUIApplication {
}
private var testName: String {
languageCode + "-" + regionCode + "-" + deviceName
localeCode + "-" + deviceName
}
private var deviceName: String {
@ -77,6 +77,13 @@ extension XCUIApplication {
return name
}
private var localeCode: String {
if UserDefaults.standard.bool(forKey: "NSDoubleLocalizedStrings") {
return "pseudo"
}
return languageCode + "-" + regionCode
}
private var languageCode: String {
Locale.current.language.languageCode?.identifier ?? ""
}
@ -84,10 +91,6 @@ extension XCUIApplication {
private var regionCode: String {
Locale.current.language.region?.identifier ?? ""
}
private var osVersion: String {
UIDevice.current.systemVersion.replacingOccurrences(of: ".", with: "-")
}
}
private extension UIImage {

View File

@ -28,12 +28,15 @@ class BugReportUITests: XCTestCase {
func testToggleSendingLogs() {
let app = Application.launch(.bugReport)
app.switches[A11yIdentifiers.bugReportScreen.sendLogs].tap()
// Don't know why, but there's an issue on CI where the toggle is tapped but doesn't respond. Waiting for
// it fixes this (even it it already exists). Reproducible by running the test after quitting the simulator.
let sendingLogsToggle = app.switches[A11yIdentifiers.bugReportScreen.sendLogs]
XCTAssert(sendingLogsToggle.exists)
XCTAssertFalse(sendingLogsToggle.isOn)
XCTAssertTrue(sendingLogsToggle.waitForExistence(timeout: 1))
XCTAssertTrue(sendingLogsToggle.isOn)
sendingLogsToggle.tap()
XCTAssertFalse(sendingLogsToggle.isOn)
app.assertScreenshot(.bugReport, step: 1)
}

View File

@ -52,7 +52,6 @@ class ServerSelectionUITests: XCTestCase {
// Then an error should be shown and the confirmation button disabled.
app.assertScreenshot(.serverSelection, step: 2)
XCTAssertTrue(app.staticTexts[L10n.screenChangeServerErrorInvalidHomeserver].exists)
XCTAssertFalse(app.buttons[A11yIdentifiers.changeServerScreen.continue].isEnabled, "The confirm button should be disabled when there is an error.")
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More