decidim-dev 0.28.0 → 0.28.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d771cf6c51fc798d8cbf1d938245c3f52e67cb8404f666e044250a93e92210c7
4
- data.tar.gz: b5dec2927ed2a0e397e9d5c0a9b303a27add20a71508229812c7ca0e5b4a982e
3
+ metadata.gz: 9a0788fcddc027172a756f2875f4f43b9a85894e2ded6a39ea04c8b81098862c
4
+ data.tar.gz: cadcdd86dcf27af64737df7903cca1f371441cc5ed8edf0513f96d98fab10a2f
5
5
  SHA512:
6
- metadata.gz: 166cf877812db4d03c99d2a23df8d449800dadca22e05b0de418d3fad4f7e56202fcf730c00f753e73862eef11a7aa372fe9dec2cbf0404aee29703458b70cd2
7
- data.tar.gz: 2cbeeb10ec359e66619fdb5780bf5643c7c9de663da470b50102e84c0a99e83b51d8ef7a1b3d2133aa99baaaa5f2c2500760f98dda31914d50d1ae179fd10d37
6
+ metadata.gz: '059463876ce9e8ab637bb92aac43f23c230abd154b2e9e8f35ca0a977ecf1e29bca378b977fb36057e812b75b6ae248623845cc50ea6ed0b6598c41c74f02341'
7
+ data.tar.gz: 25db9b82f0290f6dbd0897407684722ecad962092a30b825e120cc76f0f0ae4c330c0191d31c002db810a2606fa79102724e25325a11fe7dec38a2efb952ac8c
@@ -0,0 +1 @@
1
+ he:
@@ -20,8 +20,8 @@ hu:
20
20
  bar: Oszlop
21
21
  foo: foo
22
22
  step:
23
- endorsements_blocked: Jóváhagyások letiltva
24
- endorsements_enabled: Jóváhagyások engedélyezve
23
+ endorsements_blocked: Támogatások letiltva
24
+ endorsements_enabled: Támogatások engedélyezve
25
25
  test_options:
26
26
  bar: Oszlop
27
27
  foo: foo
@@ -15,6 +15,12 @@ pl:
15
15
  dummy:
16
16
  settings:
17
17
  global:
18
+ guided: Kierowane wprowadzanie danych
19
+ guided_help: Tekst pomocy
20
+ guided_readonly: Zablokowane pole wprowadzania danych
21
+ guided_rich: Kierowane i rozbudowane wprowadzanie danych
22
+ guided_rich_help_html: Tekst HTML <strong>pomocy</strong>
23
+ guided_rich_readonly_html: Treść HTML <strong>pomocy</strong> dla wyłączonego wprowadzania
18
24
  readonly_attribute: Atrybut tylko do odczytu
19
25
  test: Test A
20
26
  test_choices:
@@ -23,6 +29,7 @@ pl:
23
29
  c: Opcja C
24
30
  test_options:
25
31
  bar: Bar
32
+ baz: Baz
26
33
  foo: Foo
27
34
  step:
28
35
  endorsements_blocked: Możliwość rekomendacji zablokowana
@@ -30,6 +37,7 @@ pl:
30
37
  readonly_step_attribute: Atrybut kroku tylko do odczytu
31
38
  test_options:
32
39
  bar: Bar
40
+ baz: Baz
33
41
  foo: Foo
34
42
  dummy:
35
43
  admin:
@@ -45,6 +53,7 @@ pl:
45
53
  description_own: Utworzyłeś %{score} testów.
46
54
  name: Testy
47
55
  next_level_in: Stwórz %{score} dodatkowych testów, aby przejść do następnego poziomu!
56
+ unearned_another: Ten uczestnik nie utworzył jeszcze żadnych testów.
48
57
  unearned_own: Nie stworzyłeś jeszcze żadnych testów.
49
58
  resource_links:
50
59
  test_link:
@@ -29,6 +29,7 @@ pt-BR:
29
29
  c: Escolha C
30
30
  test_options:
31
31
  bar: Bar
32
+ baz: Baz
32
33
  foo: Foo
33
34
  step:
34
35
  endorsements_blocked: Endossos bloqueados
@@ -36,6 +37,7 @@ pt-BR:
36
37
  readonly_step_attribute: Atributo passo somente leitura
37
38
  test_options:
38
39
  bar: Bar
40
+ baz: Baz
39
41
  foo: Foo
40
42
  dummy:
41
43
  admin:
@@ -51,6 +53,7 @@ pt-BR:
51
53
  description_own: Você criou %{score} testes.
52
54
  name: Testes
53
55
  next_level_in: Crie mais %{score} testes para alcançar o próximo nível!
56
+ unearned_another: Este participante ainda não criou nenhum teste ainda.
54
57
  unearned_own: Você não criou testes ainda.
55
58
  resource_links:
56
59
  test_link:
@@ -5,6 +5,10 @@ require: rubocop-rspec
5
5
  # - "(?:^|/)spec/"
6
6
  # - "(?:^|/)test/"
7
7
 
8
+ RSpec/FilePath:
9
+ CustomTransform:
10
+ OAuthApplicationPresenter: oauth_application_presenter
11
+
8
12
  RSpec/BeforeAfterAll:
9
13
  Enabled: true
10
14
 
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path("lib", __dir__)
4
+
5
+ # Maintain your gem's version:
6
+ require "decidim/dev/version"
7
+
8
+ # Describe your gem and declare its dependencies:
9
+ Gem::Specification.new do |s|
10
+ s.version = Decidim::Dev.version
11
+ s.authors = ["Josep Jaume Rey Peroy", "Marc Riera Casals", "Oriol Gual Oliva"]
12
+ s.email = ["josepjaume@gmail.com", "mrc2407@gmail.com", "oriolgual@gmail.com"]
13
+ s.license = "AGPL-3.0"
14
+ s.homepage = "https://decidim.org"
15
+ s.metadata = {
16
+ "bug_tracker_uri" => "https://github.com/decidim/decidim/issues",
17
+ "documentation_uri" => "https://docs.decidim.org/",
18
+ "funding_uri" => "https://opencollective.com/decidim",
19
+ "homepage_uri" => "https://decidim.org",
20
+ "source_code_uri" => "https://github.com/decidim/decidim"
21
+ }
22
+ s.required_ruby_version = "~> 3.1.0"
23
+
24
+ s.name = "decidim-dev"
25
+ s.summary = "Decidim dev tools"
26
+ s.description = "Utilities and tools we need to develop Decidim"
27
+
28
+ s.files = Dir.chdir(__dir__) do
29
+ `git ls-files -z`.split("\x0").select do |f|
30
+ (File.expand_path(f) == __FILE__) ||
31
+ f.start_with?(*%w(app/ config/ db/ lib/ Rakefile README.md rubocop-decidim.yml))
32
+ end
33
+ end
34
+
35
+ s.add_dependency "capybara", "~> 3.39"
36
+ s.add_dependency "decidim", Decidim::Dev.version
37
+ s.add_dependency "factory_bot_rails", "~> 6.2"
38
+ s.add_dependency "faker", "~> 3.2"
39
+
40
+ s.add_dependency "bullet", "~> 7.0"
41
+ s.add_dependency "byebug", "~> 11.0"
42
+ s.add_dependency "erb_lint", "~> 0.4.0"
43
+ s.add_dependency "i18n-tasks", "~> 1.0"
44
+ s.add_dependency "nokogiri", "~> 1.14", ">= 1.14.3"
45
+ s.add_dependency "parallel_tests", "~> 4.2"
46
+ s.add_dependency "puma", "~> 6.2", ">= 6.3.1"
47
+ s.add_dependency "rails-controller-testing", "~> 1.0"
48
+ s.add_dependency "rspec", "~> 3.12"
49
+ s.add_dependency "rspec-cells", "~> 0.3.7"
50
+ s.add_dependency "rspec-html-matchers", "~> 0.10"
51
+ s.add_dependency "rspec_junit_formatter", "~> 0.6.0"
52
+ s.add_dependency "rspec-rails", "~> 6.0"
53
+ s.add_dependency "rspec-retry", "~> 0.6.2"
54
+ s.add_dependency "rubocop", "~> 1.50.0"
55
+ s.add_dependency "rubocop-faker", "~> 1.1"
56
+ s.add_dependency "rubocop-rails", "~> 2.19"
57
+ s.add_dependency "rubocop-rspec", "~> 2.20"
58
+ s.add_dependency "selenium-webdriver", "~> 4.9"
59
+ s.add_dependency "simplecov", "~> 0.22.0"
60
+ s.add_dependency "simplecov-cobertura", "~> 2.1.0"
61
+ s.add_dependency "w3c_rspec_validators", "~> 0.3.0"
62
+ s.add_dependency "webmock", "~> 3.18"
63
+ s.add_dependency "wisper-rspec", "~> 1.0"
64
+ end
@@ -4,53 +4,63 @@ require "decidim/components/namer"
4
4
 
5
5
  FactoryBot.define do
6
6
  factory :dummy_component, parent: :component do
7
- name { Decidim::Components::Namer.new(participatory_space.organization.available_locales, :surveys).i18n_name }
7
+ transient do
8
+ skip_injection { false }
9
+ end
10
+ name { generate_component_name(participatory_space.organization.available_locales, :surveys, skip_injection:) }
8
11
  manifest_name { :dummy }
9
12
  end
10
13
 
11
14
  factory :dummy_resource, class: "Decidim::Dev::DummyResource" do
12
15
  transient do
16
+ skip_injection { false }
13
17
  users { nil }
14
18
  # user_groups correspondence to users is by sorting order
15
19
  user_groups { [] }
16
20
  end
17
- title { Decidim::Faker::Localized.localized { generate(:name) } }
18
- component { create(:component, manifest_name: "dummy") }
19
- author { create(:user, :confirmed, organization: component.organization) }
20
- scope { create(:scope, organization: component.organization) }
21
+ title { generate_localized_title(:dummy_resource_title, skip_injection:) }
22
+ component { create(:dummy_component, skip_injection:) }
23
+ author { create(:user, :confirmed, organization: component.organization, skip_injection:) }
24
+ scope { create(:scope, organization: component.organization, skip_injection:) }
21
25
 
22
26
  trait :published do
23
27
  published_at { Time.current }
24
28
  end
25
29
 
26
30
  trait :with_endorsements do
27
- after :create do |resource|
31
+ after :create do |resource, evaluator|
28
32
  5.times.collect do
29
- create(:endorsement, resource:, author: build(:user, organization: resource.component.organization))
33
+ create(:endorsement, resource:, skip_injection: evaluator.skip_injection,
34
+ author: build(:user, organization: resource.component.organization, skip_injection: evaluator.skip_injection))
30
35
  end
31
36
  end
32
37
  end
33
38
  end
34
39
 
35
40
  factory :nested_dummy_resource, class: "Decidim::Dev::NestedDummyResource" do
41
+ transient do
42
+ skip_injection { false }
43
+ end
36
44
  title { generate(:name) }
37
45
  dummy_resource { create(:dummy_resource) }
38
46
  end
39
47
 
40
48
  factory :coauthorable_dummy_resource, class: "Decidim::Dev::CoauthorableDummyResource" do
41
- title { generate(:name) }
42
- component { create(:component, manifest_name: "dummy") }
43
-
44
49
  transient do
45
- authors_list { [create(:user, organization: component.organization)] }
50
+ skip_injection { false }
51
+ authors_list { [create(:user, organization: component.organization, skip_injection:)] }
46
52
  end
53
+ title { generate(:name) }
54
+ component { create(:component, manifest_name: "dummy") }
47
55
 
48
56
  after :build do |resource, evaluator|
49
57
  evaluator.authors_list.each do |coauthor|
50
58
  resource.coauthorships << if coauthor.is_a?(Decidim::UserGroup)
51
- build(:coauthorship, author: coauthor.users.first, user_group: coauthor, coauthorable: resource, organization: evaluator.component.organization)
59
+ build(:coauthorship, author: coauthor.users.first, user_group: coauthor, coauthorable: resource,
60
+ organization: evaluator.component.organization, skip_injection: evaluator.skip_injection)
52
61
  else
53
- build(:coauthorship, author: coauthor, coauthorable: resource, organization: evaluator.component.organization)
62
+ build(:coauthorship, author: coauthor, coauthorable: resource, organization: evaluator.component.organization,
63
+ skip_injection: evaluator.skip_injection)
54
64
  end
55
65
  end
56
66
  end
@@ -32,6 +32,7 @@ end
32
32
  port = rand(5000..6999)
33
33
  begin
34
34
  Socket.tcp("127.0.0.1", port, connect_timeout: 5).close
35
+ warn "Port #{port} is already in use, trying another one."
35
36
  rescue Errno::ECONNREFUSED
36
37
  # When connection is refused, the port is available for use.
37
38
  Capybara.server_port = port
@@ -42,7 +43,9 @@ end
42
43
  Capybara.register_driver :headless_chrome do |app|
43
44
  options = Selenium::WebDriver::Chrome::Options.new
44
45
  options.args << "--explicitly-allowed-ports=#{Capybara.server_port}"
45
- options.args << "--headless"
46
+ options.args << "--headless=new"
47
+ # Do not limit browser resources
48
+ options.args << "--disable-dev-shm-usage"
46
49
  options.args << "--no-sandbox"
47
50
  options.args << if ENV["BIG_SCREEN_SIZE"].present?
48
51
  "--window-size=1920,3000"
@@ -91,8 +94,10 @@ end
91
94
 
92
95
  Capybara.register_driver :iphone do |app|
93
96
  options = Selenium::WebDriver::Chrome::Options.new
94
- options.args << "--headless"
97
+ options.args << "--headless=new"
95
98
  options.args << "--no-sandbox"
99
+ # Do not limit browser resources
100
+ options.args << "--disable-dev-shm-usage"
96
101
  options.add_emulation(device_name: "iPhone 6")
97
102
 
98
103
  Capybara::Selenium::Driver.new(
@@ -120,8 +125,33 @@ Capybara.server_errors = [SyntaxError, StandardError]
120
125
  Capybara.default_max_wait_time = 10
121
126
 
122
127
  RSpec.configure do |config|
128
+ config.before :all, type: :system do
129
+ if ENV["BIG_SCREEN_SIZE"].present?
130
+ warn "[DECIDIM] ChromeDriver Workaround is being active: Setting window size to 1920x3000."
131
+ else
132
+ warn "[DECIDIM] ChromeDriver Workaround is being active: Setting window size to 1920x1080."
133
+ end
134
+ end
135
+
123
136
  config.before :each, type: :system do
124
137
  driven_by(:headless_chrome)
138
+
139
+ # Workaround for flaky spec related to resolution change
140
+ #
141
+ # For some unknown reason, depending on the order run for these specs, the resolution is changed to
142
+ # 800x600, which breaks the drag and drop. This forces the resolution to be 1920x1080.
143
+ # One possible culprit for the screen resolution change is the alert error intercepting which messes with the window focus.
144
+ # This has been reported to SeleniumHQ, https://github.com/SeleniumHQ/selenium/issues/13553
145
+ # and to the chromedriver project, https://bugs.chromium.org/p/chromedriver/issues/detail?id=4709
146
+ #
147
+ # Note to future maintainers: If you remove this workaround, please make sure to check if the issue has been fixed.
148
+ # If that is the case, please remove this comment, workaround, and the above warning that starts with "[DECIDIM] ChromeDriver Workaround".
149
+ if ENV["BIG_SCREEN_SIZE"].present?
150
+ current_window.resize_to(1920, 3000)
151
+ else
152
+ current_window.resize_to(1920, 1080)
153
+ end
154
+
125
155
  switch_to_default_host
126
156
  domain = (try(:organization) || try(:current_organization))&.host
127
157
  if domain
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Note that RSpec also provides `uses_transaction` but it needs to be specific
4
+ # with the name of the method which can easily break and the concurrency tests
5
+ # will anyways pass when run with the transactional mode. We want the same
6
+ # database to be used without transactions during the tests so that we can test
7
+ # concurrency correctly.
8
+ RSpec.shared_context "with concurrency" do
9
+ self.use_transactional_tests = false
10
+
11
+ after do
12
+ # Because the transactional tests are disabled, we need to manually clear
13
+ # the tables after the test.
14
+ connection = ActiveRecord::Base.connection
15
+ connection.disable_referential_integrity do
16
+ connection.tables.each do |table_name|
17
+ next if connection.select_value("SELECT COUNT(*) FROM #{table_name}").zero?
18
+
19
+ connection.execute("TRUNCATE #{table_name} CASCADE")
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.configure do |config|
4
+ config.include Decidim::SanitizeHelper
5
+ end
@@ -1,10 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  RSpec.configure do |config|
4
- config.before(:all, type: :system) do
5
- Dir.chdir(Rails.root) { Webpacker.compile }
6
- end
7
- config.before(:all, type: :mailer) do
4
+ config.before(:all) do
5
+ raise "Rails.root directory does not exist" unless Rails.root.exist?
6
+ raise "package.json file does not exist" unless Rails.root.join("package.json").exist?
7
+ raise "Node modules directory does not exist" unless Rails.root.join("node_modules").exist?
8
+
8
9
  Dir.chdir(Rails.root) { Webpacker.compile }
10
+ rescue Errno::ENOENT
11
+ node_modules_contents = `ls #{Rails.root.join("node_modules")}`
12
+
13
+ message = <<~ERROR
14
+ There was an error during the Webpacker compilation
15
+ #{"=" * 80}
16
+ Node version: #{`node -v`}
17
+ #{"=" * 80}
18
+ NPM version: #{`npm -v`}
19
+ #{"=" * 80}
20
+ Node modules packages: #{`npm list`}
21
+ #{"=" * 80}
22
+ Node modules contents: #{node_modules_contents}
23
+ #{"=" * 80}
24
+ ERROR
25
+
26
+ raise message
9
27
  end
10
28
  end
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-dev version.
5
5
  module Dev
6
6
  def self.version
7
- "0.28.0"
7
+ "0.28.1"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-dev
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.0
4
+ version: 0.28.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
8
8
  - Marc Riera Casals
9
9
  - Oriol Gual Oliva
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-12-20 00:00:00.000000000 Z
13
+ date: 2024-04-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: capybara
@@ -32,14 +32,14 @@ dependencies:
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.28.0
35
+ version: 0.28.1
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 0.28.0
42
+ version: 0.28.1
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: factory_bot_rails
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -454,7 +454,6 @@ files:
454
454
  - app/views/decidim/dev/dummy_resources/show.html.erb
455
455
  - app/views/decidim/dummy_resource/_linked_dummys.html.erb
456
456
  - config/assets.rb
457
- - config/environment.rb
458
457
  - config/locales/am-ET.yml
459
458
  - config/locales/ar-SA.yml
460
459
  - config/locales/ar.yml
@@ -487,6 +486,7 @@ files:
487
486
  - config/locales/ga-IE.yml
488
487
  - config/locales/gl.yml
489
488
  - config/locales/gn-PY.yml
489
+ - config/locales/he-IL.yml
490
490
  - config/locales/hr-HR.yml
491
491
  - config/locales/hr.yml
492
492
  - config/locales/hu.yml
@@ -539,6 +539,7 @@ files:
539
539
  - config/rubocop/rails.yml
540
540
  - config/rubocop/rspec.yml
541
541
  - config/rubocop/ruby.yml
542
+ - decidim-dev.gemspec
542
543
  - lib/decidim-dev.rb
543
544
  - lib/decidim/dev.rb
544
545
  - lib/decidim/dev/admin.rb
@@ -616,10 +617,12 @@ files:
616
617
  - lib/decidim/dev/test/rspec_support/comments.rb
617
618
  - lib/decidim/dev/test/rspec_support/component.rb
618
619
  - lib/decidim/dev/test/rspec_support/component_context.rb
620
+ - lib/decidim/dev/test/rspec_support/concurrency.rb
619
621
  - lib/decidim/dev/test/rspec_support/confirmation_helpers.rb
620
622
  - lib/decidim/dev/test/rspec_support/content_processing.rb
621
623
  - lib/decidim/dev/test/rspec_support/controller_example_group.rb
622
624
  - lib/decidim/dev/test/rspec_support/data_consent.rb
625
+ - lib/decidim/dev/test/rspec_support/decidim_sanitization.rb
623
626
  - lib/decidim/dev/test/rspec_support/dynamic_attach.rb
624
627
  - lib/decidim/dev/test/rspec_support/editor_context.rb
625
628
  - lib/decidim/dev/test/rspec_support/engine_examples.rb
@@ -666,23 +669,23 @@ metadata:
666
669
  funding_uri: https://opencollective.com/decidim
667
670
  homepage_uri: https://decidim.org
668
671
  source_code_uri: https://github.com/decidim/decidim
669
- post_install_message:
672
+ post_install_message:
670
673
  rdoc_options: []
671
674
  require_paths:
672
675
  - lib
673
676
  required_ruby_version: !ruby/object:Gem::Requirement
674
677
  requirements:
675
- - - ">="
678
+ - - "~>"
676
679
  - !ruby/object:Gem::Version
677
- version: '3.1'
680
+ version: 3.1.0
678
681
  required_rubygems_version: !ruby/object:Gem::Requirement
679
682
  requirements:
680
683
  - - ">="
681
684
  - !ruby/object:Gem::Version
682
685
  version: '0'
683
686
  requirements: []
684
- rubygems_version: 3.4.22
685
- signing_key:
687
+ rubygems_version: 3.5.9
688
+ signing_key:
686
689
  specification_version: 4
687
690
  summary: Decidim dev tools
688
691
  test_files: []
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Empty line for playing nice with tpope/vim-rails