File tree Expand file tree Collapse file tree 1 file changed +30
-5
lines changed
rb/spec/integration/selenium/webdriver Expand file tree Collapse file tree 1 file changed +30
-5
lines changed Original file line number Diff line number Diff line change 2222module Selenium
2323 module WebDriver
2424 describe BiDi , exclusive : { browser : %i[ chrome firefox ] } do
25+ before do
26+ quit_driver
27+ create_driver! ( web_socket_url : true )
28+ end
29+
2530 it 'gets session status' do
26- reset_driver! ( web_socket_url : true ) do |driver |
27- status = driver . bidi . session . status
28- expect ( status ) . to respond_to ( :ready )
29- expect ( status . message ) . not_to be_empty
30- end
31+ status = driver . bidi . session . status
32+ expect ( status ) . to respond_to ( :ready )
33+ expect ( status . message ) . not_to be_empty
34+ end
35+
36+ it 'can navigate and listen to errors' do
37+ log_entry = nil
38+ log_inspector = BiDi ::LogInspector . new ( driver )
39+ log_inspector . on_javascript_exception { |log | log_entry = log }
40+
41+ browsing_context = BiDi ::BrowsingContext . new ( driver : driver , browsing_context_id : driver . window_handle )
42+ info = browsing_context . navigate ( url : url_for ( '/bidi/logEntryAdded.html' ) )
43+
44+ expect ( browsing_context . id ) . not_to be_nil
45+ expect ( info . navigation_id ) . to be_nil
46+ expect ( info . url ) . to include ( '/bidi/logEntryAdded.html' )
47+
48+ driver . find_element ( id : 'jsException' ) . click
49+ wait . until { !log_entry . nil? }
50+
51+ expect ( log_entry ) . to have_attributes (
52+ text : "Error: Not working" ,
53+ type : "javascript" ,
54+ level : BiDi ::LogInspector ::LOG_LEVEL [ :ERROR ]
55+ )
3156 end
3257 end
3358 end
You can’t perform that action at this time.
0 commit comments