From e8df280095606ffd55562bf141c9ca6fa7bc2f3b Mon Sep 17 00:00:00 2001 From: Tristan Labelle Date: Tue, 15 Aug 2023 09:57:10 -0400 Subject: [PATCH] Rename makePNGScreenshot to screenshot to follow the webdriver naming. --- Sources/Session+Requests.swift | 4 ++-- Tests/UnitTests/APIToRequestMappingTests.swift | 2 +- Tests/WebDriverTests/SessionTests.swift | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/Session+Requests.swift b/Sources/Session+Requests.swift index dc9dea5..145ec7d 100644 --- a/Sources/Session+Requests.swift +++ b/Sources/Session+Requests.swift @@ -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 diff --git a/Tests/UnitTests/APIToRequestMappingTests.swift b/Tests/UnitTests/APIToRequestMappingTests.swift index 7b0573e..f72fd2a 100644 --- a/Tests/UnitTests/APIToRequestMappingTests.swift +++ b/Tests/UnitTests/APIToRequestMappingTests.swift @@ -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) { diff --git a/Tests/WebDriverTests/SessionTests.swift b/Tests/WebDriverTests/SessionTests.swift index 977b01a..9e62a4c 100644 --- a/Tests/WebDriverTests/SessionTests.swift +++ b/Tests/WebDriverTests/SessionTests.swift @@ -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)) }