Skip to content

Commit

Permalink
Fix screenshot specs
Browse files Browse the repository at this point in the history
  • Loading branch information
kapoorlakshya committed Jul 21, 2024
1 parent 0296237 commit ff1cc3a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
5 changes: 2 additions & 3 deletions lib/screen-recorder/screenshot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ def screenshot_cmd(filename:, resolution: nil)
# Returns OS specific video resolution arg for ffmpeg
#
def resolution_arg(size)
# macOS likes -s, windows and linux like -video_size
OS.mac? ? "-s #{size} " : "-video_size #{size} "
"-s #{size} "
end
end
end
end
20 changes: 0 additions & 20 deletions spec/screen-recorder/screenshot_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,5 @@
expect(res).to eql(given_resolution)
end
end

context 'when recording a window', if: ScreenRecorder::OS.windows? do
let!(:browser) { Watir::Browser.new :chrome, options: { args: ['--disable-gpu'] } }
let(:recorder) do
page_title = ScreenRecorder::Window.fetch_title('chrome').first
ScreenRecorder::Window.new(title: page_title, output: test_output)
end
let(:image_file) { 'screenshot.png' }

before { browser.goto 'watir.com' }

after { browser.close }

it 'can take a screenshot' do
recorder.start
recorder.screenshot(image_file)
recorder.stop
expect(File).to exist(image_file)
end
end
end
end

0 comments on commit ff1cc3a

Please sign in to comment.