Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rb/lib/selenium/webdriver/chromium/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class Driver < WebDriver::Driver
DriverExtensions::HasLogs,
DriverExtensions::HasLogEvents,
DriverExtensions::HasPinnedScripts,
DriverExtensions::FullPageScreenshot,
DriverExtensions::PrintsPage].freeze

protected
Expand Down
7 changes: 6 additions & 1 deletion rb/lib/selenium/webdriver/chromium/features.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ module Features
delete_network_conditions: [:delete, 'session/:session_id/chromium/network_conditions'],
set_permission: [:post, 'session/:session_id/permissions'],
get_available_log_types: [:get, 'session/:session_id/se/log/types'],
get_log: [:post, 'session/:session_id/se/log']
get_log: [:post, 'session/:session_id/se/log'],
full_page_screenshot: [:get, 'session/:session_id/screenshot/full']
}.freeze

def launch_app(id)
Expand Down Expand Up @@ -93,6 +94,10 @@ def log(type)
next
end
end

def full_screenshot
execute :full_page_screenshot
end
end # Bridge
end # Chromium
end # WebDriver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,18 @@ def save_screenshot_and_assert(source, path)

it 'takes full page screenshot', except: [{platform: :macosx,
reason: 'showing half resolution of what expected'}],
exclusive: {browser: :firefox} do
exclusive: {browser: %i[firefox chrome edge]} do
viewport_width = driver.execute_script('return window.innerWidth;')
viewport_height = driver.execute_script('return window.innerHeight;')

screenshot = driver.save_screenshot path, full_page: true
width, height = png_size(screenshot)

expect(width).to be >= viewport_width
expect(width).to be <= viewport_width
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change?

expect(height).to be > viewport_height
end

it 'does not take full page screenshot', only: {browser: %i[chrome edge safari safari_preview],
it 'does not take full page screenshot', only: {browser: %i[safari safari_preview],
reason: 'these browsers do not implement this feature'} do
expect {
driver.save_screenshot path, full_page: true
Expand Down
Loading