Skip to content

Commit

Permalink
Switch to firefox for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kapoorlakshya committed Jul 30, 2024
1 parent dfe917d commit 212d1ec
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"github-actions.workflows.pinned.workflows": []
}
18 changes: 9 additions & 9 deletions spec/screen-recorder/titles_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
end

context 'when the given application is a browser', if: ScreenRecorder::OS.windows? do
let(:browser_process) { :chrome }
let(:browser_process) { :firefox }
let(:url) { 'https://google.com' }
let(:expected_title) { /Google - Google Chrome for Testing/ }
let(:expected_title) { 'Google — Mozilla Firefox' }
let(:browser) do
Watir::Browser.new browser_process, options: { args: ['--disable-gpu'] }
end
Expand All @@ -27,7 +27,7 @@

it 'returns a list of available windows from firefox' do
browser.wait
expect(described_class.fetch('chrome')).to be_a(Array)
expect(described_class.fetch('firefox')).to be_a(Array)
end

it 'does not return an empty list' do
Expand All @@ -36,22 +36,22 @@
end

it 'returns window title from browser' do
expect(described_class.fetch(browser_process).first).to match(expected_title)
expect(described_class.fetch(browser_process).first).to eql(expected_title)
end
end

context 'when a browser window is not open', if: ScreenRecorder::OS.windows? do
it 'raises an exception' do
expect { described_class.fetch('chrome') }.to raise_exception(ScreenRecorder::Errors::ApplicationNotFound)
expect { described_class.fetch('firefox') }.to raise_exception(ScreenRecorder::Errors::ApplicationNotFound)
end
end

context 'when application is Chrome with extensions as individual processes', if: ScreenRecorder::OS.windows? do
let(:browser_process) { :chrome }
context 'when application is a browser with extensions as individual processes', if: ScreenRecorder::OS.windows? do
let(:browser_process) { :firefox }
let(:url) { 'https://google.com' }
let(:expected_titles) { ['Google - Google Chrome for Testing'] }
let(:expected_titles) { ['Google — Mozilla Firefox'] }
let(:browser) do
Watir::Browser.new browser_process, options: { args: ['--disable-gpu'] }
Watir::Browser.new browser_process
end

before do
Expand Down
7 changes: 3 additions & 4 deletions spec/screen-recorder/window_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@
expect { described_class.new(output: test_output) }.to raise_error(ArgumentError)
end

context 'when using Chrome' do
let!(:browser) { Watir::Browser.new :chrome, options: { args: ['--disable-gpu'] } }
context 'when using a browser' do
let!(:browser) { Watir::Browser.new :firefox }
let(:recorder) do
page_title = described_class.fetch_title('chrome').first
page_title = described_class.fetch_title('firefox').first
described_class.new(title: page_title, output: test_output)
end

before do
browser.goto 'google.com'
browser.wait
browser.window.maximize
end

after { browser.close }
Expand Down

0 comments on commit 212d1ec

Please sign in to comment.