Page MenuHomePhabricator

Get JQuery error "a is undefined" running browser tests locally for Firefox
Closed, ResolvedPublic

Description

Attempting to run any browser tests locally fails for both VisualEditor and Echo (at least). Error reported is "a is undefined". This seems to be a jquery issue. Googling for it suggests that it could affect actual users and not only automated tests. Full stack trace is:

a is undefined (Selenium::WebDriver::Error::JavascriptError)

[remote server] http://en.wikipedia.beta.wmflabs.org/wiki/Bullets_VisualEditor_Test?vehidebetadialog=true&veaction=edit line 68 > Function:26:in `F'
[remote server] http://en.wikipedia.beta.wmflabs.org/wiki/Bullets_VisualEditor_Test?vehidebetadialog=true&veaction=edit line 68 > Function:39:in `Eb'
[remote server] http://en.wikipedia.beta.wmflabs.org/wiki/Bullets_VisualEditor_Test?vehidebetadialog=true&veaction=edit line 68 > Function:50:in `T'
[remote server] http://en.wikipedia.beta.wmflabs.org/wiki/Bullets_VisualEditor_Test?vehidebetadialog=true&veaction=edit line 68 > Function:60:in `Db'
[remote server] http://en.wikipedia.beta.wmflabs.org/wiki/Bullets_VisualEditor_Test?vehidebetadialog=true&veaction=edit line 68 > Function:61:in `dc'
[remote server] http://en.wikipedia.beta.wmflabs.org/wiki/Bullets_VisualEditor_Test?vehidebetadialog=true&veaction=edit line 68 > Function:61:in `anonymous/</<'
[remote server] http://en.wikipedia.beta.wmflabs.org/wiki/Bullets_VisualEditor_Test?vehidebetadialog=true&veaction=edit line 68 > Function:14:in `anonymous/<'
[remote server] http://en.wikipedia.beta.wmflabs.org/wiki/Bullets_VisualEditor_Test?vehidebetadialog=true&veaction=edit line 68 > Function:14:in `anonymous'
[remote server] http://en.wikipedia.beta.wmflabs.org/wiki/Bullets_VisualEditor_Test?vehidebetadialog=true&veaction=edit:68:in `handleEvaluateEvent'

Details

Related Gerrit Patches:
mediawiki/extensions/VisualEditor : master[BrowserTest] remove old hack and fix "a is undefined" bug

Event Timeline

Cmcmahon raised the priority of this task from to Needs Triage.
Cmcmahon updated the task description. (Show Details)
Cmcmahon added a subscriber: Cmcmahon.
Restricted Application added a project: VisualEditor. · View Herald TranscriptJan 23 2015, 6:46 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Cmcmahon updated the task description. (Show Details)Jan 23 2015, 7:55 PM
Cmcmahon added a project: Notifications.
Cmcmahon set Security to None.

Here is the stack track from trying to run an Echo test:

a is undefined (Selenium::WebDriver::Error::JavascriptError)

[remote server] http://en.wikipedia.beta.wmflabs.org/wiki/Special:UserLogin line 68 > Function:20:in `P'
[remote server] http://en.wikipedia.beta.wmflabs.org/wiki/Special:UserLogin line 68 > Function:29:in `ma'
[remote server] http://en.wikipedia.beta.wmflabs.org/wiki/Special:UserLogin line 68 > Function:29:in `na'
[remote server] http://en.wikipedia.beta.wmflabs.org/wiki/Special:UserLogin line 68 > Function:29:in `anonymous/</<'
[remote server] http://en.wikipedia.beta.wmflabs.org/wiki/Special:UserLogin line 68 > Function:15:in `anonymous/<'
[remote server] http://en.wikipedia.beta.wmflabs.org/wiki/Special:UserLogin line 68 > Function:15:in `anonymous'
[remote server] http://en.wikipedia.beta.wmflabs.org/wiki/Special:UserLogin:68:in `handleEvaluateEvent'
Jdforrester-WMF triaged this task as High priority.Jan 23 2015, 7:59 PM
Jdforrester-WMF added a subscriber: Jdforrester-WMF.
Cmcmahon raised the priority of this task from High to Unbreak Now!.Jan 29 2015, 6:17 PM

Made highest priority, this is preventing important work.

Gilles added a subscriber: Gilles.Jan 29 2015, 6:36 PM

Please provide a reduced (browser) test case that triggers this error.

Literally every browser test in every repo that I run locally produces this error in Firefox.

It looks like:

And I click in the editable part # features/step_definitions/shared_steps.rb:6

a is undefined (Selenium::WebDriver::Error::JavascriptError)
gerritbot added a subscriber: gerritbot.

Change 187829 had a related patch set uploaded (by Catrope):
[BrowserTest] remove old hack and fix "a is undefined" bug

https://gerrit.wikimedia.org/r/187829

Patch-For-Review

Change 187829 merged by jenkins-bot:
[BrowserTest] remove old hack and fix "a is undefined" bug

https://gerrit.wikimedia.org/r/187829

Is this now fixed?

functionally yes.

Jdforrester-WMF closed this task as Resolved.Jan 31 2015, 12:50 AM
Jdforrester-WMF assigned this task to Cmcmahon.
Jdforrester-WMF removed a project: Patch-For-Review.

It's not exactly fixed.

It's not exactly fixed. Elena discovered that by not firing an explicit javascript 'onfocus' event, the error doesn't show up.

That doesn't mean that the error is not still present. Googling "a is undefined" seems to indicate that the cause is calling for the property of of some object when that object is undefined or otherwise not correct.

Cmcmahon reopened this task as Open.Feb 4 2015, 5:13 PM
Cmcmahon lowered the priority of this task from Unbreak Now! to High.
Cmcmahon removed a project: VisualEditor.

I re-opened this, but I removed the VisualEditor project tag, because the problem is known to also affect Flow and MobileFrontend.

I have set the Priority to 'High' because I also discovered that this makes running browser tests on Vagrant impossible without going to lengths to install Chrome.

Here is a copy of the generic failure that is shared among all the repos:

a is undefined (Selenium::WebDriver::Error::JavascriptError)

[remote server] http://127.0.0.1/wiki/Special:UserLogin line 68 > Function:20:in `P'
[remote server] http://127.0.0.1/wiki/Special:UserLogin line 68 > Function:29:in `ma'
[remote server] http://127.0.0.1/wiki/Special:UserLogin line 68 > Function:29:in `na'
[remote server] http://127.0.0.1/wiki/Special:UserLogin line 68 > Function:29:in `anonymous/</<'
[remote server] http://127.0.0.1/wiki/Special:UserLogin line 68 > Function:15:in `anonymous/<'
[remote server] http://127.0.0.1/wiki/Special:UserLogin line 68 > Function:15:in `anonymous'
[remote server] http://127.0.0.1/wiki/Special:UserLogin:68:in `handleEvaluateEvent'

Errors in the console when this happens:

Note, the errors in that screenshot are all from inside the Firefox browser itself (and/or extensions). .jsm files can only be part of Firefox or extensions, not web site code. The same goes for chrome:// .

However, there could still be something in web site code starting the error chain somehow.

Has anyone tried running the tests in debug mode?

Also, the main errors in that screenshot appears to be two file not found errors in a WebDriver directory, one for xulstore.json.tmp and the other when trying to make a crashes directory.

So it looks like the whole webdriver-profile20150204-1183-1nanrhh directory is missing. It's not clear if this is part of the main chain or only comes into play when it tries to do error handling (e.g. the crashes directory).

Cmcmahon closed this task as Resolved.Feb 5 2015, 5:32 PM

Removed the explicit onfocus event from the Login method in mediawiki_selenium shared code. Update mediawiki_selenium to version 0.4.2 or later if Firefox shows the "a is undefined" error.

greg moved this task from INBOX to Done on the Release-Engineering-Team board.Feb 5 2015, 7:09 PM
Milimetric moved this task from Scheduled to Done on the Scrum-of-Scrums board.Feb 25 2015, 6:56 PM
Restricted Application added a project: Collaboration-Team-Triage. · View Herald TranscriptJun 23 2015, 3:51 PM