Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonne Haß <me@jhass.eu>2021-04-10 15:09:59 +0300
committerJonne Haß <me@jhass.eu>2021-04-11 00:16:10 +0300
commitcd6eb3de7f3c0da5a04074625772e288ff2c3d8b (patch)
tree12859691799120177a60cf882898a6f12cf6189d
parent79133df4a93ddb454347bb9c4de3dcff946853be (diff)
Run jasmine specs using chrome headless
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock9
-rw-r--r--spec/javascripts/app/views/content_view_spec.js57
-rw-r--r--spec/javascripts/support/jasmine_helper.rb8
-rw-r--r--spec/javascripts/support/jasmine_runner.rb23
5 files changed, 42 insertions, 56 deletions
diff --git a/Gemfile b/Gemfile
index 88545c5bc..9b83f8d14 100644
--- a/Gemfile
+++ b/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"
diff --git a/Gemfile.lock b/Gemfile.lock
index 2f84dc66c..018be3526 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -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)
diff --git a/spec/javascripts/app/views/content_view_spec.js b/spec/javascripts/app/views/content_view_spec.js
index a10a3cfc6..6e8ebe869 100644
--- a/spec/javascripts/app/views/content_view_spec.js
+++ b/spec/javascripts/app/views/content_view_spec.js
@@ -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();
- });
+ this.view.render();
+ });
- 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");
- });
+ afterEach(function() {
+ this.view.$("video").stop();
+ });
- it("expands posts on click", function() {
- this.view.$(".collapsible").height(500);
- this.view.collapseOversized();
+ 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");
+ });
- expect(this.view.$(".collapsed").length).toBe(1);
- this.view.$(".media-embed .thumb").click();
- expect(this.view.$(".opened").length).toBe(1);
- });
+ xit("expands posts on click", function() {
+ this.view.$(".collapsible").height(500);
+ this.view.collapseOversized();
- it("plays video", function(done) {
- this.view.$("video").on("playing", function() {
- done();
- });
+ expect(this.view.$(".collapsed").length).toBe(1);
+ this.view.$(".media-embed .thumb").click();
+ expect(this.view.$(".opened").length).toBe(1);
+ });
- this.view.$(".media-embed .thumb").click();
+ xit("plays video", function(done) {
+ this.view.$("video").on("playing", function() {
+ done();
});
+
+ this.view.$(".media-embed .thumb").click();
});
- }
+ });
});
diff --git a/spec/javascripts/support/jasmine_helper.rb b/spec/javascripts/support/jasmine_helper.rb
new file mode 100644
index 000000000..d424f6875
--- /dev/null
+++ b/spec/javascripts/support/jasmine_helper.rb
@@ -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
diff --git a/spec/javascripts/support/jasmine_runner.rb b/spec/javascripts/support/jasmine_runner.rb
deleted file mode 100644
index bb049f9d1..000000000
--- a/spec/javascripts/support/jasmine_runner.rb
+++ /dev/null
@@ -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