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.
pull/741/head
Doug 2 months ago committed by GitHub
parent e1df5310b7
commit d7622ea731
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

4
.gitignore vendored

@ -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

@ -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).

@ -128,24 +128,17 @@ struct RoomDetailsScreen: View {
private var securitySection: some View {
Section {
HStack(alignment: .top) {
Label {
VStack(alignment: .leading, spacing: 2) {
Text(L10n.screenRoomDetailsEncryptionEnabledTitle)
Text(L10n.screenRoomDetailsEncryptionEnabledSubtitle)
.foregroundColor(.element.secondaryContent)
.font(.element.footnote)
}
} icon: {
Image(systemName: "lock.shield")
Label {
VStack(alignment: .leading, spacing: 2) {
Text(L10n.screenRoomDetailsEncryptionEnabledTitle)
Text(L10n.screenRoomDetailsEncryptionEnabledSubtitle)
.foregroundColor(.element.secondaryContent)
.font(.element.footnote)
}
.labelStyle(FormRowLabelStyle(alignment: .top))
Spacer()
Image(systemName: "checkmark")
.foregroundColor(.element.quaternaryContent)
} icon: {
Image(systemName: "lock.shield")
}
.labelStyle(FormRowLabelStyle(alignment: .top))
} header: {
Text(L10n.commonSecurity)
.formSectionHeader()

@ -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 {

@ -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 {
return Asset.Images.appLogo.image
}
if source?.url == .picturesDirectory {
return Asset.Images.appLogo.image
}
return UIImage(systemName: "photo")
}

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

@ -62,7 +62,7 @@ extension XCUIApplication {
}
private var testName: String {
languageCode + "-" + regionCode + "-" + deviceName
localeCode + "-" + deviceName
}
private var deviceName: String {
@ -76,6 +76,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 {

@ -24,33 +24,36 @@ class BugReportUITests: XCTestCase {
// Initial state without a screenshot attached.
app.assertScreenshot(.bugReport, step: 0)
}
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)
XCTAssertTrue(sendingLogsToggle.waitForExistence(timeout: 1))
XCTAssertTrue(sendingLogsToggle.isOn)
sendingLogsToggle.tap()
XCTAssertFalse(sendingLogsToggle.isOn)
app.assertScreenshot(.bugReport, step: 1)
}
func testReportText() {
let app = Application.launch(.bugReport)
// Type 4 characters and the send button should be disabled.
app.textViews[A11yIdentifiers.bugReportScreen.report].clearAndTypeText("Text")
XCTAssert(app.switches[A11yIdentifiers.bugReportScreen.sendLogs].isOn)
app.assertScreenshot(.bugReport, step: 2)
// Type more than 4 characters and send the button should become enabled.
app.textViews[A11yIdentifiers.bugReportScreen.report].clearAndTypeText("Longer text")
XCTAssert(app.switches[A11yIdentifiers.bugReportScreen.sendLogs].isOn)
app.assertScreenshot(.bugReport, step: 3)
}
func testInitialStateComponentsWithScreenshot() {
let app = Application.launch(.bugReportWithScreenshot)

@ -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.

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

Loading…
Cancel
Save