Beam/UITests/Sources/CreateRoomScreenUITests.swift
Stefan Ceriu a1fdfd068a
Fix UI tests (#950)
* Fixed unstored weak reference warning

* Prevent the timeline from jumping whenever we access XCUIApplication properties

* Prevent UI tests from causing side effects on the timeline

* Update userSession reference screenshots

* Fix create room UI tests

* Update inviteUsers UI test reference screenshots

* Allow certain tests to enable timeline accessibility

* Fix roomLayout tests and update reference screenshots

* Disable the testTimelineLayoutInMiddle test because of flakiness

* Update screenshots following timestamp addition

* Another attempt

* Yet another attempt, replace XCUIScreen screenshots with XCUIApplication ones, decrease delay to 1 second

* Allow tests to retry up to 3 times before failing the run
2023-05-26 17:43:38 +03:00

51 lines
1.9 KiB
Swift

//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
class CreateRoomScreenUITests: XCTestCase {
func testLanding() async throws {
let app = Application.launch(.createRoom)
try await app.assertScreenshot(.createRoom)
}
func testLandingWithoutUsers() async throws {
let app = Application.launch(.createRoomNoUsers)
try await app.assertScreenshot(.createRoomNoUsers)
}
func testLongInputNameText() async throws {
let app = Application.launch(.createRoom)
// typeText sometimes misses letters but it's faster than typing one letter at a time
// repeat the same letter enough times to avoid that but also to work on iPads
app.textFields[A11yIdentifiers.createRoomScreen.roomName].tap()
app.textFields[A11yIdentifiers.createRoomScreen.roomName].typeText(.init(repeating: "x", count: 200))
try await app.assertScreenshot(.createRoom, step: 1)
}
// Disabled because tapping on the textView doesn't work
func disabled_testLongInputTopicText() async throws {
let app = Application.launch(.createRoom)
let textView = app.textViews[A11yIdentifiers.createRoomScreen.roomTopic]
textView.tap()
textView.typeText(.init(repeating: "Topic\n", count: 3))
try await app.assertScreenshot(.createRoom, step: 2)
}
}