Module: SeleniumWrapperJsErrors
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/onlyoffice_documentserver_testing_framework/selenium_wrapper/selenium_wrapper_js_errors.rb
Overview
Module for working with selenium wrapper JavaScript Errors
Instance Method Summary collapse
-
#console_errors ⇒ Array<String>
(also: #get_console_errors)
List of current console errors.
-
#error_ignored?(error_message) ⇒ True, False
Should current error be ignored.
-
#fail_if_console_error ⇒ Object
Fail if any JS error happened.
-
#ignored_errors ⇒ Array<String>
List of errors should be ignored.
Instance Method Details
#console_errors ⇒ Array<String> Also known as: get_console_errors
Returns list of current console errors.
26 27 28 29 30 31 32 |
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper/selenium_wrapper_js_errors.rb', line 26 def console_errors severe_error = [] @instance.webdriver.browser_logs.each do |log| severe_error << log. if log.level.include?('SEVERE') && !error_ignored?(log.) end severe_error end |
#error_ignored?(error_message) ⇒ True, False
Should current error be ignored
18 19 20 21 22 23 |
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper/selenium_wrapper_js_errors.rb', line 18 def error_ignored?() return true if ignored_errors.any? { |word| .include?(word) } return true if @instance.['IgnoredJSErrors'].any? { |word| .include?(word) } false end |
#fail_if_console_error ⇒ Object
Fail if any JS error happened
39 40 41 42 43 44 45 |
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper/selenium_wrapper_js_errors.rb', line 39 def fail_if_console_error errors = console_errors return if errors.empty? @instance.webdriver.webdriver_error(Selenium::WebDriver::Error::JavascriptError, "There are some errors in the Web Console: #{errors}") end |
#ignored_errors ⇒ Array<String>
Returns list of errors should be ignored.
6 7 8 9 10 11 12 13 |
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper/selenium_wrapper_js_errors.rb', line 6 def ignored_errors return @ignored_errors if @ignored_errors @ignored_errors = File.readlines("#{File.('..', __dir__)}" \ '/selenium_wrapper/selenium_wrapper_js_errors' \ '/ignored_errors.list') .map(&:strip) end |