mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 08:15:24 +00:00
Run SwiftFormat.
This commit is contained in:
@@ -102,11 +102,11 @@ extension XCUIApplication {
|
||||
}
|
||||
return languageCode + "-" + regionCode
|
||||
}
|
||||
|
||||
|
||||
private var languageCode: String {
|
||||
Locale.current.language.languageCode?.identifier ?? ""
|
||||
}
|
||||
|
||||
|
||||
private var regionCode: String {
|
||||
Locale.current.language.region?.identifier ?? ""
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class AuthenticationFlowCoordinatorUITests: XCTestCase {
|
||||
// Login Screen: Enter valid credentials
|
||||
app.textFields[A11yIdentifiers.loginScreen.emailUsername].clearAndTypeText("alice\n", app: app)
|
||||
app.secureTextFields[A11yIdentifiers.loginScreen.password].clearAndTypeText("12345678", app: app)
|
||||
|
||||
|
||||
try await app.assertScreenshot()
|
||||
|
||||
// Login Screen: Tap next
|
||||
@@ -72,7 +72,7 @@ class AuthenticationFlowCoordinatorUITests: XCTestCase {
|
||||
// Login Screen: Enter invalid credentials
|
||||
app.textFields[A11yIdentifiers.loginScreen.emailUsername].clearAndTypeText("alice", app: app)
|
||||
app.secureTextFields[A11yIdentifiers.loginScreen.password].clearAndTypeText("87654321", app: app)
|
||||
|
||||
|
||||
// Login Screen: Tap continue
|
||||
XCTAssertTrue(continueButton.isEnabled)
|
||||
continueButton.tap()
|
||||
|
||||
@@ -14,35 +14,35 @@ class PollFormScreenUITests: XCTestCase {
|
||||
let app = Application.launch(.createPoll)
|
||||
try await app.assertScreenshot()
|
||||
}
|
||||
|
||||
|
||||
func testFilledPoll() async throws {
|
||||
let app = Application.launch(.createPoll)
|
||||
let questionTextField = app.textFields[A11yIdentifiers.pollFormScreen.question]
|
||||
questionTextField.tap(.center)
|
||||
questionTextField.typeText("Do you like polls?")
|
||||
|
||||
|
||||
let option1TextField = app.textFields[A11yIdentifiers.pollFormScreen.optionID(0)]
|
||||
option1TextField.tap(.center)
|
||||
option1TextField.typeText("Yes")
|
||||
|
||||
|
||||
let option2TextField = app.textFields[A11yIdentifiers.pollFormScreen.optionID(1)]
|
||||
option2TextField.tap(.center)
|
||||
option2TextField.typeText("No")
|
||||
|
||||
// Dismiss the keyboard
|
||||
app.swipeDown()
|
||||
|
||||
|
||||
let createButton = app.buttons[A11yIdentifiers.pollFormScreen.submit]
|
||||
XCTAssertTrue(createButton.isEnabled)
|
||||
|
||||
|
||||
try await app.assertScreenshot()
|
||||
}
|
||||
|
||||
|
||||
func testMaxOptions() async throws {
|
||||
let app = Application.launch(.createPoll)
|
||||
let createButton = app.buttons[A11yIdentifiers.pollFormScreen.submit]
|
||||
let addOption = app.buttons[A11yIdentifiers.pollFormScreen.addOption]
|
||||
|
||||
|
||||
for _ in 1...8 {
|
||||
// Use the frame as a fallback to fix the button being obscured by the home indicator.
|
||||
if !addOption.isHittable || addOption.frame.maxY > (app.frame.maxY - 20) {
|
||||
@@ -57,7 +57,7 @@ class PollFormScreenUITests: XCTestCase {
|
||||
|
||||
XCTAssertFalse(addOption.exists)
|
||||
XCTAssertFalse(createButton.isEnabled)
|
||||
|
||||
|
||||
try await app.assertScreenshot()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@ import XCTest
|
||||
class RoomScreenUITests: XCTestCase {
|
||||
func testPlainNoAvatar() async throws {
|
||||
let app = Application.launch(.roomPlainNoAvatar)
|
||||
|
||||
|
||||
XCTAssert(app.buttons[A11yIdentifiers.roomScreen.name].exists)
|
||||
XCTAssert(app.buttons[A11yIdentifiers.roomScreen.avatar].exists)
|
||||
|
||||
|
||||
try await app.assertScreenshot()
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class RoomScreenUITests: XCTestCase {
|
||||
// When a back pagination occurs and an incoming message arrives.
|
||||
try await performOperation(.incomingMessage, using: client)
|
||||
try await performOperation(.paginate, using: client)
|
||||
|
||||
|
||||
// Then the 4 visible messages should stay aligned to the bottom.
|
||||
try await app.assertScreenshot()
|
||||
}
|
||||
@@ -52,7 +52,7 @@ class RoomScreenUITests: XCTestCase {
|
||||
|
||||
// When a large back pagination occurs.
|
||||
try await performOperation(.paginate, using: client)
|
||||
|
||||
|
||||
// The bottom of the timeline should remain visible with more items added above.
|
||||
try await app.assertScreenshot()
|
||||
}
|
||||
@@ -73,11 +73,11 @@ class RoomScreenUITests: XCTestCase {
|
||||
|
||||
// When a back pagination occurs.
|
||||
try await performOperation(.paginate, using: client)
|
||||
|
||||
|
||||
// Then the bottom of the timeline should remain unchanged (with new items having been added above).
|
||||
try await app.assertScreenshot()
|
||||
}
|
||||
|
||||
|
||||
func testTimelineLayoutAtBottom() async throws {
|
||||
let client = try UITestsSignalling.Client(mode: .tests)
|
||||
|
||||
@@ -126,32 +126,32 @@ class RoomScreenUITests: XCTestCase {
|
||||
// Then the item should also be highlighted and scrolled to in the same state as before.
|
||||
try await app.assertScreenshot()
|
||||
}
|
||||
|
||||
|
||||
func testTimelineReadReceipts() async throws {
|
||||
let app = Application.launch(.roomSmallTimelineWithReadReceipts)
|
||||
|
||||
|
||||
// The messages should be bottom aligned.
|
||||
try await app.assertScreenshot()
|
||||
}
|
||||
|
||||
|
||||
func testTimelineDisclosedPolls() async throws {
|
||||
let app = Application.launch(.roomWithDisclosedPolls)
|
||||
|
||||
|
||||
try await app.assertScreenshot()
|
||||
}
|
||||
|
||||
|
||||
func testTimelineUndisclosedPolls() async throws {
|
||||
let app = Application.launch(.roomWithUndisclosedPolls)
|
||||
|
||||
|
||||
try await app.assertScreenshot()
|
||||
}
|
||||
|
||||
|
||||
func testTimelineOutgoingPolls() async throws {
|
||||
let app = Application.launch(.roomWithOutgoingPolls)
|
||||
|
||||
|
||||
try await app.assertScreenshot()
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Helper Methods
|
||||
|
||||
private func performOperation(_ operation: UITestsSignal.Timeline, using client: UITestsSignalling.Client) async throws {
|
||||
|
||||
@@ -17,7 +17,7 @@ class ServerSelectionUITests: XCTestCase {
|
||||
// Then it should be configured for matrix.org
|
||||
try await app.assertScreenshot()
|
||||
}
|
||||
|
||||
|
||||
func testEmptyAddress() async throws {
|
||||
// Given the initial server selection screen as a modal.
|
||||
let app = Application.launch(.serverSelection)
|
||||
@@ -29,7 +29,7 @@ class ServerSelectionUITests: XCTestCase {
|
||||
// Then the screen should not allow the user to continue.
|
||||
try await app.assertScreenshot()
|
||||
}
|
||||
|
||||
|
||||
func testInvalidAddress() async throws {
|
||||
// Given the initial server selection screen as a modal.
|
||||
let app = Application.launch(.serverSelection)
|
||||
|
||||
@@ -39,7 +39,7 @@ class UserSessionScreenTests: XCTestCase {
|
||||
app.swipeDown() // Make sure the header shows a large title
|
||||
|
||||
try await app.assertScreenshot(step: Step.homeScreen)
|
||||
|
||||
|
||||
app.buttons[A11yIdentifiers.homeScreen.roomName(firstRoomName)].tap()
|
||||
XCTAssert(app.buttons[firstRoomName].waitForExistence(timeout: 5.0))
|
||||
try await Task.sleep(for: .seconds(1))
|
||||
@@ -53,7 +53,7 @@ class UserSessionScreenTests: XCTestCase {
|
||||
|
||||
let latestMessage = app.textViews.matching(NSPredicate(format: "value CONTAINS 'sugar honey ice'")).firstMatch
|
||||
XCTAssert(latestMessage.waitForExistence(timeout: 5.0))
|
||||
|
||||
|
||||
// Tapping on the mesage text view or the cell doesn't work.
|
||||
// Use the sender static text instead.
|
||||
let latestEventSender = app.staticTexts["@test.matrix.org"]
|
||||
@@ -72,29 +72,29 @@ class UserSessionScreenTests: XCTestCase {
|
||||
|
||||
let latestEditedMessage = app.textViews.matching(NSPredicate(format: "value CONTAINS 'sugar honey ice & tea'")).firstMatch
|
||||
XCTAssert(latestEditedMessage.waitForExistence(timeout: 5.0))
|
||||
|
||||
|
||||
app.buttons[A11yIdentifiers.roomScreen.composerToolbar.openComposeOptions].tap(.center)
|
||||
try await app.assertScreenshot(step: Step.composerAttachments)
|
||||
}
|
||||
|
||||
|
||||
func testUserSessionReply() async throws {
|
||||
let app = Application.launch(.userSessionScreenReply, disableTimelineAccessibility: false)
|
||||
app.buttons[A11yIdentifiers.homeScreen.roomName(firstRoomName)].tap()
|
||||
XCTAssert(app.buttons[firstRoomName].waitForExistence(timeout: 5.0))
|
||||
try await Task.sleep(for: .seconds(1))
|
||||
|
||||
|
||||
let cell = app.cells.element(boundBy: 1) // Skip the typing indicator cell
|
||||
cell.swipeRight(velocity: .slow) // The iOS 26 simulator doesn't like a fast swipe.
|
||||
|
||||
|
||||
try await app.assertScreenshot()
|
||||
}
|
||||
|
||||
|
||||
func testElementCall() {
|
||||
let app = Application.launch(.userSessionScreen)
|
||||
|
||||
|
||||
app.buttons[A11yIdentifiers.homeScreen.roomName(firstRoomName)].tap()
|
||||
XCTAssert(app.buttons[firstRoomName].waitForExistence(timeout: 5.0))
|
||||
|
||||
|
||||
app.buttons[A11yIdentifiers.roomScreen.joinCall].tap()
|
||||
|
||||
let textField = app.textFields["Display name"]
|
||||
@@ -106,7 +106,7 @@ class UserSessionScreenTests: XCTestCase {
|
||||
|
||||
func testRoomDetails() {
|
||||
let app = Application.launch(.userSessionScreen)
|
||||
|
||||
|
||||
app.buttons[A11yIdentifiers.homeScreen.roomName(firstRoomName)].tap()
|
||||
XCTAssert(app.buttons[firstRoomName].waitForExistence(timeout: 5.0))
|
||||
|
||||
@@ -124,7 +124,7 @@ class UserSessionScreenTests: XCTestCase {
|
||||
attempts += 1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Open the room members list.
|
||||
app.buttons[A11yIdentifiers.roomDetailsScreen.people].tap()
|
||||
|
||||
@@ -150,7 +150,7 @@ class UserSessionScreenTests: XCTestCase {
|
||||
|
||||
func testPhotoSharing() {
|
||||
let app = Application.launch(.userSessionScreen)
|
||||
|
||||
|
||||
app.buttons[A11yIdentifiers.homeScreen.roomName(firstRoomName)].tap()
|
||||
XCTAssert(app.buttons[firstRoomName].waitForExistence(timeout: 5.0))
|
||||
|
||||
@@ -165,7 +165,7 @@ class UserSessionScreenTests: XCTestCase {
|
||||
|
||||
func testDocumentSharing() {
|
||||
let app = Application.launch(.userSessionScreen)
|
||||
|
||||
|
||||
app.buttons[A11yIdentifiers.homeScreen.roomName(firstRoomName)].tap()
|
||||
XCTAssert(app.buttons[firstRoomName].waitForExistence(timeout: 5.0))
|
||||
|
||||
@@ -175,7 +175,7 @@ class UserSessionScreenTests: XCTestCase {
|
||||
|
||||
func testLocationSharing() {
|
||||
let app = Application.launch(.userSessionScreen)
|
||||
|
||||
|
||||
app.buttons[A11yIdentifiers.homeScreen.roomName(firstRoomName)].tap()
|
||||
XCTAssert(app.buttons[firstRoomName].waitForExistence(timeout: 5.0))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user