Skip to content

Commit

Permalink
Rename makePNGScreenshot to screenshot to follow the webdriver naming.
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlabelle committed Aug 16, 2023
1 parent 27ed8d8 commit e8df280
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Sources/Session+Requests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ extension Session {

/// screenshot()
/// Take a screenshot of the current page.
/// - Returns: The screenshot Data.
/// - Returns: The screenshot data as a PNG file.
/// https://www.selenium.dev/documentation/legacy/json_wire_protocol/#sessionsessionidscreenshot
public func makePNGScreenshot() throws -> Data {
public func screenshot() throws -> Data {
let screenshotRequest = ScreenshotRequest(self)

let base64: String = try webDriver.send(screenshotRequest).value
Expand Down
2 changes: 1 addition & 1 deletion Tests/UnitTests/APIToRequestMappingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class APIToRequestMappingTests: XCTestCase {
XCTAssertEqual(try session.title, "mySession.title")

mockWebDriver.expect(path: "session/mySession/screenshot", method: .get) { WebDriverResponse(value: base64TestImage) }
let data: Data = try session.makePNGScreenshot()
let data: Data = try session.screenshot()
XCTAssert(isPNG(data: data))

mockWebDriver.expect(path: "session/mySession/element", method: .post, type: Session.ElementRequest.self) {
Expand Down
2 changes: 1 addition & 1 deletion Tests/WebDriverTests/SessionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class SessionTests: XCTestCase {
}

public func testScreenshot() throws {
let data: Data = try Self.session.makePNGScreenshot()
let data: Data = try Self.session.screenshot()
XCTAssert(isPNG(data: data))
}

Expand Down

0 comments on commit e8df280

Please sign in to comment.