mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
664e87fe87
* Switch license file to AGPL * Update file copyright headers * Update the default project file header
32 lines
828 B
Swift
32 lines
828 B
Swift
//
|
|
// Copyright 2022-2024 New Vector Ltd.
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
// Please see LICENSE in the repository root for full details.
|
|
//
|
|
|
|
import XCTest
|
|
|
|
extension XCUIElement {
|
|
func clearAndTypeText(_ text: String) {
|
|
forceTap()
|
|
|
|
guard let currentValue = value as? String else {
|
|
XCTFail("Tried to clear and type text into a non string value")
|
|
return
|
|
}
|
|
|
|
let deleteString = String(repeating: XCUIKeyboardKey.delete.rawValue, count: currentValue.count)
|
|
typeText(deleteString)
|
|
|
|
for character in text {
|
|
typeText(String(character))
|
|
}
|
|
}
|
|
|
|
func forceTap() {
|
|
let coordinate: XCUICoordinate = coordinate(withNormalizedOffset: .init(dx: 0.5, dy: 0.5))
|
|
coordinate.tap()
|
|
}
|
|
}
|