decidim-dev 0.26.2 → 0.27.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/commands/decidim/dummy_resources/create_dummy_resource.rb +1 -1
- data/app/controllers/concerns/decidim/dev/needs_development_tools.rb +1 -1
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +1 -0
- data/config/locales/bg.yml +1 -0
- data/config/locales/ca.yml +1 -0
- data/config/locales/cs.yml +1 -0
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +1 -0
- data/config/locales/el.yml +1 -0
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +1 -0
- data/config/locales/es-PY.yml +1 -0
- data/config/locales/es.yml +1 -0
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +1 -0
- data/config/locales/fi-plain.yml +1 -0
- data/config/locales/fi.yml +1 -0
- data/config/locales/fr-CA.yml +1 -0
- data/config/locales/fr.yml +1 -0
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +1 -0
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +1 -0
- data/config/locales/id-ID.yml +1 -0
- data/config/locales/is-IS.yml +2 -1
- data/config/locales/it.yml +1 -0
- data/config/locales/ja.yml +1 -0
- data/config/locales/ko.yml +1 -0
- data/config/locales/lb.yml +1 -0
- data/config/locales/lt.yml +1 -0
- data/config/locales/lv.yml +1 -0
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +1 -0
- data/config/locales/no.yml +1 -0
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +1 -0
- data/config/locales/pt-BR.yml +2 -1
- data/config/locales/pt.yml +1 -0
- data/config/locales/ro-RO.yml +1 -0
- data/config/locales/ru.yml +1 -0
- data/config/locales/si-LK.yml +1 -0
- data/config/locales/sk.yml +1 -0
- data/config/locales/sl.yml +1 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +1 -0
- data/config/locales/sv.yml +1 -0
- data/config/locales/sw-KE.yml +1 -0
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +1 -0
- data/config/locales/uk.yml +1 -0
- data/config/locales/val-ES.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +1 -0
- data/config/locales/zh-TW.yml +1 -0
- data/lib/decidim/dev/assets/geocoder_result_here.json +46 -67
- data/lib/decidim/dev/assets/logo.png +0 -0
- data/lib/decidim/dev/common_rake.rb +1 -0
- data/lib/decidim/dev/railtie.rb +1 -1
- data/lib/decidim/dev/test/base_spec_helper.rb +2 -1
- data/lib/decidim/dev/test/rspec_support/attachment_helpers.rb +30 -0
- data/lib/decidim/dev/test/rspec_support/autocomplete_select.rb +23 -0
- data/lib/decidim/dev/test/rspec_support/capybara.rb +43 -5
- data/lib/decidim/dev/test/rspec_support/comments.rb +1 -1
- data/lib/decidim/dev/test/rspec_support/component.rb +5 -5
- data/lib/decidim/dev/test/rspec_support/controller_example_group.rb +27 -0
- data/lib/decidim/dev/test/rspec_support/cookies.rb +41 -0
- data/lib/decidim/dev/test/rspec_support/dynamic_attach.rb +31 -0
- data/lib/decidim/dev/test/rspec_support/frontend.rb +1 -1
- data/lib/decidim/dev/test/rspec_support/geocoder.rb +6 -2
- data/lib/decidim/dev/test/rspec_support/html_matchers.rb +11 -0
- data/lib/decidim/dev/test/rspec_support/imports_controller_shared_examples.rb +3 -8
- data/lib/decidim/dev/test/rspec_support/network_conditions_helpers.rb +18 -0
- data/lib/decidim/dev/test/rspec_support/rake_tasks.rb +0 -2
- data/lib/decidim/dev/test/rspec_support/screenshot_helper.rb +41 -0
- data/lib/decidim/dev/test/rspec_support/warden.rb +5 -0
- data/lib/decidim/dev/test/rspec_support/wicked_pdf_assets_mock.rb +4 -0
- data/lib/decidim/dev/test/spec_helper.rb +2 -4
- data/lib/decidim/dev/test/w3c_rspec_validators_overrides.rb +0 -2
- data/lib/decidim/dev/version.rb +1 -1
- data/lib/decidim-dev.rb +1 -1
- data/lib/tasks/generators.rake +6 -2
- data/lib/tasks/lighthouse_report.rake +29 -0
- data/lib/tasks/locale_checker.rake +1 -1
- metadata +48 -41
- data/lib/decidim/dev/test/rspec_support/react_select.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 352297a2285a46b08d1d758ef879cb997dd0c4cd6fc5d4413a3db9503ba04a24
|
4
|
+
data.tar.gz: '0099b3b7b5e6566b5f3f3dfb1c44cbf5e3e871b976e8e453d3d668e2a4f161cb'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dff37974008ead98152ef3f156e3f73e082af7477c72c84c0f5e8f18204510d3a3c46605a88842289da7a57e228e2f2da3744d9aab59de2497f8aca5e5075e9
|
7
|
+
data.tar.gz: ed2983e1a820fa3686cf6f5a7cae8d64d9aaf4e473ccda2952f291d795ffe87f95555864d30c56b91523a4ce0ee003b1d1dd3eefa8226c96266ea2a59b183537
|
@@ -18,7 +18,7 @@ module Decidim
|
|
18
18
|
return unless respond_to?(:snippets)
|
19
19
|
|
20
20
|
snippets.add(:head, helpers.stylesheet_pack_tag("decidim_dev"))
|
21
|
-
snippets.add(:
|
21
|
+
snippets.add(:foot, helpers.javascript_pack_tag("decidim_dev", defer: false))
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
data/config/locales/am-ET.yml
CHANGED
data/config/locales/ar.yml
CHANGED
data/config/locales/bg.yml
CHANGED
data/config/locales/ca.yml
CHANGED
data/config/locales/cs.yml
CHANGED
data/config/locales/da.yml
CHANGED
data/config/locales/de.yml
CHANGED
data/config/locales/el.yml
CHANGED
data/config/locales/eo.yml
CHANGED
data/config/locales/es-MX.yml
CHANGED
data/config/locales/es-PY.yml
CHANGED
data/config/locales/es.yml
CHANGED
data/config/locales/et.yml
CHANGED
data/config/locales/eu.yml
CHANGED
data/config/locales/fi-plain.yml
CHANGED
data/config/locales/fi.yml
CHANGED
data/config/locales/fr-CA.yml
CHANGED
data/config/locales/fr.yml
CHANGED
data/config/locales/ga-IE.yml
CHANGED
data/config/locales/gl.yml
CHANGED
data/config/locales/hr.yml
CHANGED
data/config/locales/hu.yml
CHANGED
data/config/locales/id-ID.yml
CHANGED
data/config/locales/is-IS.yml
CHANGED
data/config/locales/it.yml
CHANGED
data/config/locales/ja.yml
CHANGED
data/config/locales/ko.yml
CHANGED
data/config/locales/lb.yml
CHANGED
data/config/locales/lt.yml
CHANGED
data/config/locales/lv.yml
CHANGED
data/config/locales/mt.yml
CHANGED
data/config/locales/nl.yml
CHANGED
data/config/locales/no.yml
CHANGED
data/config/locales/om-ET.yml
CHANGED
data/config/locales/pl.yml
CHANGED
data/config/locales/pt-BR.yml
CHANGED
data/config/locales/pt.yml
CHANGED
data/config/locales/ro-RO.yml
CHANGED
data/config/locales/ru.yml
CHANGED
data/config/locales/si-LK.yml
CHANGED
data/config/locales/sk.yml
CHANGED
data/config/locales/sl.yml
CHANGED
data/config/locales/so-SO.yml
CHANGED
data/config/locales/sr-CS.yml
CHANGED
data/config/locales/sv.yml
CHANGED
data/config/locales/sw-KE.yml
CHANGED
data/config/locales/ti-ER.yml
CHANGED
data/config/locales/tr-TR.yml
CHANGED
data/config/locales/uk.yml
CHANGED
data/config/locales/val-ES.yml
CHANGED
data/config/locales/vi.yml
CHANGED
data/config/locales/zh-CN.yml
CHANGED
data/config/locales/zh-TW.yml
CHANGED
@@ -1,72 +1,51 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
"items": [
|
3
|
+
{
|
4
|
+
"title": "5 Rue Daunou, 75002 Paris, France",
|
5
|
+
"id": "here:af:streetsection:bI4Le6cyA.1mlQyLunYpjC:CggIBCCi-9SPARABGgE1KGQ",
|
6
|
+
"resultType": "houseNumber",
|
7
|
+
"houseNumberType": "PA",
|
8
|
+
"address": {
|
9
|
+
"label": "5 Rue Daunou, 75002 Paris, France",
|
10
|
+
"countryCode": "FRA",
|
11
|
+
"countryName": "France",
|
12
|
+
"stateCode": "IDF",
|
13
|
+
"state": "Île-de-France",
|
14
|
+
"county": "Paris",
|
15
|
+
"city": "Paris",
|
16
|
+
"district": "2e Arrondissement",
|
17
|
+
"street": "Rue Daunou",
|
18
|
+
"postalCode": "75002",
|
19
|
+
"houseNumber": "5"
|
5
20
|
},
|
6
|
-
"
|
21
|
+
"position": {
|
22
|
+
"lat": 48.86926,
|
23
|
+
"lng": 2.3321
|
24
|
+
},
|
25
|
+
"access": [
|
7
26
|
{
|
8
|
-
"
|
9
|
-
"
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
"Longitude": -73.9933777
|
29
|
-
},
|
30
|
-
"NavigationPosition": [
|
31
|
-
{
|
32
|
-
"Latitude": 40.7500305,
|
33
|
-
"Longitude": -73.9942398
|
34
|
-
}
|
35
|
-
],
|
36
|
-
"MapView": {
|
37
|
-
"TopLeft": {
|
38
|
-
"Latitude": 40.7515934,
|
39
|
-
"Longitude": -73.9948616
|
40
|
-
},
|
41
|
-
"BottomRight": {
|
42
|
-
"Latitude": 40.7493451,
|
43
|
-
"Longitude": -73.9918938
|
44
|
-
}
|
45
|
-
},
|
46
|
-
"Address": {
|
47
|
-
"Label": "4 Penn Plz, New York, NY 10001, United States",
|
48
|
-
"Country": "USA",
|
49
|
-
"State": "NY",
|
50
|
-
"County": "New York",
|
51
|
-
"City": "New York",
|
52
|
-
"Street": "Penn Plz",
|
53
|
-
"HouseNumber": "4",
|
54
|
-
"PostalCode": "10001",
|
55
|
-
"AdditionalData": [
|
56
|
-
{
|
57
|
-
"value": "United States",
|
58
|
-
"key": "CountryName"
|
59
|
-
},
|
60
|
-
{
|
61
|
-
"value": "New York",
|
62
|
-
"key": "StateName"
|
63
|
-
}
|
64
|
-
]
|
65
|
-
}
|
66
|
-
}
|
67
|
-
}
|
68
|
-
]
|
27
|
+
"lat": 48.86931,
|
28
|
+
"lng": 2.33215
|
29
|
+
}
|
30
|
+
],
|
31
|
+
"mapView": {
|
32
|
+
"west": 2.33073,
|
33
|
+
"south": 48.86836,
|
34
|
+
"east": 2.33347,
|
35
|
+
"north": 48.87016
|
36
|
+
},
|
37
|
+
"scoring": {
|
38
|
+
"queryScore": 0.97,
|
39
|
+
"fieldScore": {
|
40
|
+
"country": 1,
|
41
|
+
"city": 1,
|
42
|
+
"streets": [
|
43
|
+
1
|
44
|
+
],
|
45
|
+
"houseNumber": 1,
|
46
|
+
"postalCode": 0.82
|
69
47
|
}
|
70
|
-
|
48
|
+
}
|
71
49
|
}
|
72
|
-
|
50
|
+
]
|
51
|
+
}
|
Binary file
|
data/lib/decidim/dev/railtie.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require "decidim/dev"
|
4
4
|
|
5
5
|
ENV["RAILS_ENV"] ||= "test"
|
6
|
+
ENV["RAILS_SYSTEM_TESTING_SCREENSHOT_HTML"] ||= "1"
|
6
7
|
|
7
8
|
engine_spec_dir = File.join(Dir.pwd, "spec")
|
8
9
|
|
@@ -18,7 +19,7 @@ require_relative "rspec_support/authorization"
|
|
18
19
|
|
19
20
|
require "#{Decidim::Dev.dummy_app_path}/config/environment"
|
20
21
|
|
21
|
-
Dir["#{engine_spec_dir}/shared/**/*.rb"].
|
22
|
+
Dir["#{engine_spec_dir}/shared/**/*.rb"].each { |f| require f }
|
22
23
|
|
23
24
|
require "paper_trail/frameworks/rspec"
|
24
25
|
|
@@ -9,6 +9,36 @@ module AttachmentHelpers
|
|
9
9
|
def attachment_file_size(attachment)
|
10
10
|
ActiveSupport::NumberHelper.number_to_human_size(attachment.file_size)
|
11
11
|
end
|
12
|
+
|
13
|
+
# Creates ActiveStorage::Blob object and returns its signed_id
|
14
|
+
# Used in non-system tests that need files.
|
15
|
+
def upload_test_file(file, options = {})
|
16
|
+
filename = options[:filename] || upload_test_file_filename(file)
|
17
|
+
content_type = options[:content_type] || upload_test_file_content_type(file)
|
18
|
+
|
19
|
+
blob = ActiveStorage::Blob.create_and_upload!(
|
20
|
+
io: File.open(file),
|
21
|
+
filename: filename,
|
22
|
+
content_type: content_type
|
23
|
+
)
|
24
|
+
return blob if options[:return_blob]
|
25
|
+
|
26
|
+
blob.signed_id
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def upload_test_file_filename(file)
|
32
|
+
return file.original_filename if file.respond_to? :original_filename
|
33
|
+
|
34
|
+
file.split("/").last
|
35
|
+
end
|
36
|
+
|
37
|
+
def upload_test_file_content_type(file)
|
38
|
+
return file.content_type if file.respond_to? :content_type
|
39
|
+
|
40
|
+
MIME::Types.type_for(file).first.content_type
|
41
|
+
end
|
12
42
|
end
|
13
43
|
|
14
44
|
RSpec.configure do |config|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Capybara
|
4
|
+
module AutoCompleteJS
|
5
|
+
def autocomplete_select(value, from:)
|
6
|
+
within("div[data-autocomplete-for='#{from}']") do
|
7
|
+
find(".autocomplete-input").click
|
8
|
+
find(".autocomplete-input").native.send_keys(value[0..4])
|
9
|
+
expect(page).to have_css("#autoComplete_list_1") # select should be open now
|
10
|
+
|
11
|
+
expect(page).to have_css("#autoComplete_result_0", text: value)
|
12
|
+
find("#autoComplete_result_0", text: value).hover
|
13
|
+
expect(page).to have_css("#autoComplete_result_0", text: value)
|
14
|
+
find("#autoComplete_result_0", text: value).click
|
15
|
+
expect(page).to have_css(".autocomplete__selected-item", text: value)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
RSpec.configure do |config|
|
22
|
+
config.include Capybara::AutoCompleteJS, type: :system
|
23
|
+
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "selenium-webdriver"
|
4
|
-
require "system_test_html_screenshots"
|
5
4
|
|
6
5
|
module Decidim
|
7
6
|
# Helpers meant to be used only during capybara test runs.
|
@@ -32,11 +31,40 @@ Capybara.register_driver :headless_chrome do |app|
|
|
32
31
|
else
|
33
32
|
"--window-size=1920,1080"
|
34
33
|
end
|
34
|
+
Capybara::Selenium::Driver.new(
|
35
|
+
app,
|
36
|
+
browser: :chrome,
|
37
|
+
capabilities: [options]
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
Capybara.server_port = rand(5000..6999)
|
42
|
+
|
43
|
+
# In order to work with PWA apps, Chrome can't be run in headless mode, and requires
|
44
|
+
# setting up special prefs and flags
|
45
|
+
Capybara.register_driver :pwa_chrome do |app|
|
46
|
+
options = ::Selenium::WebDriver::Chrome::Options.new
|
47
|
+
options.args << "--no-sandbox"
|
48
|
+
# Don't limit browser resources
|
49
|
+
options.args << "--disable-dev-shm-usage"
|
50
|
+
# Add pwa.lvh.me host as a secure origin
|
51
|
+
options.args << "--unsafely-treat-insecure-origin-as-secure=http://pwa.lvh.me:#{Capybara.server_port}"
|
52
|
+
# User data flag is mandatory when preferences and locale state is set
|
53
|
+
options.args << "--user-data-dir=/tmp/decidim_tests_user_data_#{rand(1000)}"
|
54
|
+
options.args << if ENV["BIG_SCREEN_SIZE"].present?
|
55
|
+
"--window-size=1920,3000"
|
56
|
+
else
|
57
|
+
"--window-size=1920,1080"
|
58
|
+
end
|
59
|
+
# Set notifications allowed in http protocol
|
60
|
+
options.local_state["browser.enabled_labs_experiments"] = ["enable-system-notifications@1", "unsafely-treat-insecure-origin-as-secure"]
|
61
|
+
# Mark notification permission as enabled
|
62
|
+
options.prefs["profile.default_content_setting_values.notifications"] = 1
|
35
63
|
|
36
64
|
Capybara::Selenium::Driver.new(
|
37
65
|
app,
|
38
66
|
browser: :chrome,
|
39
|
-
|
67
|
+
capabilities: [options]
|
40
68
|
)
|
41
69
|
end
|
42
70
|
|
@@ -49,11 +77,11 @@ Capybara.register_driver :iphone do |app|
|
|
49
77
|
Capybara::Selenium::Driver.new(
|
50
78
|
app,
|
51
79
|
browser: :chrome,
|
52
|
-
|
80
|
+
capabilities: [options]
|
53
81
|
)
|
54
82
|
end
|
55
83
|
|
56
|
-
Capybara.server = :puma, { Silent: true,
|
84
|
+
Capybara.server = :puma, { Silent: true, queue_requests: false }
|
57
85
|
|
58
86
|
Capybara.asset_host = "http://localhost:3000"
|
59
87
|
|
@@ -65,6 +93,16 @@ RSpec.configure do |config|
|
|
65
93
|
config.before :each, type: :system do
|
66
94
|
driven_by(:headless_chrome)
|
67
95
|
switch_to_default_host
|
96
|
+
domain = (try(:organization) || try(:current_organization))&.host
|
97
|
+
if domain
|
98
|
+
page.driver.browser.execute_cdp(
|
99
|
+
"Network.setCookie",
|
100
|
+
domain: domain,
|
101
|
+
name: Decidim.consent_cookie_name,
|
102
|
+
value: { essential: true }.to_json,
|
103
|
+
path: "/"
|
104
|
+
)
|
105
|
+
end
|
68
106
|
end
|
69
107
|
|
70
108
|
config.before :each, driver: :rack_test do
|
@@ -80,7 +118,7 @@ RSpec.configure do |config|
|
|
80
118
|
end
|
81
119
|
|
82
120
|
config.after(type: :system) do |example|
|
83
|
-
warn page.driver.browser.
|
121
|
+
warn page.driver.browser.logs.get(:browser) unless example.metadata[:driver].eql?(:rack_test)
|
84
122
|
end
|
85
123
|
|
86
124
|
config.include Decidim::CapybaraTestHelpers, type: :system
|