Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dashboard front-end shenanigans #64

Merged
merged 6 commits into from
Aug 19, 2017
Merged

Fix dashboard front-end shenanigans #64

merged 6 commits into from
Aug 19, 2017

Conversation

danirod
Copy link
Member

@danirod danirod commented Aug 19, 2017

Some of the JavaScript code used for the duration component in the dashboard video editor seem to have regressions, possibly introduced in #63 during the port to vanilla JS.

Anyway, JS hasn't ever been tested. This PR should also fix that by adding support for a JavaScript engine in Capybara and using it instead of the default stack when running some feature tests for pages that depend on JavaScript to work.

Apparently this broke, or was already broken. Setting the hours, minutes
and seconds was not properly triggering the JavaScript events that
update the actual duration in seconds for this field.

The JavaScript event has been replaced with a new submit event that
updates the value for the duration in seconds just before submitting the
form. Alternatively, it has been thought to simply make the backend
controller accept the duration sexagesimal components.
The duration component in the video form actually requires testing that
the JavaScript code the page uses to convert the duration from
sexagesimal units to seconds actually works.

Apply this commit to add support for Poltergeist, a library that makes
use of PhantomJS to run some feature tests in a real browser with
JavaScript support, unlike the default browser used by Capybara.

This is used to fix some new regressions found in dashboard/videos.js.
If the app_host and the server_port don't get reset after running the
dashboard tests that actually need those values set, the remaining tests
will be run using the same app_host.

Forgetting about this will make all the remaining public site feature
tests to fail because, given that app_host still points to the
dashboard, they will run the tests against the dashboard instead of
against the public site.

Apply this commit to fix this by clearing the values for
Capybara.app_host and Capybara.server_port after running the tests. The
values are set to nil because after running a debug puts these seem to
be the default values (unlike default_host).
Integration tests are failing because Travis uses PhantomJS 1.9.8, which
doesn't properly understand the Funtion.prototype.bind method, causing
the Webpack output to fail.

It's a known issue and until Travis updates PhantomJS to 2.x (something
they have been promising for two years) the only choices are: to either
use a polyfill for ancient browsers who still don't understand ES5
(including PhantomJS 1.9.8), or to get a PhantomJS 2.x binary, which is
my proposed solution.
Supposedly upstream Webpacker has had a commit for a few days where the
dev server is automatically launched in testing environment as well.
@danirod danirod merged commit 74dd78e into master Aug 19, 2017
@danirod danirod deleted the front-testing branch August 19, 2017 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant