Room screen header (#86)

* #35 Create `ElementNavigationController` subclass

* #35 Add encryption icons

* #35 Add avatar and encryption badge image to the room screen view model

* #35 Create `RoomHeaderView` class

* #35 Replace room title with a RoomHeaderView instance in the toolbar

* #35 Add changelog

* #35 Introduce `UITestScreenIdentifier` and refactor ui tests

* #35 Fix old tests

* #35 add some tests for room screen

* #35 Use svgs instead of pngs

* #35 Fix PR remarks
This commit is contained in:
ismailgulek
2022-06-21 20:28:42 +03:00
committed by GitHub
parent ffd3ffa369
commit 7dcd494de8
32 changed files with 347 additions and 51 deletions
+2 -2
View File
@@ -18,8 +18,8 @@ struct Application {
}
extension XCUIApplication {
func goToScreenWithIdentifier(_ identifier: String) {
let button = self.buttons[identifier]
func goToScreenWithIdentifier(_ identifier: UITestScreenIdentifier) {
let button = self.buttons[identifier.rawValue]
let lastLabel = staticTexts["lastItem"]
while !button.isHittable && !lastLabel.isHittable {
+4 -4
View File
@@ -21,7 +21,7 @@ class BugReportUITests: XCTestCase {
func testInitialStateComponents() {
let app = Application.launch()
app.goToScreenWithIdentifier("Bug report screen")
app.goToScreenWithIdentifier(.bugReport)
XCTAssert(app.navigationBars["Bug report"].exists)
XCTAssert(app.staticTexts["reportBugDescription"].exists)
@@ -40,7 +40,7 @@ class BugReportUITests: XCTestCase {
func testToggleSendingLogs() {
let app = Application.launch()
app.goToScreenWithIdentifier("Bug report screen")
app.goToScreenWithIdentifier(.bugReport)
app.switches["sendLogsToggle"].tap()
@@ -51,7 +51,7 @@ class BugReportUITests: XCTestCase {
func testReportText() {
let app = Application.launch()
app.goToScreenWithIdentifier("Bug report screen")
app.goToScreenWithIdentifier(.bugReport)
// type 4 chars
app.textViews["reportTextView"].tap()
@@ -66,7 +66,7 @@ class BugReportUITests: XCTestCase {
func testInitialStateComponentsWithScreenshot() {
let app = Application.launch()
app.goToScreenWithIdentifier("Bug report screen with screenshot")
app.goToScreenWithIdentifier(.bugReportWithScreenshot)
XCTAssert(app.navigationBars["Bug report"].exists)
XCTAssert(app.staticTexts["reportBugDescription"].exists)
+1 -1
View File
@@ -19,7 +19,7 @@ import XCTest
class LoginScreenUITests: XCTestCase {
func testInitialStateComponents() {
let app = Application.launch()
app.goToScreenWithIdentifier("Login screen")
app.goToScreenWithIdentifier(.login)
XCTAssert(app.buttons["Login"].exists)
XCTAssert(app.textFields["Username"].exists)
+27
View File
@@ -15,3 +15,30 @@
//
import XCTest
import ElementX
@MainActor
class RoomScreenUITests: XCTestCase {
func testPlainNoAvatar() async throws {
let app = Application.launch()
app.goToScreenWithIdentifier(.roomPlainNoAvatar)
try await Task.sleep(nanoseconds: 400_000_000)
XCTAssert(app.staticTexts["roomNameLabel"].exists)
XCTAssert(app.staticTexts["roomAvatarPlaceholderImage"].exists)
XCTAssertFalse(app.images["encryptionBadgeIcon"].exists)
}
func testEncryptedWithAvatar() async throws {
let app = Application.launch()
app.goToScreenWithIdentifier(.roomEncryptedWithAvatar)
try await Task.sleep(nanoseconds: 400_000_000)
XCTAssert(app.staticTexts["roomNameLabel"].exists)
XCTAssert(app.images["roomAvatarImage"].exists)
XCTAssert(app.images["encryptionBadgeIcon"].exists)
}
}
+1 -1
View File
@@ -21,7 +21,7 @@ class SettingsUITests: XCTestCase {
func testInitialStateComponents() {
let app = Application.launch()
app.goToScreenWithIdentifier("Settings screen")
app.goToScreenWithIdentifier(.settings)
XCTAssert(app.navigationBars["Settings"].exists)
XCTAssert(app.buttons["reportBugButton"].exists)
+2 -2
View File
@@ -20,7 +20,7 @@ import XCTest
class SplashScreenUITests: XCTestCase {
func testInitialStateComponents() {
let app = Application.launch()
app.goToScreenWithIdentifier("Splash Screen")
app.goToScreenWithIdentifier(.splash)
let getStartedButton = app.buttons["Get started"]
XCTAssertTrue(getStartedButton.exists, "The primary action button should be shown.")
@@ -28,7 +28,7 @@ class SplashScreenUITests: XCTestCase {
func testSwipingBetweenPages() async throws {
let app = Application.launch()
app.goToScreenWithIdentifier("Splash Screen")
app.goToScreenWithIdentifier(.splash)
// Given the splash screen in its initial state.
let page1TitleText = app.staticTexts["Own your conversations."]