[BrowserTest] Fix ve.init is undefined and ve.init.target is undefined error messages

Looks like local browsers raise
Selenium::WebDriver::Error::JavascriptError while remote (Sauce Labs)
browsers raise Selenium::WebDriver::Error::UnknownError if a test tries
to use an element but VisualEditor is not loaded.

Bug: T126966
Change-Id: I89c8eaba996e95e7859084fe26e15befee9dce77
This commit is contained in:
Željko Filipin 2016-03-02 13:31:23 +01:00
parent 078886b5a4
commit 301b152ec8

View file

@ -205,11 +205,11 @@ class VisualEditorPage
loop do
begin
browser.execute_script script
rescue Selenium::WebDriver::Error::JavascriptError => e
rescue Selenium::WebDriver::Error::JavascriptError, Selenium::WebDriver::Error::UnknownError => e
else
e = nil
end
break unless e.class == Selenium::WebDriver::Error::JavascriptError
break unless (e.class == Selenium::WebDriver::Error::JavascriptError) || (e.class == Selenium::WebDriver::Error::UnknownError)
end
end
browser.execute_script script