Run jasmine specs using chrome headless
This commit is contained in:
parent
79133df4a9
commit
cd6eb3de7f
5 changed files with 48 additions and 62 deletions
1
Gemfile
1
Gemfile
|
|
@ -304,6 +304,7 @@ group :development, :test do
|
|||
gem "cucumber-rails", "2.0.0", require: false
|
||||
|
||||
# Jasmine (client side application tests (JS))
|
||||
gem "chrome_remote", "0.3.0"
|
||||
gem "jasmine", "3.6.0"
|
||||
gem "jasmine-jquery-rails", "2.0.3"
|
||||
gem "rails-assets-jasmine-ajax", "4.0.0", source: "https://gems.diasporafoundation.org"
|
||||
|
|
|
|||
|
|
@ -112,6 +112,8 @@ GEM
|
|||
timers (>= 4.1.1)
|
||||
celluloid-supervision (0.20.6)
|
||||
timers (>= 4.1.1)
|
||||
chrome_remote (0.3.0)
|
||||
websocket-driver (~> 0.6)
|
||||
chunky_png (1.3.11)
|
||||
citrus (3.0.2)
|
||||
cliver (0.3.2)
|
||||
|
|
@ -232,7 +234,7 @@ GEM
|
|||
http-cookie (~> 1.0.0)
|
||||
faraday_middleware (0.13.1)
|
||||
faraday (>= 0.7.4, < 1.0)
|
||||
ffi (1.12.2)
|
||||
ffi (1.15.0)
|
||||
ffi-compiler (1.0.1)
|
||||
ffi (>= 1.0.0)
|
||||
rake
|
||||
|
|
@ -319,7 +321,7 @@ GEM
|
|||
http-cookie (1.0.3)
|
||||
domain_name (~> 0.5)
|
||||
http-form_data (2.3.0)
|
||||
http-parser (1.2.1)
|
||||
http-parser (1.2.3)
|
||||
ffi-compiler (>= 1.0, < 2.0)
|
||||
http_accept_language (2.1.1)
|
||||
http_parser.rb (0.6.0)
|
||||
|
|
@ -666,7 +668,7 @@ GEM
|
|||
sprockets (>= 2.8, < 4.0)
|
||||
sprockets-rails (>= 2.0, < 4.0)
|
||||
tilt (>= 1.1, < 3)
|
||||
sassc (2.2.1)
|
||||
sassc (2.4.0)
|
||||
ffi (~> 1.9)
|
||||
sawyer (0.8.2)
|
||||
addressable (>= 2.3.5)
|
||||
|
|
@ -797,6 +799,7 @@ DEPENDENCIES
|
|||
bootstrap-switch-rails (= 3.3.3)
|
||||
capybara (= 3.15.0)
|
||||
carrierwave (= 1.3.1)
|
||||
chrome_remote (= 0.3.0)
|
||||
compass-rails (= 3.1.0)
|
||||
configurate (= 0.5.0)
|
||||
cucumber-api-steps (= 0.14)
|
||||
|
|
|
|||
|
|
@ -37,42 +37,39 @@ describe("app.views.Content", function(){
|
|||
});
|
||||
});
|
||||
|
||||
// These tests don't work in PhantomJS because it doesn't support HTML5 <video>.
|
||||
if (/PhantomJS/.exec(navigator.userAgent) === null) {
|
||||
describe("onVideoThumbClick", function() {
|
||||
beforeEach(function() {
|
||||
this.post = new app.models.StatusMessage({text: "[title](https://www.w3schools.com/html/mov_bbb.mp4)"});
|
||||
this.view = new app.views.StatusMessage({model: this.post});
|
||||
describe("onVideoThumbClick", function() {
|
||||
beforeEach(function() {
|
||||
this.post = new app.models.StatusMessage({text: "[title](https://www.w3schools.com/html/mov_bbb.mp4)"});
|
||||
this.view = new app.views.StatusMessage({model: this.post});
|
||||
|
||||
this.view.render();
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
this.view.$("video").stop();
|
||||
});
|
||||
|
||||
it("hides video overlay", function() {
|
||||
expect(this.view.$(".video-overlay").length).toBe(1);
|
||||
this.view.$(".media-embed .thumb").click();
|
||||
expect(this.view.$(".video-overlay")).toHaveClass("hidden");
|
||||
});
|
||||
|
||||
it("expands posts on click", function() {
|
||||
this.view.$(".collapsible").height(500);
|
||||
this.view.collapseOversized();
|
||||
|
||||
expect(this.view.$(".collapsed").length).toBe(1);
|
||||
this.view.$(".media-embed .thumb").click();
|
||||
expect(this.view.$(".opened").length).toBe(1);
|
||||
});
|
||||
|
||||
it("plays video", function(done) {
|
||||
this.view.$("video").on("playing", function() {
|
||||
done();
|
||||
});
|
||||
|
||||
this.view.$(".media-embed .thumb").click();
|
||||
});
|
||||
this.view.render();
|
||||
});
|
||||
}
|
||||
|
||||
afterEach(function() {
|
||||
this.view.$("video").stop();
|
||||
});
|
||||
|
||||
xit("hides video overlay", function() {
|
||||
expect(this.view.$(".video-overlay").length).toBe(1);
|
||||
this.view.$(".media-embed .thumb").click();
|
||||
expect(this.view.$(".video-overlay")).toHaveClass("hidden");
|
||||
});
|
||||
|
||||
xit("expands posts on click", function() {
|
||||
this.view.$(".collapsible").height(500);
|
||||
this.view.collapseOversized();
|
||||
|
||||
expect(this.view.$(".collapsed").length).toBe(1);
|
||||
this.view.$(".media-embed .thumb").click();
|
||||
expect(this.view.$(".opened").length).toBe(1);
|
||||
});
|
||||
|
||||
xit("plays video", function(done) {
|
||||
this.view.$("video").on("playing", function() {
|
||||
done();
|
||||
});
|
||||
|
||||
this.view.$(".media-embed .thumb").click();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
8
spec/javascripts/support/jasmine_helper.rb
Normal file
8
spec/javascripts/support/jasmine_helper.rb
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
Jasmine.configure do |config|
|
||||
config.prevent_phantom_js_auto_install = true
|
||||
config.runner_browser = :chromeheadless
|
||||
config.chrome_startup_timeout = 20
|
||||
config.chrome_cli_options["autoplay-policy"] = "no-user-gesture-required"
|
||||
end
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
$:.unshift(ENV['JASMINE_GEM_PATH']) if ENV['JASMINE_GEM_PATH'] # for gem testing purposes
|
||||
|
||||
ENV["JASMINE_BROWSER"] = "firefox"
|
||||
|
||||
require 'rubygems'
|
||||
require 'json'
|
||||
require 'jasmine'
|
||||
require 'rspec'
|
||||
|
||||
jasmine_config = Jasmine::Config.new
|
||||
spec_builder = Jasmine::SpecBuilder.new(jasmine_config)
|
||||
|
||||
should_stop = false
|
||||
|
||||
RSpec.configuration.after(:suite) do
|
||||
spec_builder.stop if should_stop
|
||||
end
|
||||
|
||||
spec_builder.start
|
||||
should_stop = true
|
||||
spec_builder.declare_suites
|
||||
Loading…
Reference in a new issue