Problem/Motivation

This blocks #2421427: Improve the UX of Quick Editing single-valued image fields and was discovered at #2421427-73: Improve the UX of Quick Editing single-valued image fields.

As you can see in http://cgit.drupalcode.org/drupalci_testbot/tree/containers/base/php-bas..., testbot currently uses
RUN curl -L https://github.com/bprodoehl/phantomjs/releases/download/v2.0.0-20150528/phantomjs-2.0.0-20150528-u1404-x86_64.zip -o ~/phantomjs-2.0.zip && […], which is Phantomjs 2.0.0 from May 28, 2015.

But, until https://github.com/ariya/phantomjs/issues/12506 was fixed on December 12, 2015, it was impossible to upload files. https://github.com/ariya/phantomjs/milestone/14?closed=1 (version 2.1) was the first release to contain this fix. It was released on February 3, 2016.

So, until we update PhantomJS, we cannot have any JS tests using file uploads.

Proposed resolution

Update PhantomJS to 2.1.1.

Remaining tasks

TBD.

Comments

Wim Leers created an issue. See original summary.

Wim Leers’s picture

IRC chat log with @Mixologic:

19:53:23 <WimLeers> Mixologic_: hi!
19:53:32 <WimLeers> Mixologic_: are you the right person to talk to wrt testbot's phantomjs version?
19:53:35 <Mixologic_> WimLeers: howdy
19:53:43 <Mixologic_> WimLeers: yup Im all things testbot
19:53:47 <WimLeers> awesome
19:53:50 <WimLeers> Mixologic_: https://www.drupal.org/node/2421427#comment-11446879
19:53:53 <Druplicon> https://www.drupal.org/node/2421427 => Improve the UX of Quick Editing images #2421427: Improve the UX of Quick Editing single-valued image fields => 73 comments, 7 IRC mentions
19:53:56 <WimLeers> Mixologic_: so, in a nutshell
19:54:02 <WimLeers> Mixologic_: exciting/awesome new UX feature
19:54:05 <WimLeers> Mixologic_: but tests won't pass on d.o
19:54:11 <WimLeers> Mixologic_: tests passed for samuel.mortenson locally
19:54:25 <WimLeers> Mixologic_: I debugged it and *was* able to reproduce
19:54:31 <WimLeers> Mixologic_: turns out I had older phantomjs (2.0.0)
19:54:58 <WimLeers> Mixologic_: conclusion: testbot fails because it doesn't run phantomjs 2.1.x, which doesn't include the fix for https://github.com/ariya/phantomjs/issues/12506, which landed in December 2015
19:55:02 <Mixologic_> WimLeers: yeah, phantomjs's versioning has been uh.. well, lets just say they should learn about alphas and betas.
19:55:13 <WimLeers> Mixologic_: hehe
19:55:23 <WimLeers> Mixologic_: any chance you can easily update to a new phantomjs?
19:55:29 <Mixologic_> WimLeers: so it took us a good while to find a version that worked.
19:55:31 <WimLeers> *update testbot
19:55:35 <WimLeers> uh oh
19:55:40 <Mixologic_> WimLeers: depends on the urgency.
19:56:02 <WimLeers> Mixologic_: well, this is a very prominent UX feature that *must* land before D8.2.x feature freeze… which is next week
19:56:03 <Mixologic_> WimLeers: so the composer facade is in a nice holding pattern where it works, so now Im switching focus back to drupalci
19:56:19 <WimLeers> Mixologic_: yes, I've been reading all your issue comments :)
19:56:53 <WimLeers> Mixologic_: lots of diplomatic work in the community too
19:56:55 <WimLeers> Mixologic_++
19:57:03 <Mixologic_> WimLeers: and the first thing I want to work on in drupalci is restructuring the way we handle the environment, specifcally switching from a couple of bespoke brittle containers to using a docker compose yml file to define an environment.
19:57:51 <WimLeers> Mixologic_: heh
19:58:00 <WimLeers> Mixologic_: so should I file an issue somewhere for this?
19:58:02 <Mixologic_> WimLeers: once we have that, we'll be able to adjust environments at will when testing, so if a dev wants to see if the results are different with a newer version of phantom, that wont require maintainer intervention
19:58:06 <WimLeers> Mixologic_: I don't know where the DrupalCI issue queue is
19:58:11 <Mixologic_> but yeah, if you need this pronto I can see what I can do.
19:59:17 <Mixologic_> There's really two of them. One is https://drupal.org/project/drupalci and the other is https://drupal.org/project/drupalci_testbot.  The first is pretty much for everything, the latter is where I'll move stuff if it affects the code that actually runs on the bot. Oh, and there's a third one, which is https://drupal.org/project/project_issue_file_test which is where all of the d.o. implementation lives.
20:00:14 <Mixologic_> WimLeers: my biggest concern is 2.1.1 might fix your particular issue, but may introduce other, unintended consequences. but if you ran all of the js tests locally and they pass, then thats not as big of a concern
20:03:49 <Mixologic_> WimLeers: please open an issue in https://drupal.org/project/drupalci_testbot, and let me know what version you want installed: This is where we are currently installing it: http://cgit.drupalcode.org/drupalci_testbot/tree/containers/base/php-base/Dockerfile#n78
20:04:17 <WimLeers> Mixologic_++
Wim Leers’s picture

Relevant here: I attempted to devise a work-around, but turns out that that also doesn't work in PhantomJS. Quoting #2421427-75: Improve the UX of Quick Editing single-valued image fields:

The only possible work-around is to create a File object ourselves. See https://www.w3.org/TR/file-upload/#dfn-filelist. Concrete example at the bottom of http://thinkmoult.com/using-sahi-mink-behat-test-html5-drag-drop-file-up.... This works in Chrome for example:

new File([new Blob()], "name.png");

But in PhantomJS 2.0, and 2.1, and HEAD, this is what you get:

TypeError: FileConstructor is not a constructor (evaluating 'new File([new Blob()], "name.png")')

PhantomJS issue: https://github.com/ariya/phantomjs/issues/14247.

So, alas, there's no work-around possible.

Wim Leers’s picture

And to prove that all JS tests work on PhantomJS 2.1.1:

wim.leers at wimleers-acquia in ~/Work/drupal-tres on 8.2.x*
$ phantomjs --version
2.1.1
wim.leers at wimleers-acquia in ~/Work/drupal-tres on 8.2.x*
$ sudo -u _www php ./vendor/bin/phpunit -c core --testsuite functional-javascript
Password:
PHPUnit 4.8.11 by Sebastian Bergmann and contributors.

...........

Time: 1.61 minutes, Memory: 7.25Mb

OK (11 tests, 82 assertions)

  • Mixologic committed 5c79e3a on 2773637-phantomjs-upgrade-hotfix
    Issue #2773637: Upgrades the phanomjs version to 2.1.1
    
Mixologic’s picture

I've updated the code, pushed to drupal.org, synced the code to bitbucket, triggered the webhook to rebuild the containers, and now they are queued on dockerhub waiting to rebuild.

As soon as they have rebuilt, I will re-create another AMI with the new containers on them, and we should have the upgrade available.

Mixologic’s picture

dawehner’s picture

Thanks a lot @Mixologic for this super fast reaction!

samuel.mortenson’s picture

Thanks @mixologic! I'll be watching the builds patiently :-)

  • Mixologic committed ef53581 on 2773637-phantomjs-upgrade-hotfix
    Issue #2773637: Upgrades the phanomjs version to 2.1.1, the right way
    
Wim Leers’s picture

Thanks so much @Mixologic, this is incredibly fast! But now, please go get some sleep!

  • Mixologic committed 73c67ea on 2773637-phantomjs-upgrade-hotfix
    Issue #2773637: Never use dev-master if you want repeatable builds
    
samuel.mortenson’s picture

It looks like some builds failed on https://hub.docker.com/r/drupalci/php-base/builds, but others succeeded! Do we need to trigger another rebuild or is the docker image having problems?

Mixologic’s picture

Im going to see about rebuilding the AMI that drupalci uses to get the new containers that have the new phantom in them today

Mixologic’s picture

Status: Active » Fixed

AMI rebuilt and deployed into production. Ugh. this process is/was ugly.

Wim Leers’s picture

Thanks! :)

samuel.mortenson’s picture

Thanks again @Mixologic! Tests are green and the issue in unblocked now :-)

Mixologic’s picture

Component: Code » Environments

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.