decidim-dev 0.30.8 → 0.31.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/decidim/dev/dummy_resource.rb +2 -6
- data/app/packs/entrypoints/decidim_dev.scss +1 -1
- data/app/packs/src/decidim/dev/accessibility.js +2 -2
- data/app/packs/stylesheets/decidim/dev.scss +4 -4
- data/app/presenters/decidim/dev/dummy_resource_presenter.rb +2 -2
- data/config/assets.rb +2 -2
- data/config/locales/ar.yml +0 -2
- data/config/locales/bg.yml +0 -2
- data/config/locales/bs-BA.yml +0 -8
- data/config/locales/ca-IT.yml +3 -3
- data/config/locales/ca.yml +3 -3
- data/config/locales/cs.yml +2 -2
- data/config/locales/de.yml +2 -2
- data/config/locales/el.yml +2 -14
- data/config/locales/en.yml +2 -2
- data/config/locales/es-MX.yml +2 -2
- data/config/locales/es-PY.yml +2 -2
- data/config/locales/es.yml +2 -2
- data/config/locales/eu.yml +10 -10
- data/config/locales/fi-plain.yml +2 -2
- data/config/locales/fi.yml +2 -2
- data/config/locales/fr-CA.yml +0 -2
- data/config/locales/fr.yml +0 -2
- data/config/locales/gl.yml +0 -2
- data/config/locales/hu.yml +0 -2
- data/config/locales/it.yml +0 -2
- data/config/locales/ja.yml +2 -2
- data/config/locales/lt.yml +0 -2
- data/config/locales/lv.yml +0 -2
- data/config/locales/nl.yml +0 -2
- data/config/locales/no.yml +0 -2
- data/config/locales/pl.yml +0 -2
- data/config/locales/pt-BR.yml +0 -2
- data/config/locales/pt.yml +0 -2
- data/config/locales/ro-RO.yml +9 -16
- data/config/locales/sk.yml +0 -2
- data/config/locales/sr-CS.yml +0 -8
- data/config/locales/sv.yml +2 -2
- data/config/locales/tr-TR.yml +0 -2
- data/config/locales/zh-CN.yml +0 -2
- data/config/locales/zh-TW.yml +0 -2
- data/config/rubocop/capybara/configuration.yml +1 -0
- data/config/rubocop/capybara/disabled.yml +7 -0
- data/config/rubocop/disabled.yml +1 -41
- data/config/rubocop/factory_bot/configuration.yml +1 -0
- data/config/rubocop/factory_bot/disabled.yml +10 -0
- data/config/rubocop/{faker.yml → faker/configuration.yml} +2 -2
- data/config/rubocop/faker/disabled.yml +3 -0
- data/config/rubocop/{graphql.yml → graphql/configuration.yml} +2 -6
- data/config/rubocop/graphql/disabled.yml +4 -0
- data/config/rubocop/performance/configuration.yml +1 -0
- data/config/rubocop/{performance.yml → performance/disabled.yml} +1 -1
- data/config/rubocop/{rails.yml → rails/configuration.yml} +1 -24
- data/config/rubocop/rails/disabled.yml +46 -0
- data/config/rubocop/{rspec.yml → rspec/configuration.yml} +2 -29
- data/config/rubocop/rspec/disabled.yml +49 -0
- data/config/rubocop/{ruby.yml → ruby/configuration.yml} +3 -38
- data/config/rubocop/ruby/disabled.yml +106 -0
- data/decidim-dev.gemspec +10 -10
- data/lib/decidim/dev/assets/assemblies.json +6 -11
- data/lib/decidim/dev/assets/assemblies_with_null.json +0 -1
- data/lib/decidim/dev/assets/census_all_invalid.csv +4 -0
- data/lib/decidim/dev/assets/census_duplicate_emails.csv +4 -0
- data/lib/decidim/dev/assets/census_no_header.csv +2 -0
- data/lib/decidim/dev/assets/census_with_missing_email.csv +3 -0
- data/lib/decidim/dev/assets/census_with_missing_token.csv +3 -0
- data/lib/decidim/dev/assets/empty_file.csv +0 -0
- data/lib/decidim/dev/assets/participatory_processes.json +0 -1
- data/lib/decidim/dev/assets/participatory_processes_with_null.json +0 -1
- data/lib/decidim/dev/assets/valid_election_census.csv +3 -0
- data/lib/decidim/dev/assets/valid_emails.csv +27 -0
- data/lib/decidim/dev/component.rb +2 -2
- data/lib/decidim/dev/engine.rb +1 -7
- data/lib/decidim/dev/test/base_spec_helper.rb +9 -0
- data/lib/decidim/dev/test/factories.rb +5 -12
- data/lib/decidim/dev/test/rspec_support/activestorage_matchers.rb +1 -1
- data/lib/decidim/dev/test/rspec_support/capybara.rb +11 -18
- data/lib/decidim/dev/test/rspec_support/comments.rb +1 -1
- data/lib/decidim/dev/test/rspec_support/component.rb +2 -2
- data/lib/decidim/dev/test/rspec_support/component_context.rb +0 -100
- data/lib/decidim/dev/test/rspec_support/editor_context.rb +1 -13
- data/lib/decidim/dev/test/rspec_support/gamification.rb +1 -1
- data/lib/decidim/dev/test/rspec_support/helpers.rb +16 -0
- data/lib/decidim/dev/test/rspec_support/rake_tasks.rb +0 -16
- data/lib/decidim/dev/test/rspec_support/screenshot_helper.rb +2 -2
- data/lib/decidim/dev/test/rspec_support/{webpacker.rb → shakapacker.rb} +2 -2
- data/lib/decidim/dev/test/rspec_support/z_download_helper.rb +0 -1
- data/lib/decidim/dev/test/spec_helper.rb +1 -1
- data/lib/decidim/dev/version.rb +1 -1
- data/lib/decidim/dev.rb +0 -2
- data/rubocop-decidim.yml +17 -9
- metadata +91 -40
- data/lib/decidim/api/dummy_resource_type.rb +0 -12
- data/lib/decidim/dev/api.rb +0 -7
- data/lib/decidim/dev/assets/dummy-export.zip +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
first_test_email@example.org
|
|
2
|
+
second_test_email@example.org
|
|
3
|
+
third_test_email@example.org
|
|
4
|
+
this_is_a_test_email@test.org
|
|
5
|
+
test.123@test.org
|
|
6
|
+
example.123@test.org
|
|
7
|
+
this_is_another_test_email@test.com
|
|
8
|
+
test_user_001@example.com
|
|
9
|
+
test.account@example.com
|
|
10
|
+
test.example@example.com
|
|
11
|
+
example.account@example.com
|
|
12
|
+
new_email_test@example.com
|
|
13
|
+
one_more_example_email@test.org
|
|
14
|
+
another_example_email@test.org
|
|
15
|
+
first_test@test.org
|
|
16
|
+
one_example_email@test.org
|
|
17
|
+
second_test@test.com
|
|
18
|
+
four.test@test.org
|
|
19
|
+
the_test_email@example.org
|
|
20
|
+
these_test_email@test.org
|
|
21
|
+
more_example_email@test.org
|
|
22
|
+
the_new_email_test@example.test
|
|
23
|
+
another_example_email@test.example
|
|
24
|
+
this_is_the_new_email_test@example.test
|
|
25
|
+
one_more_example_email@example.test
|
|
26
|
+
another_example_email@example.test
|
|
27
|
+
first_test@example.test
|
|
@@ -33,8 +33,8 @@ Decidim.register_component(:dummy) do |component|
|
|
|
33
33
|
settings.attribute :amendment_reaction_enabled, type: :boolean, default: true
|
|
34
34
|
settings.attribute :amendment_promotion_enabled, type: :boolean, default: true
|
|
35
35
|
settings.attribute :amendments_visibility, type: :string, default: "all"
|
|
36
|
-
settings.attribute :
|
|
37
|
-
settings.attribute :
|
|
36
|
+
settings.attribute :likes_enabled, type: :boolean, default: false
|
|
37
|
+
settings.attribute :likes_blocked, type: :boolean, default: false
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
component.register_resource(:dummy_resource) do |resource|
|
data/lib/decidim/dev/engine.rb
CHANGED
|
@@ -25,7 +25,7 @@ module Decidim
|
|
|
25
25
|
ActiveSupport.on_load(:action_controller) { include Decidim::Dev::NeedsDevelopmentTools } if Rails.env.development? || ENV.fetch("DECIDIM_DEV_ENGINE", nil)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
initializer "decidim_dev.
|
|
28
|
+
initializer "decidim_dev.shakapacker.assets_path" do
|
|
29
29
|
Decidim.register_assets_path File.expand_path("app/packs", root)
|
|
30
30
|
end
|
|
31
31
|
|
|
@@ -45,12 +45,6 @@ module Decidim
|
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
|
-
|
|
49
|
-
initializer "decidim_dev.graphql_api" do
|
|
50
|
-
next unless Decidim.module_installed?(:api)
|
|
51
|
-
|
|
52
|
-
Decidim::Api.add_orphan_type Decidim::Dev::DummyResourceType
|
|
53
|
-
end
|
|
54
48
|
end
|
|
55
49
|
end
|
|
56
50
|
end
|
|
@@ -4,6 +4,15 @@ require "decidim/dev"
|
|
|
4
4
|
|
|
5
5
|
ENV["RAILS_ENV"] ||= "test"
|
|
6
6
|
ENV["RAILS_SYSTEM_TESTING_SCREENSHOT_HTML"] ||= "1"
|
|
7
|
+
ENV["DECIDIM_API_JWT_SECRET"] ||= "dummy-api-jwt-secret"
|
|
8
|
+
ENV["DECIDIM_AVAILABLE_LOCALES"] ||= "en,ca,es"
|
|
9
|
+
ENV["DECIDIM_ENABLE_MACHINE_TRANSLATION"] ||= "true"
|
|
10
|
+
ENV["DECIDIM_SPAM_DETECTION_BACKEND_RESOURCE"] ||= "memory"
|
|
11
|
+
ENV["DECIDIM_SPAM_DETECTION_BACKEND_USER"] ||= "memory"
|
|
12
|
+
ENV["DECIDIM_SMS_GATEWAY_SERVICE"] ||= "Decidim::Verifications::Sms::ExampleGateway"
|
|
13
|
+
ENV["DECIDIM_TIMESTAMP_SERVICE"] ||= "Decidim::Initiatives::DummyTimestamp"
|
|
14
|
+
ENV["DECIDIM_PDF_SIGNATURE_SERVICE"] ||= "Decidim::PdfSignatureExample"
|
|
15
|
+
ENV["DECIDIM_MACHINE_TRANSLATION_SERVICE"] ||= "Decidim::Dev::DummyTranslator"
|
|
7
16
|
|
|
8
17
|
engine_spec_dir = File.join(Dir.pwd, "spec")
|
|
9
18
|
|
|
@@ -15,8 +15,6 @@ FactoryBot.define do
|
|
|
15
15
|
transient do
|
|
16
16
|
skip_injection { false }
|
|
17
17
|
users { nil }
|
|
18
|
-
# user_groups correspondence to users is by sorting order
|
|
19
|
-
user_groups { [] }
|
|
20
18
|
end
|
|
21
19
|
title { generate_localized_title(:dummy_resource_title, skip_injection:) }
|
|
22
20
|
component { create(:dummy_component, skip_injection:) }
|
|
@@ -27,11 +25,11 @@ FactoryBot.define do
|
|
|
27
25
|
published_at { Time.current }
|
|
28
26
|
end
|
|
29
27
|
|
|
30
|
-
trait :
|
|
28
|
+
trait :with_likes do
|
|
31
29
|
after :create do |resource, evaluator|
|
|
32
30
|
5.times.collect do
|
|
33
|
-
create(:
|
|
34
|
-
|
|
31
|
+
create(:like, resource:, skip_injection: evaluator.skip_injection,
|
|
32
|
+
author: build(:user, organization: resource.component.organization, skip_injection: evaluator.skip_injection))
|
|
35
33
|
end
|
|
36
34
|
end
|
|
37
35
|
end
|
|
@@ -61,13 +59,8 @@ FactoryBot.define do
|
|
|
61
59
|
|
|
62
60
|
after :build do |resource, evaluator|
|
|
63
61
|
evaluator.authors_list.each do |coauthor|
|
|
64
|
-
resource.coauthorships <<
|
|
65
|
-
|
|
66
|
-
organization: evaluator.component.organization, skip_injection: evaluator.skip_injection)
|
|
67
|
-
else
|
|
68
|
-
build(:coauthorship, author: coauthor, coauthorable: resource, organization: evaluator.component.organization,
|
|
69
|
-
skip_injection: evaluator.skip_injection)
|
|
70
|
-
end
|
|
62
|
+
resource.coauthorships << build(:coauthorship, author: coauthor, coauthorable: resource, organization: evaluator.component.organization,
|
|
63
|
+
skip_injection: evaluator.skip_injection)
|
|
71
64
|
end
|
|
72
65
|
end
|
|
73
66
|
end
|
|
@@ -28,7 +28,7 @@ module ActiveStorageMatchers
|
|
|
28
28
|
when :redirect, :representation
|
|
29
29
|
ActiveStorage::Blob.find_signed(key_match)
|
|
30
30
|
when :disk
|
|
31
|
-
decoded = ActiveStorage.verifier.verified(key_match, purpose: :blob_key)
|
|
31
|
+
decoded = ActiveStorage.verifier.verified(key_match, purpose: :blob_key).with_indifferent_access
|
|
32
32
|
ActiveStorage::Blob.find_by(key: decoded[:key]) if decoded
|
|
33
33
|
end
|
|
34
34
|
end
|
|
@@ -30,28 +30,21 @@ module Decidim
|
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
# Expected values: "", "2", "3", etc. (see parallel_tests documentation)
|
|
34
|
+
parallel_run_idx = ENV.fetch("TEST_ENV_NUMBER", "").to_i
|
|
35
|
+
parallel_run_idx -= 1 if parallel_run_idx.positive?
|
|
36
|
+
Capybara.server_port = 1.step do |num|
|
|
37
|
+
port = 4999 + num + (100 * parallel_run_idx)
|
|
38
|
+
next if port == 5432 # Reserved for PostgreSQL
|
|
35
39
|
next if port == 6379 # Reserved for Redis
|
|
36
40
|
|
|
41
|
+
# Make sure the port is not reserved by any other application.
|
|
37
42
|
begin
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if ParallelTests.last_process?
|
|
43
|
-
redis.del("decidim_test_capybara_reserved_ports")
|
|
44
|
-
else
|
|
45
|
-
redis.set("decidim_test_capybara_reserved_ports", reserved_ports.sort.join(","))
|
|
46
|
-
end
|
|
47
|
-
break
|
|
48
|
-
end
|
|
49
|
-
rescue Redis::CannotConnectError
|
|
50
|
-
# Redis is not available
|
|
51
|
-
break
|
|
43
|
+
Socket.tcp("127.0.0.1", port, connect_timeout: 5).close
|
|
44
|
+
warn "Port #{port} is already in use, trying another one."
|
|
45
|
+
rescue Errno::ECONNREFUSED
|
|
46
|
+
break port
|
|
52
47
|
end
|
|
53
|
-
ensure
|
|
54
|
-
Capybara.server_port = port
|
|
55
48
|
end
|
|
56
49
|
|
|
57
50
|
Capybara.register_driver :headless_chrome do |app|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module CommentsHelpers
|
|
4
4
|
def have_comment_from(user, text, opts = {})
|
|
5
5
|
within "#comments" do
|
|
6
|
-
have_content(
|
|
6
|
+
have_content(user.name, **opts).and have_content(text, **opts)
|
|
7
7
|
end
|
|
8
8
|
end
|
|
9
9
|
|
|
@@ -18,7 +18,7 @@ RSpec.configure do |config|
|
|
|
18
18
|
t.datetime :published_at
|
|
19
19
|
t.datetime :deleted_at
|
|
20
20
|
t.integer :coauthorships_count, null: false, default: 0
|
|
21
|
-
t.integer :
|
|
21
|
+
t.integer :likes_count, null: false, default: 0
|
|
22
22
|
t.integer :comments_count, null: false, default: 0
|
|
23
23
|
t.integer :follows_count, null: false, default: 0
|
|
24
24
|
|
|
@@ -53,7 +53,7 @@ RSpec.configure do |config|
|
|
|
53
53
|
t.datetime :published_at
|
|
54
54
|
t.datetime :deleted_at
|
|
55
55
|
t.integer :coauthorships_count, null: false, default: 0
|
|
56
|
-
t.integer :
|
|
56
|
+
t.integer :likes_count, null: false, default: 0
|
|
57
57
|
t.integer :comments_count, null: false, default: 0
|
|
58
58
|
|
|
59
59
|
t.references :decidim_component, index: false
|
|
@@ -114,103 +114,3 @@ shared_context "when managing a component as a process admin" do
|
|
|
114
114
|
participatory_process:)
|
|
115
115
|
end
|
|
116
116
|
end
|
|
117
|
-
|
|
118
|
-
shared_examples "add component resources to search index" do
|
|
119
|
-
let(:title) { translated(current_component.name) }
|
|
120
|
-
|
|
121
|
-
before do
|
|
122
|
-
resource.reload.component.manifest.run_hooks(:unpublish, resource.reload.component)
|
|
123
|
-
visit decidim_admin_participatory_processes.components_path(resource.reload.component.participatory_space)
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
around do |example|
|
|
127
|
-
perform_enqueued_jobs { example.run }
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
it "adds records to index" do
|
|
131
|
-
expect(Decidim::SearchableResource.where(resource:).count).to be_zero
|
|
132
|
-
|
|
133
|
-
within "tr", text: title do
|
|
134
|
-
click_on "Publish"
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
perform_enqueued_jobs
|
|
138
|
-
|
|
139
|
-
expect(page).to have_admin_callout("The component has been successfully published")
|
|
140
|
-
|
|
141
|
-
expect(component.reload).to be_published
|
|
142
|
-
expect(resource.reload).to be_visible
|
|
143
|
-
expect(Decidim::SearchableResource.where(resource:).count).to be_positive
|
|
144
|
-
end
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
shared_examples "removes component resources from search index" do
|
|
148
|
-
let(:title) { translated(current_component.name) }
|
|
149
|
-
|
|
150
|
-
before do
|
|
151
|
-
resource.reload.component.manifest.run_hooks(:publish, resource.reload.component)
|
|
152
|
-
visit decidim_admin_participatory_processes.components_path(resource.reload.component.participatory_space)
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
around do |example|
|
|
156
|
-
perform_enqueued_jobs { example.run }
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
it "removes records from index" do
|
|
160
|
-
expect(resource.reload.component).to be_published
|
|
161
|
-
expect(resource.component.participatory_space).to be_visible
|
|
162
|
-
expect(resource).to be_visible
|
|
163
|
-
expect(resource).to be_resource_visible
|
|
164
|
-
|
|
165
|
-
expect(Decidim::SearchableResource.where(resource:).count).to be_positive
|
|
166
|
-
|
|
167
|
-
within "tr", text: translated(current_component.name) do
|
|
168
|
-
click_on "Hide"
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
expect(component.reload).to be_published
|
|
172
|
-
expect(resource.reload).to be_visible
|
|
173
|
-
|
|
174
|
-
expect(Decidim::SearchableResource.where(resource:).count).to be_positive
|
|
175
|
-
|
|
176
|
-
within "tr", text: translated(current_component.name) do
|
|
177
|
-
click_on "Unpublish"
|
|
178
|
-
end
|
|
179
|
-
|
|
180
|
-
expect(page).to have_admin_callout("The component has been successfully unpublished")
|
|
181
|
-
|
|
182
|
-
expect(current_component.reload).not_to be_published
|
|
183
|
-
expect(resource.reload).not_to be_visible
|
|
184
|
-
expect(Decidim::SearchableResource.where(resource:).count).to be_zero
|
|
185
|
-
end
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
shared_examples "cycling through publication states" do
|
|
189
|
-
let(:title) { translated(current_component.name) }
|
|
190
|
-
|
|
191
|
-
it "works without raising errors" do
|
|
192
|
-
visit decidim_admin_participatory_processes.components_path(component.participatory_space)
|
|
193
|
-
|
|
194
|
-
within ".sidebar-menu" do
|
|
195
|
-
click_on "Components"
|
|
196
|
-
end
|
|
197
|
-
|
|
198
|
-
within "tr", text: title do
|
|
199
|
-
click_on "Hide"
|
|
200
|
-
end
|
|
201
|
-
|
|
202
|
-
expect(page).to have_admin_callout("The component has been successfully hidden from the menu.")
|
|
203
|
-
|
|
204
|
-
within "tr", text: title do
|
|
205
|
-
click_on "Unpublish"
|
|
206
|
-
end
|
|
207
|
-
|
|
208
|
-
expect(page).to have_admin_callout("The component has been successfully unpublished")
|
|
209
|
-
|
|
210
|
-
within "tr", text: title do
|
|
211
|
-
click_on "Publish"
|
|
212
|
-
end
|
|
213
|
-
|
|
214
|
-
expect(page).to have_admin_callout("The component has been successfully published")
|
|
215
|
-
end
|
|
216
|
-
end
|
|
@@ -1,32 +1,20 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
shared_context "with editor content containing
|
|
4
|
-
let(:hashtag) { create(:hashtag, organization:) }
|
|
5
|
-
let(:hashtag2) { create(:hashtag, organization:) }
|
|
3
|
+
shared_context "with editor content containing mentions" do
|
|
6
4
|
let(:user) { create(:user, :confirmed, organization:) }
|
|
7
5
|
let(:user2) { create(:user, :confirmed, organization:) }
|
|
8
|
-
let(:user_group) { create(:user_group, :confirmed, organization:) }
|
|
9
|
-
let(:user_group2) { create(:user_group, :confirmed, organization:) }
|
|
10
6
|
|
|
11
7
|
let(:html) do
|
|
12
8
|
<<~HTML
|
|
13
|
-
<p>Paragraph with a hashtag #{hashtag.to_global_id} and another hashtag #{hashtag2.to_global_id}</p>
|
|
14
9
|
<p>Paragraph with a user mention #{user.to_global_id} and another user mention #{user2.to_global_id}</p>
|
|
15
|
-
<p>Paragraph with a user group mention #{user_group.to_global_id} and another user group mention #{user_group2.to_global_id}</p>
|
|
16
10
|
HTML
|
|
17
11
|
end
|
|
18
12
|
let(:editor_html) do
|
|
19
13
|
<<~HTML
|
|
20
|
-
<p>Paragraph with a hashtag #{html_hashtag(hashtag)} and another hashtag #{html_hashtag(hashtag2)}</p>
|
|
21
14
|
<p>Paragraph with a user mention #{html_mention(user)} and another user mention #{html_mention(user2)}</p>
|
|
22
|
-
<p>Paragraph with a user group mention #{html_mention(user_group)} and another user group mention #{html_mention(user_group2)}</p>
|
|
23
15
|
HTML
|
|
24
16
|
end
|
|
25
17
|
|
|
26
|
-
def html_hashtag(hashtag)
|
|
27
|
-
%(<span data-type="hashtag" data-label="##{hashtag.name}">##{hashtag.name}</span>)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
18
|
def html_mention(mentionable)
|
|
31
19
|
mention = "@#{mentionable.nickname}"
|
|
32
20
|
label = "#{mention} (#{CGI.escapeHTML(mentionable.name)})"
|
|
@@ -134,6 +134,22 @@ module Decidim
|
|
|
134
134
|
JS
|
|
135
135
|
)
|
|
136
136
|
end
|
|
137
|
+
|
|
138
|
+
def select_text(selector)
|
|
139
|
+
page.execute_script(
|
|
140
|
+
<<~JS
|
|
141
|
+
var selection = document.getSelection();
|
|
142
|
+
var range = document.createRange();
|
|
143
|
+
var element = document.querySelector("#{selector}");
|
|
144
|
+
|
|
145
|
+
range.selectNodeContents(element);
|
|
146
|
+
selection.removeAllRanges();
|
|
147
|
+
selection.addRange(range);
|
|
148
|
+
document.dispatchEvent(new MouseEvent("selectstart"));
|
|
149
|
+
document.dispatchEvent(new MouseEvent("mouseup"));
|
|
150
|
+
JS
|
|
151
|
+
)
|
|
152
|
+
end
|
|
137
153
|
end
|
|
138
154
|
|
|
139
155
|
module FrontEndFileTestHelpers
|
|
@@ -40,22 +40,6 @@ module RakeTaskOutputHelpers
|
|
|
40
40
|
$stdout = original_stdout
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
|
-
|
|
44
|
-
def check_no_errors_have_been_printed
|
|
45
|
-
expect($stdout.string).not_to include("ERROR:")
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def check_some_errors_have_been_printed
|
|
49
|
-
expect($stdout.string).to include("ERROR:")
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def check_error_printed(type)
|
|
53
|
-
expect($stdout.string).to include("ERROR: [#{type}]")
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def check_message_printed(message)
|
|
57
|
-
expect($stdout.string).to include(message)
|
|
58
|
-
end
|
|
59
43
|
end
|
|
60
44
|
|
|
61
45
|
RSpec.configure do |config|
|
|
@@ -20,9 +20,9 @@ module ActionDispatch
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
# Add the file URI scheme so terminal emulators can open one click
|
|
23
|
-
def display_image
|
|
23
|
+
def display_image(html:, **)
|
|
24
24
|
message = "[Screenshot Image]: file://#{image_path}\n"
|
|
25
|
-
message << "[Screenshot HTML]: file://#{html_path}\n" if
|
|
25
|
+
message << "[Screenshot HTML]: file://#{html_path}\n" if html
|
|
26
26
|
|
|
27
27
|
case output_type
|
|
28
28
|
when "artifact"
|
|
@@ -6,12 +6,12 @@ RSpec.configure do |config|
|
|
|
6
6
|
raise "package.json file does not exist" unless Rails.root.join("package.json").exist?
|
|
7
7
|
raise "Node modules directory does not exist" unless Rails.root.join("node_modules").exist?
|
|
8
8
|
|
|
9
|
-
Dir.chdir(Rails.root) {
|
|
9
|
+
Dir.chdir(Rails.root) { Shakapacker.compile }
|
|
10
10
|
rescue Errno::ENOENT
|
|
11
11
|
node_modules_contents = `ls #{Rails.root.join("node_modules")}`
|
|
12
12
|
|
|
13
13
|
message = <<~ERROR
|
|
14
|
-
There was an error during the
|
|
14
|
+
There was an error during the Shakapacker compilation
|
|
15
15
|
#{"=" * 80}
|
|
16
16
|
Node version: #{`node -v`}
|
|
17
17
|
#{"=" * 80}
|
|
@@ -24,7 +24,7 @@ RSpec.configure do |config|
|
|
|
24
24
|
config.raise_errors_for_deprecations!
|
|
25
25
|
config.example_status_persistence_file_path = ".rspec-failures"
|
|
26
26
|
config.filter_run_when_matching :focus
|
|
27
|
-
config.profile_examples = 10
|
|
27
|
+
config.profile_examples = 10 unless ENV.fetch("CI", false)
|
|
28
28
|
config.default_formatter = "doc" if config.files_to_run.one?
|
|
29
29
|
|
|
30
30
|
# If you are not using ActiveRecord, or you'd prefer not to run each of your
|
data/lib/decidim/dev/version.rb
CHANGED
data/lib/decidim/dev.rb
CHANGED
|
@@ -15,8 +15,6 @@ require "decidim/dev/auth_engine"
|
|
|
15
15
|
# Also, to avoid further headaches :)
|
|
16
16
|
# require "decidim/dev/component"
|
|
17
17
|
|
|
18
|
-
require "decidim/dev/api"
|
|
19
|
-
|
|
20
18
|
module Decidim
|
|
21
19
|
# Decidim::Dev holds all the convenience logic and libraries to be able to
|
|
22
20
|
# create external libraries that create test apps and test themselves against
|
data/rubocop-decidim.yml
CHANGED
|
@@ -5,16 +5,24 @@
|
|
|
5
5
|
# For further details, see:
|
|
6
6
|
# https://github.com/rubocop/rubocop/issues/4154#issuecomment-316004878
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
plugins:
|
|
9
9
|
- rubocop-rubycw
|
|
10
|
-
- rubocop-capybara
|
|
11
|
-
- rubocop-factory_bot
|
|
12
10
|
|
|
13
11
|
inherit_from:
|
|
14
|
-
- config/rubocop/
|
|
15
|
-
- config/rubocop/
|
|
16
|
-
- config/rubocop/
|
|
17
|
-
- config/rubocop/
|
|
18
|
-
- config/rubocop/
|
|
19
|
-
- config/rubocop/
|
|
12
|
+
- config/rubocop/capybara/configuration.yml
|
|
13
|
+
- config/rubocop/capybara/disabled.yml
|
|
14
|
+
- config/rubocop/performance/configuration.yml
|
|
15
|
+
- config/rubocop/performance/disabled.yml
|
|
16
|
+
- config/rubocop/ruby/configuration.yml
|
|
17
|
+
- config/rubocop/ruby/disabled.yml
|
|
18
|
+
- config/rubocop/rails/configuration.yml
|
|
19
|
+
- config/rubocop/rails/disabled.yml
|
|
20
|
+
- config/rubocop/rspec/configuration.yml
|
|
21
|
+
- config/rubocop/rspec/disabled.yml
|
|
22
|
+
- config/rubocop/faker/configuration.yml
|
|
23
|
+
- config/rubocop/faker/disabled.yml
|
|
24
|
+
- config/rubocop/graphql/configuration.yml
|
|
25
|
+
- config/rubocop/graphql/disabled.yml
|
|
26
|
+
- config/rubocop/factory_bot/configuration.yml
|
|
27
|
+
- config/rubocop/factory_bot/disabled.yml
|
|
20
28
|
- config/rubocop/disabled.yml
|