Skip to content

Commit

Permalink
Add Session.sendKeys and a unit test. (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdav authored Jul 24, 2023
1 parent 739332a commit c32b021
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Sources/Session+Requests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,11 @@ extension Session {
}
}

public func sendKeys(value: [String]) {
let keysRequest = KeysRequest(self, value: value)
try! webDriver.send(keysRequest)
}

struct KeysRequest: WebDriverRequest {
typealias ResponseValue = CodableNone

Expand Down
3 changes: 3 additions & 0 deletions Tests/UnitTests/APIToRequestMappingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ class APIToRequestMappingTests: XCTestCase {
}
element.sendKeys(value: ["a", "b", "c"])

mockWebDriver.expect(path: "session/mySession/keys", method: .post)
session.sendKeys(value: ["d", "e", "f"])

// Account for session deinitializer
mockWebDriver.expect(path: "session/mySession", method: .delete)
}
Expand Down

0 comments on commit c32b021

Please sign in to comment.