@@ -3,6 +3,11 @@ import TestsCommon
3
3
import XCTest
4
4
5
5
class SessionTests : XCTestCase {
6
+ enum AccessibilityIds {
7
+ static let findWhatEditBox = " 204 "
8
+ static let searchSelectedCategoryOnlyCheckbox = " 206 "
9
+ }
10
+
6
11
static var session : Session !
7
12
static var setupError : Error ?
8
13
@@ -45,18 +50,18 @@ class SessionTests: XCTestCase {
45
50
try element. click ( )
46
51
}
47
52
48
- public func testKeysAndAttributes( ) throws {
49
- continueAfterFailure = false
53
+ public func testAttributes( ) throws {
54
+ let element = try XCTUnwrap ( Self . session. findElement ( byAccessibilityId: AccessibilityIds . searchSelectedCategoryOnlyCheckbox) )
55
+ try XCTAssertEqual ( element. getAttribute ( name: " HasKeyboardFocus " ) . lowercased ( ) , " false " )
50
56
51
- let findWhatEditBoxAutomationId = " 204 "
52
- let element = try XCTUnwrap ( Self . session. findElement ( byAccessibilityId: findWhatEditBoxAutomationId) )
53
57
try element. click ( )
58
+ try XCTAssertEqual ( element. getAttribute ( name: " HasKeyboardFocus " ) . lowercased ( ) , " true " )
59
+ }
54
60
55
- try XCTAssertEqual ( element. getAttribute ( name: " HasKeyboardFocus " ) . lowercased ( ) , " true " , " Element does not have keyboard focus " )
56
- try Self . session. sendKeys ( value: [ " B " , " I " , " O " , " S " , KeyCode . returnKey. rawValue] )
57
-
58
- // It takes some time for focus to move.
59
- Thread . sleep ( forTimeInterval: 1 )
60
- try XCTAssertEqual ( element. getAttribute ( name: " HasKeyboardFocus " ) . lowercased ( ) , " false " , " Element still has keyboard focus " )
61
+ public func testKeys( ) throws {
62
+ let element = try XCTUnwrap ( Self . session. findElement ( byAccessibilityId: AccessibilityIds . findWhatEditBox) )
63
+ try element. click ( )
64
+ try Self . session. sendKeys ( value: [ " B " , " I " , " O " , " S " ] )
65
+ XCTAssertEqual ( try element. text, " BIOS " )
61
66
}
62
67
}
0 commit comments