Last modified: 2014-02-20 16:52:19 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T55691, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 53691 - browsertests: triggers for VisualEditor
browsertests: triggers for VisualEditor
Status: RESOLVED FIXED
Product: Wikimedia
Classification: Unclassified
Continuous integration (Other open bugs)
wmf-deployment
All All
: High enhancement (vote)
: ---
Assigned To: Jeff Hall
:
Depends on: 60584
Blocks: 53697
  Show dependency treegraph
 
Reported: 2013-09-02 21:21 UTC by James Forrester
Modified: 2014-02-20 16:52 UTC (History)
10 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
phantomjs screen shot (462.01 KB, image/png)
2013-12-13 09:13 UTC, Željko Filipin
Details
PhantomJS screenshot from VE editing mode URL (189.53 KB, image/png)
2013-12-13 17:39 UTC, Jeff Hall
Details
phantomjs screen shot (550.71 KB, image/png)
2013-12-18 17:16 UTC, Željko Filipin
Details
ve ff (115.29 KB, image/png)
2013-12-19 15:52 UTC, Željko Filipin
Details
ve phantomjs (92.97 KB, image/png)
2013-12-19 15:52 UTC, Željko Filipin
Details
Scripts used to evaluate PhantomJS "bind" injection (313 bytes, application/x-javascript)
2014-01-15 21:49 UTC, Jeff Hall
Details

Description James Forrester 2013-09-02 21:21:58 UTC
Similar to bug 52120 for ULS. Once we've got this running on merge, we'll want to move to running on submit (V+2 submit?), but for now…
Comment 1 Jeff Hall 2013-12-10 18:54:10 UTC
Assigning to myself per an e-mail thread with Antoine, Chris, and Željko.
Comment 2 Gerrit Notification Bot 2013-12-11 16:36:07 UTC
Change 100797 had a related patch set uploaded by Hashar:
[browser test] cucumber default profile for CI

https://gerrit.wikimedia.org/r/100797
Comment 3 Antoine "hashar" Musso (WMF) 2013-12-11 21:48:34 UTC
And I manage to get VisualEditor + Parsoid to be setup automatically using Jenkins. The related job configuration is pending in https://gerrit.wikimedia.org/r/#/c/100800/ (need to be polished).

I confirmed the wiki is functional and managed to edit a page using VE \O/

Next steps:
* cleanup the job configuration
* make the wiki faster (sqlite is not on tmpfs as an example)
* try to get at least ONE browser test scenario to pass (anon ones are good candidates apparently)
Comment 4 Jeff Hall 2013-12-12 01:26:37 UTC
Sorry I wasn't able to get to work on this bug quickly Antoine - let me know if you want me to work on creating a new browser test that will succeed in this scenario (the existing anon test will fail since it presumes the existence of a User page in the target wiki).
Comment 5 Antoine "hashar" Musso (WMF) 2013-12-12 11:17:57 UTC
Jeff : sure, if you can get a test that roughly does:

 - anonymous user
 - go to main page
 - press Edit (visual editor version)
 - ensure visual editor is loaded

That would be a nice first step that would validate the Jenkins job and VE/Parsoid is properly setup :-)
Comment 6 Jeff Hall 2013-12-13 00:03:53 UTC
I went ahead and amended the existing Gerrit ID:

https://gerrit.wikimedia.org/r/#/c/100797/

…with an additional anon test case that edits a random page (which will likely always be the "Main Page" for a fresh wiki install).  

The test case currently does not work with PhantomJS, so I'll spend more time tomorrow trying to figure out why PhantomJS can't click into Visual Editor editing mode.
Comment 7 Željko Filipin 2013-12-13 09:12:58 UTC
(In reply to comment #6)
> The test case currently does not work with PhantomJS, so I'll spend more time
> tomorrow trying to figure out why PhantomJS can't click into Visual Editor
> editing mode.

In phantomjs, "edit" link is not visible by default, see attached screen shot.
Comment 8 Željko Filipin 2013-12-13 09:13:43 UTC
Created attachment 14080 [details]
phantomjs screen shot
Comment 9 Jeff Hall 2013-12-13 17:39:30 UTC
Created attachment 14087 [details]
PhantomJS screenshot from VE editing mode URL

Thanks Željko.  I tried modifying the "anon.feature" test to navigate directly to the Visual Editor editing URL (?veaction=edit), but from capturing both a screenshot (attached) and the raw HTML that PhantomJS lands on, it does not appear that PhantomJS is successfully entering into Visual Editor editing mode.

In any case, we're getting closer step-by-step, so I'll continue to work on this.
Comment 10 Antoine "hashar" Musso (WMF) 2013-12-14 00:09:27 UTC
Could it be that phantomjs lack some javascript functionality that would cause VisualEditor to disable itself ?  Might be a browser whitelist as well.  Honestly, I have no clue how it is handled in VisualEditor.
Comment 11 Jeff Hall 2013-12-18 00:47:13 UTC
Looks like it's not a problem with PhantomJS being blacklisted, per the VisualEditor browser blacklist which begins at line 890 of this file:

https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FVisualEditor/b922592902ad57f770b6810566b820aada74aa47/VisualEditor.php

…so I'll spend some more time tomorrow to see if I can figure out why PhantomJS doesn't seem to work as intended even when navigating directly to an "editing mode" URL.
Comment 12 Željko Filipin 2013-12-18 17:15:45 UTC
Looks like phantomjs is blacklisted (or not whitelisted). There is no visual editor edit option (see screen shot).
Comment 13 Željko Filipin 2013-12-18 17:16:35 UTC
Created attachment 14130 [details]
phantomjs screen shot
Comment 14 Jeff Hall 2013-12-18 17:34:41 UTC
Ah, I believe Željko is correct - looks like VE has a whitelist in addition to a blacklist.  See section beginning on line 169 in this file:

https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FVisualEditor/1cd761dad8aed132619c2897abe367404ca8f3ca/modules%2Fve-mw%2Finit%2Ftargets%2Fve.init.mw.ViewPageTarget.js

Will talk to the VE dev team and see if we can get PhantomJS whitelisted.
Comment 15 James Forrester 2013-12-18 17:53:59 UTC
If a browser is not on the blacklist, and meets the functionality criteria, then the edit tabs for VisualEditor should show up. A browser not being on the whitelist just means the user gets a warning when they edit. Adding PhantomJS to the whitelist will not make VisualEditor appear if it doesn't already.

(Also, you can bypass the blacklist with ?veaction=edit&vewhitelist=1 which should trigger VE even if you don't have a functional browser, as long as it has JS.)
Comment 16 Željko Filipin 2013-12-19 15:51:43 UTC
Strange. I am pretty sure PhantomJS has JS. :)

But, this simple script takes screen shot that shows it can not load visual editor.

require "watir-webdriver"
browser = Watir::Browser.new :phantomjs
browser.goto "https://test2.wikipedia.org/wiki/User:Zeljko.filipin%28WMF%29?veaction=edit&vewhitelist=1"
browser.window.resize_to 1280, 1024
browser.screenshot.save "ve.png"

If :phantomjs is replaced with :firefox, then visual editor opens just fine (see screen shots).
Comment 17 Željko Filipin 2013-12-19 15:52:17 UTC
Created attachment 14137 [details]
ve ff
Comment 18 Željko Filipin 2013-12-19 15:52:38 UTC
Created attachment 14138 [details]
ve phantomjs
Comment 19 Jeff Hall 2013-12-19 22:47:18 UTC
Timo pointed me in the right direction:


jeffrey-hall:browser jeffreyhall$ phantomjs
phantomjs> Function.prototype.bind
undefined


Turns out PhantomJS is built with an old version of JavaScriptCore that is missing the "bind" implementation, which is needed to satisfy Visual Editor's es5 features check: 

https://github.com/wikimedia/mediawiki-extensions-VisualEditor/blob/cf7f2b141d/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js#L72-L84

…but a workaround is available:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FFunction%2Fbind#Compatibility

…so I'll investigate the workaround next.
Comment 20 Gerrit Notification Bot 2013-12-20 16:15:00 UTC
Change 102960 had a related patch set uploaded by Jhall:
[Browser test] WIP Modifications for PhantomJS compatibility

https://gerrit.wikimedia.org/r/102960
Comment 21 Jeff Hall 2013-12-26 18:52:56 UTC
Changing bug status since task in still WIP.
Comment 22 Jeff Hall 2014-01-15 21:49:04 UTC
Created attachment 14322 [details]
Scripts used to evaluate PhantomJS "bind" injection

After a pairing session with Željko, I went back to basics and tried to get Function.prototype.bind injection working directly with PhantomJS (ignoring the rest of our test infrastructure for the time being).  

Per the attached scripts, I tried all of the relevant methods noted in the PhantomJS API documentation:

http://phantomjs.org/api/webpage/

...and still no luck.  The Main_Page loads fine, with the exception of the VE editing link/tab, which is available to other browsers (Chrome, Firefox, etc) at the same URL.

Per a suggestion from Antoine, it might be time to investigate using Firefox in a headless mode as a potential substitute for PhantomJS.
Comment 23 Jeff Hall 2014-01-29 16:31:35 UTC
After some further investigation, we've decided to use the "headless" Rubygem for headless browser testing, and we've decided to incorporate that support into the mediawiki-selenium Rubygem so that it will be available to all WMF repositories that have browser tests.  The task for updating the mediawiki-selenium is captured in Bugzilla 60584.
Comment 24 Gerrit Notification Bot 2014-01-30 18:18:46 UTC
Change 102960 abandoned by Jhall:
[Browser test] WIP Modifications for PhantomJS compatibility

Reason:
Abandoning this patch since we have implemented support for headless browser testing in the mediawiki-selenium Rubygem (rather than implementing it in each individual repo).

https://gerrit.wikimedia.org/r/102960
Comment 25 Gerrit Notification Bot 2014-01-30 22:26:35 UTC
Change 110468 had a related patch set uploaded by Jhall:
[Browser test] WIP Headless test for VE verification on a fresh Mediawiki install (as on Integration server).

https://gerrit.wikimedia.org/r/110468
Comment 26 Gerrit Notification Bot 2014-02-06 01:35:17 UTC
Change 110468 abandoned by Jhall:
[Browser test] WIP Headless test for VE verification on a fresh Mediawiki install (as on Integration server).

Reason:
Abandoning this change since I'm going to start fresh with a slightly different approach.

https://gerrit.wikimedia.org/r/110468
Comment 27 Gerrit Notification Bot 2014-02-06 20:50:39 UTC
Change 111890 had a related patch set uploaded by Jhall:
[Browser test] New test for headless browser testing on a fresh Mediawiki install with VisualEditor.

https://gerrit.wikimedia.org/r/111890
Comment 28 Gerrit Notification Bot 2014-02-10 10:42:00 UTC
Change 100797 abandoned by Hashar:
[browser test] Cucumber default profile for CI

Reason:
we are using something different than the ciwmf profile.

https://gerrit.wikimedia.org/r/100797
Comment 29 Gerrit Notification Bot 2014-02-20 16:49:22 UTC
Change 111890 merged by jenkins-bot:
[Browser test] Headless browser test(s)

https://gerrit.wikimedia.org/r/111890
Comment 30 Jeff Hall 2014-02-20 16:52:19 UTC
Basic test is merged and in place, so marking this bug resolved.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links