Created
July 23, 2015 21:46
-
-
Save redbar0n/82d253e319c7e120bcdb to your computer and use it in GitHub Desktop.
capybara-webkit 1.5.2 still doesn't catch .onEnded events from videojs, so any video playing will not end (and tests will stall indefinitely)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
My system specs: | |
--- | |
OSX Mavericks 10.9.5 | |
capybara 2.4.4 | |
capybara-webkit 1.5.2 | |
--- | |
Videojs code from [video.js](https://github.com/videojs/video.js): | |
--- | |
/** | |
* Fired when the end of the media resource is reached (currentTime == duration) | |
* @event ended | |
*/ | |
vjs.Player.prototype.onEnded = function(){ | |
console.log("VIDEOJS END OF VIDEO"); | |
this.addClass('vjs-ended'); | |
if (this.options_['loop']) { | |
this.currentTime(0); | |
this.play(); | |
} else if (!this.paused()) { | |
this.pause(); | |
} | |
}; | |
---- | |
The failing test: | |
---- | |
it "the state 'Completed' should be tracked correctly", focus: true, :js => true do | |
visit show_video_path(:unit_id => @unit.id, :channel_id => Channel.first.id, :w => 600, :h => 450) | |
page.find("div.vjs-big-play-button").click # click play video button | |
expect(page).to have_css(".vjs-playing") | |
wait_for_video_completed | |
expect(page).to have_css(".vjs-ended") | |
sign_in_with(@advertiser.email, ".l00t.l00t.") | |
check_results('Completed', '1') | |
end | |
---- | |
Actual :webkit_debug output: | |
---- | |
› rspec spec/features/tracking_spec.rb | |
Run options: include {:focus=>true} | |
Randomized with seed 26113 | |
Tracking | |
Running with Capybara.current_driver: | |
webkit | |
Inside :js => true blocks the Capybara.current_driver will be set to Capybara.javascript_driver which is: | |
webkit_debug | |
Finished "EnableLogging()" with response "Success()" | |
Wrote response true "" | |
Received "Visit(http://127.0.0.1:3001/video/show/1/1?h=450&locale=en&w=600)" | |
Started "Visit(http://127.0.0.1:3001/video/show/1/1?h=450&locale=en&w=600)" | |
Load started | |
"Visit(http://127.0.0.1:3001/video/show/1/1?h=450&locale=en&w=600)" started page load | |
Started request to "http://127.0.0.1:3001/video/show/1/1?h=450&locale=en&w=600" | |
Finished "Visit(http://127.0.0.1:3001/video/show/1/1?h=450&locale=en&w=600)" with response "Success()" | |
Started request to "http://127.0.0.1:3001/assets/venderviral/unit.css" | |
Started request to "http://127.0.0.1:3001/assets/venderviral/unit.js" | |
Received 200 from "http://127.0.0.1:3001/video/show/1/1?h=450&locale=en&w=600" | |
Received 200 from "http://127.0.0.1:3001/assets/venderviral/unit.css" | |
Received 200 from "http://127.0.0.1:3001/assets/venderviral/unit.js" | |
http://127.0.0.1:3001/assets/venderviral/unit.js|14308|EVENT HANDLERS SET | |
Started request to "http://127.0.0.1:3001/assets/icons/share_white.png" | |
Started request to "http://127.0.0.1:3001/assets/icons/embed_close_white.png" | |
Started request to "http://127.0.0.1:3001/assets/icons/facebook_white.png" | |
Started request to "http://127.0.0.1:3001/assets/icons/twitter_t_white.png" | |
Started request to "http://127.0.0.1:3001/assets/icons/envelope_white.png" | |
Received 200 from "http://127.0.0.1:3001/assets/icons/share_white.png" | |
Received 200 from "http://127.0.0.1:3001/assets/icons/facebook_white.png" | |
Received 200 from "http://127.0.0.1:3001/assets/icons/twitter_t_white.png" | |
Received 200 from "http://127.0.0.1:3001/assets/icons/envelope_white.png" | |
Received 200 from "http://127.0.0.1:3001/assets/icons/embed_close_white.png" | |
Page finished with true | |
Load finished | |
Page load from command finished | |
Wrote response true "" | |
Received "FindCss(div.vjs-big-play-button)" | |
Started "FindCss(div.vjs-big-play-button)" | |
Finished "FindCss(div.vjs-big-play-button)" with response "Success(1)" | |
Wrote response true "1" | |
Received "Node.visible" | |
Started "Node.visible" | |
Finished "Node.visible" with response "Success(true)" | |
Wrote response true "true" | |
Received "Node.leftClick" | |
Started "Node.leftClick" | |
Finished "Node.leftClick" with response "Success()" | |
Wrote response true "" | |
Started request to "http://127.0.0.1:3001/track/json/1/1/play/0/4jh21g4v09ftpvd386fis?callback=jQuery1112003799367602914572_1437685737999&_=1437685738000" | |
Started request to "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAP0lEQVQIHWWMAQoAIAgDR/QJ/Ub//04+w7ZICBwcOg5FZi5iBB82AGzixEglJrd4TVK5XUJpskSTEvpdFzX9AB2pGziSQcvAAAAAAElFTkSuQmCC" | |
Received 0 from "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAP0lEQVQIHWWMAQoAIAgDR/QJ/Ub//04+w7ZICBwcOg5FZi5iBB82AGzixEglJrd4TVK5XUJpskSTEvpdFzX9AB2pGziSQcvAAAAAAElFTkSuQmCC" | |
Started request to "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAP0lEQVQIHWWMAQoAIAgDR/QJ/Ub//04+w7ZICBwcOg5FZi5iBB82AGzixEglJrd4TVK5XUJpskSTEvpdFzX9AB2pGziSQcvAAAAAAElFTkSuQmCC" | |
Received 0 from "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAP0lEQVQIHWWMAQoAIAgDR/QJ/Ub//04+w7ZICBwcOg5FZi5iBB82AGzixEglJrd4TVK5XUJpskSTEvpdFzX9AB2pGziSQcvAAAAAAElFTkSuQmCC" | |
Received "FindCss(.vjs-playing)" | |
Started "FindCss(.vjs-playing)" | |
Finished "FindCss(.vjs-playing)" with response "Success(2,3)" | |
Wrote response true "2,3" | |
Received "Node.visible" | |
Started "Node.visible" | |
Finished "Node.visible" with response "Success(true)" | |
Wrote response true "true" | |
Received "Node.visible" | |
Started "Node.visible" | |
Finished "Node.visible" with response "Success(true)" | |
Wrote response true "true" | |
Received "Evaluate(document.getElementsByClassName('vjs-ended').length;)" | |
Started "Evaluate(document.getElementsByClassName('vjs-ended').length;)" | |
Finished "Evaluate(document.getElementsByClassName('vjs-ended').length;)" with response "Success(0)" | |
Wrote response true "0" | |
Received "Evaluate(document.getElementsByClassName('vjs-ended').length;)" | |
Started "Evaluate(document.getElementsByClassName('vjs-ended').length;)" | |
Finished "Evaluate(document.getElementsByClassName('vjs-ended').length;)" with response "Success(0)" | |
Wrote response true "0" | |
Received "Evaluate(document.getElementsByClassName('vjs-ended').length;)" | |
Started "Evaluate(document.getElementsByClassName('vjs-ended').length;)" | |
Finished "Evaluate(document.getElementsByClassName('vjs-ended').length;)" with response "Success(0)" | |
Wrote response true "0" | |
Received "Evaluate(document.getElementsByClassName('vjs-ended').length;)" | |
Started "Evaluate(document.getElementsByClassName('vjs-ended').length;)" | |
Finished "Evaluate(document.getElementsByClassName('vjs-ended').length;)" with response "Success(0)" | |
Wrote response true "0" | |
... and just repeatedly loop output the last 4 lines, stalling indefinitely, so I have to shut down the process with CTRL+C |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment