Skip to content

Commit 8c1a58c

Browse files
committed
Fix tests for firefox browser contexts
1 parent c4e9662 commit 8c1a58c

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

rb/spec/integration/selenium/webdriver/bidi/browser_spec.rb

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,21 @@ class BiDi
3636
it 'gets user contexts' do
3737
reset_driver!(web_socket_url: true) do |driver|
3838
browser = described_class.new(driver.bidi)
39-
2.times { browser.create_user_context }
40-
expect(browser.user_contexts['userContexts'].count).to eq 3
39+
created_context_id = browser.create_user_context['userContext']
40+
all_context_ids = browser.user_contexts['userContexts'].map { |c| c['userContext'] }
41+
42+
expect(all_context_ids).to include(created_context_id)
4143
end
4244
end
4345

4446
it 'removes an user context' do
4547
reset_driver!(web_socket_url: true) do |driver|
4648
browser = described_class.new(driver.bidi)
47-
user_context = browser.create_user_context
48-
expect(browser.user_contexts['userContexts'].count).to eq 2
49-
browser.remove_user_context(user_context['userContext'])
50-
expect(browser.user_contexts['userContexts'].count).to eq 1
49+
context_id_to_remove = browser.create_user_context['userContext']
50+
browser.remove_user_context(context_id_to_remove)
51+
all_ids_after_removal = browser.user_contexts['userContexts'].map { |c| c['userContext'] }
52+
53+
expect(all_ids_after_removal).not_to include(context_id_to_remove)
5154
end
5255
end
5356

@@ -65,7 +68,7 @@ class BiDi
6568
browser = described_class.new(driver.bidi)
6669
expect {
6770
browser.remove_user_context('fake_context')
68-
}.to raise_error(Error::WebDriverError, /Failed to find context with id/)
71+
}.to raise_error(Error::WebDriverError)
6972
end
7073
end
7174
end

0 commit comments

Comments
 (0)