decidim-dev 0.20.0 → 0.23.1.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/decidim/dummy.svg +1 -4
  3. data/app/assets/images/decidim/gamification/badges/test.svg +1 -145
  4. data/app/commands/decidim/dummy_resources/create_dummy_resource.rb +48 -0
  5. data/app/controllers/decidim/dummy_resources/dummy_resources_controller.rb +1 -0
  6. data/app/forms/decidim/dummy_resources/dummy_resource_form.rb +3 -0
  7. data/app/views/decidim/dummy_resources/dummy_resources/show.html.erb +4 -0
  8. data/config/locales/am-ET.yml +1 -0
  9. data/config/locales/bg-BG.yml +56 -0
  10. data/config/locales/bg.yml +56 -0
  11. data/config/locales/ca.yml +15 -0
  12. data/config/locales/cs.yml +16 -1
  13. data/config/locales/da-DK.yml +1 -0
  14. data/config/locales/da.yml +1 -0
  15. data/config/locales/de.yml +16 -0
  16. data/config/locales/el-GR.yml +1 -0
  17. data/config/locales/el.yml +56 -0
  18. data/config/locales/en.yml +15 -0
  19. data/config/locales/eo.yml +1 -0
  20. data/config/locales/es-MX.yml +15 -0
  21. data/config/locales/es-PY.yml +15 -0
  22. data/config/locales/es.yml +15 -0
  23. data/config/locales/et-EE.yml +1 -0
  24. data/config/locales/et.yml +1 -0
  25. data/config/locales/fi-plain.yml +15 -0
  26. data/config/locales/fi.yml +15 -0
  27. data/config/locales/fr-CA.yml +56 -0
  28. data/config/locales/fr.yml +15 -0
  29. data/config/locales/ga-IE.yml +1 -0
  30. data/config/locales/hr-HR.yml +1 -0
  31. data/config/locales/hr.yml +1 -0
  32. data/config/locales/hu.yml +11 -2
  33. data/config/locales/is-IS.yml +21 -0
  34. data/config/locales/is.yml +21 -0
  35. data/config/locales/it.yml +17 -2
  36. data/config/locales/ja-JP.yml +56 -0
  37. data/config/locales/ja.yml +56 -0
  38. data/config/locales/ko-KR.yml +1 -0
  39. data/config/locales/ko.yml +1 -0
  40. data/config/locales/lt-LT.yml +1 -0
  41. data/config/locales/lt.yml +1 -0
  42. data/config/locales/lv.yml +54 -0
  43. data/config/locales/mt-MT.yml +1 -0
  44. data/config/locales/mt.yml +1 -0
  45. data/config/locales/nl.yml +15 -0
  46. data/config/locales/no.yml +31 -0
  47. data/config/locales/om-ET.yml +1 -0
  48. data/config/locales/pl.yml +26 -10
  49. data/config/locales/pt-BR.yml +1 -1
  50. data/config/locales/pt.yml +26 -10
  51. data/config/locales/ro-RO.yml +56 -0
  52. data/config/locales/sk-SK.yml +47 -0
  53. data/config/locales/sk.yml +47 -0
  54. data/config/locales/sl.yml +5 -0
  55. data/config/locales/so-SO.yml +1 -0
  56. data/config/locales/sr-CS.yml +8 -0
  57. data/config/locales/sv.yml +15 -0
  58. data/config/locales/ti-ER.yml +1 -0
  59. data/config/locales/vi-VN.yml +1 -0
  60. data/config/locales/vi.yml +1 -0
  61. data/config/locales/zh-CN.yml +56 -0
  62. data/config/locales/zh-TW.yml +1 -0
  63. data/lib/decidim/dev.rb +2 -0
  64. data/lib/decidim/dev/assets/assemblies.json +816 -0
  65. data/lib/decidim/dev/assets/assemblies_with_null.json +135 -0
  66. data/lib/decidim/dev/assets/city.jpeg +0 -0
  67. data/lib/decidim/dev/assets/city2.jpeg +0 -0
  68. data/lib/decidim/dev/assets/city3.jpeg +0 -0
  69. data/lib/decidim/dev/assets/geocoder_result_here.json +72 -0
  70. data/lib/decidim/dev/assets/geocoder_result_osm.json +150 -0
  71. data/lib/decidim/dev/assets/import_participatory_space_private_users_nok.csv +2 -0
  72. data/lib/decidim/dev/dummy_translator.rb +32 -0
  73. data/lib/decidim/dev/test/base_spec_helper.rb +14 -0
  74. data/lib/decidim/dev/test/rspec_support/authorization.rb +3 -0
  75. data/lib/decidim/dev/test/rspec_support/capybara.rb +6 -2
  76. data/lib/decidim/dev/test/rspec_support/capybara_data_picker.rb +15 -5
  77. data/lib/decidim/dev/test/rspec_support/capybara_scopes_picker.rb +5 -5
  78. data/lib/decidim/dev/test/rspec_support/comments.rb +2 -2
  79. data/lib/decidim/dev/test/rspec_support/component.rb +104 -5
  80. data/lib/decidim/dev/test/rspec_support/component_context.rb +1 -2
  81. data/lib/decidim/dev/test/rspec_support/confirmation_helpers.rb +60 -0
  82. data/lib/decidim/dev/test/rspec_support/content_processing.rb +4 -4
  83. data/lib/decidim/dev/test/rspec_support/frontend.rb +20 -0
  84. data/lib/decidim/dev/test/rspec_support/geocoder.rb +150 -7
  85. data/lib/decidim/dev/test/rspec_support/helpers.rb +2 -2
  86. data/lib/decidim/dev/test/rspec_support/organization.rb +7 -0
  87. data/lib/decidim/dev/test/rspec_support/rake_tasks.rb +75 -0
  88. data/lib/decidim/dev/test/rspec_support/timezone.rb +7 -0
  89. data/lib/decidim/dev/test/rspec_support/translation_helpers.rb +2 -0
  90. data/lib/decidim/dev/version.rb +1 -1
  91. data/lib/tasks/generators.rake +2 -1
  92. data/lib/tasks/locale_checker.rake +1 -1
  93. metadata +94 -18
  94. data/lib/decidim/dev/test/rspec_support/capybara_proposals_picker.rb +0 -51
@@ -10,14 +10,14 @@ module Decidim::ComponentTestHelpers
10
10
 
11
11
  def within_user_menu
12
12
  within ".topbar__user__logged" do
13
- find("a", text: user.name).hover
13
+ find("a", text: user.name).click
14
14
  yield
15
15
  end
16
16
  end
17
17
 
18
18
  def within_language_menu
19
19
  within ".topbar__dropmenu.language-choose" do
20
- find("ul.dropdown.menu").hover
20
+ find("ul.dropdown.menu").click
21
21
  yield
22
22
  end
23
23
  end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.configure do |config|
4
+ config.after do
5
+ Decidim::OrganizationSettings.reset!
6
+ end
7
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ # File: spec/support/tasks.rb
4
+ require "rake"
5
+
6
+ # Task names should be used in the top-level describe, with an optional
7
+ # "rake "-prefix for better documentation. Both of these will work:
8
+ #
9
+ # 1) describe "foo:bar" do ... end
10
+ #
11
+ # 2) describe "rake foo:bar" do ... end
12
+ #
13
+ # Favor including "rake "-prefix as in the 2nd example above as it produces
14
+ # doc output that makes it clear a rake task is under test and how it is
15
+ # invoked.
16
+ module TaskExampleGroup
17
+ extend ActiveSupport::Concern
18
+
19
+ included do
20
+ # Make the Rake task available as `task` in your examples:
21
+ subject(:task) { tasks[task_name] }
22
+
23
+ let(:task_name) { self.class.top_level_description.sub(/\Arake /, "") }
24
+ let(:tasks) { Rake::Task }
25
+ end
26
+ end
27
+
28
+ # A collection of methods to help dealing with rake tasks output.
29
+ module RakeTaskOutputHelpers
30
+ extend ActiveSupport::Concern
31
+
32
+ included do
33
+ let!(:original_stdout) { $stdout }
34
+
35
+ # rubocop:disable RSpec/ExpectOutput
36
+ before do
37
+ $stdout = StringIO.new
38
+ end
39
+
40
+ after do
41
+ $stdout = original_stdout
42
+ end
43
+ # rubocop:enable RSpec/ExpectOutput
44
+ end
45
+
46
+ def check_no_errors_have_been_printed
47
+ expect($stdout.string).not_to include("ERROR:")
48
+ end
49
+
50
+ def check_some_errors_have_been_printed
51
+ expect($stdout.string).to include("ERROR:")
52
+ end
53
+
54
+ def check_error_printed(type)
55
+ expect($stdout.string).to include("ERROR: [#{type}]")
56
+ end
57
+
58
+ def check_message_printed(message)
59
+ expect($stdout.string).to include(message)
60
+ end
61
+ end
62
+
63
+ RSpec.configure do |config|
64
+ # Tag Rake specs with `:task` metadata or put them in the spec/tasks dir
65
+ config.define_derived_metadata(file_path: %r{/spec/tasks/}) do |metadata|
66
+ metadata[:type] = :task
67
+ end
68
+
69
+ config.include TaskExampleGroup, type: :task
70
+ config.include RakeTaskOutputHelpers, type: :task
71
+
72
+ config.before(:suite) do
73
+ Rails.application.load_tasks
74
+ end
75
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.configure do |config|
4
+ config.around :example, :tz do |example|
5
+ Time.use_zone(example.metadata[:tz]) { example.run }
6
+ end
7
+ end
@@ -13,6 +13,8 @@ module TranslationHelpers
13
13
  # It is intended to be used to avoid the implementation details, so that the
14
14
  # translated attributes implementation can change more easily.
15
15
  def translated(field, locale: I18n.locale)
16
+ return field if field.is_a?(String)
17
+
16
18
  field.try(:[], locale.to_s)
17
19
  end
18
20
 
@@ -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.20.0"
7
+ "0.23.1.rc1"
8
8
  end
9
9
  end
10
10
  end
@@ -44,7 +44,8 @@ namespace :decidim do
44
44
  "..",
45
45
  "--recreate_db",
46
46
  "--seed_db",
47
- "--demo"
47
+ "--demo",
48
+ "--profiling"
48
49
  )
49
50
  end
50
51
  end
@@ -5,7 +5,7 @@ namespace :decidim do
5
5
  task check_locales: :environment do
6
6
  FileUtils.remove_dir("tmp/decidim_repo", true)
7
7
 
8
- branch = ENV["TARGET_BRANCH"] || "master"
8
+ branch = ENV["TARGET_BRANCH"] || "develop"
9
9
  status = system("git clone --depth=1 --single-branch --branch #{branch} https://github.com/decidim/decidim tmp/decidim_repo")
10
10
  return unless status
11
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-dev
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.23.1.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-01-08 00:00:00.000000000 Z
13
+ date: 2020-11-06 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.20.0
35
+ version: 0.23.1.rc1
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.20.0
42
+ version: 0.23.1.rc1
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: factory_bot_rails
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -116,42 +116,42 @@ dependencies:
116
116
  requirements:
117
117
  - - "~>"
118
118
  - !ruby/object:Gem::Version
119
- version: 0.5.0
119
+ version: '0.5'
120
120
  type: :runtime
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
124
  - - "~>"
125
125
  - !ruby/object:Gem::Version
126
- version: 0.5.0
126
+ version: '0.5'
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: nokogiri
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  requirements:
131
131
  - - ">="
132
132
  - !ruby/object:Gem::Version
133
- version: 1.10.4
133
+ version: 1.10.8
134
134
  type: :runtime
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  requirements:
138
138
  - - ">="
139
139
  - !ruby/object:Gem::Version
140
- version: 1.10.4
140
+ version: 1.10.8
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: puma
143
143
  requirement: !ruby/object:Gem::Requirement
144
144
  requirements:
145
- - - "~>"
145
+ - - ">="
146
146
  - !ruby/object:Gem::Version
147
- version: '3.12'
147
+ version: '4.3'
148
148
  type: :runtime
149
149
  prerelease: false
150
150
  version_requirements: !ruby/object:Gem::Requirement
151
151
  requirements:
152
- - - "~>"
152
+ - - ">="
153
153
  - !ruby/object:Gem::Version
154
- version: '3.12'
154
+ version: '4.3'
155
155
  - !ruby/object:Gem::Dependency
156
156
  name: rails-controller-testing
157
157
  requirement: !ruby/object:Gem::Requirement
@@ -208,6 +208,20 @@ dependencies:
208
208
  - - "~>"
209
209
  - !ruby/object:Gem::Version
210
210
  version: '3.7'
211
+ - !ruby/object:Gem::Dependency
212
+ name: rspec-retry
213
+ requirement: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - "~>"
216
+ - !ruby/object:Gem::Version
217
+ version: 0.6.2
218
+ type: :runtime
219
+ prerelease: false
220
+ version_requirements: !ruby/object:Gem::Requirement
221
+ requirements:
222
+ - - "~>"
223
+ - !ruby/object:Gem::Version
224
+ version: 0.6.2
211
225
  - !ruby/object:Gem::Dependency
212
226
  name: rspec_junit_formatter
213
227
  requirement: !ruby/object:Gem::Requirement
@@ -284,14 +298,28 @@ dependencies:
284
298
  requirements:
285
299
  - - "~>"
286
300
  - !ruby/object:Gem::Version
287
- version: '0.16'
301
+ version: 0.19.0
288
302
  type: :runtime
289
303
  prerelease: false
290
304
  version_requirements: !ruby/object:Gem::Requirement
291
305
  requirements:
292
306
  - - "~>"
293
307
  - !ruby/object:Gem::Version
294
- version: '0.16'
308
+ version: 0.19.0
309
+ - !ruby/object:Gem::Dependency
310
+ name: simplecov-cobertura
311
+ requirement: !ruby/object:Gem::Requirement
312
+ requirements:
313
+ - - "~>"
314
+ - !ruby/object:Gem::Version
315
+ version: 1.3.1
316
+ type: :runtime
317
+ prerelease: false
318
+ version_requirements: !ruby/object:Gem::Requirement
319
+ requirements:
320
+ - - "~>"
321
+ - !ruby/object:Gem::Version
322
+ version: 1.3.1
295
323
  - !ruby/object:Gem::Dependency
296
324
  name: system_test_html_screenshots
297
325
  requirement: !ruby/object:Gem::Requirement
@@ -347,50 +375,93 @@ files:
347
375
  - Rakefile
348
376
  - app/assets/images/decidim/dummy.svg
349
377
  - app/assets/images/decidim/gamification/badges/test.svg
378
+ - app/commands/decidim/dummy_resources/create_dummy_resource.rb
350
379
  - app/controllers/decidim/dummy_resources/dummy_resources_controller.rb
351
380
  - app/forms/decidim/dummy_resources/dummy_resource_form.rb
352
381
  - app/views/decidim/dummy_resource/_linked_dummys.html.erb
353
382
  - app/views/decidim/dummy_resources/dummy_resources/foo.html.erb
354
383
  - app/views/decidim/dummy_resources/dummy_resources/show.html.erb
384
+ - config/locales/am-ET.yml
355
385
  - config/locales/ar-SA.yml
356
386
  - config/locales/ar.yml
387
+ - config/locales/bg-BG.yml
388
+ - config/locales/bg.yml
357
389
  - config/locales/ca.yml
358
390
  - config/locales/cs-CZ.yml
359
391
  - config/locales/cs.yml
392
+ - config/locales/da-DK.yml
393
+ - config/locales/da.yml
360
394
  - config/locales/de.yml
395
+ - config/locales/el-GR.yml
396
+ - config/locales/el.yml
361
397
  - config/locales/en.yml
362
398
  - config/locales/eo-UY.yml
399
+ - config/locales/eo.yml
363
400
  - config/locales/es-MX.yml
364
401
  - config/locales/es-PY.yml
365
402
  - config/locales/es.yml
403
+ - config/locales/et-EE.yml
404
+ - config/locales/et.yml
366
405
  - config/locales/eu.yml
367
406
  - config/locales/fi-pl.yml
368
407
  - config/locales/fi-plain.yml
369
408
  - config/locales/fi.yml
409
+ - config/locales/fr-CA.yml
370
410
  - config/locales/fr.yml
411
+ - config/locales/ga-IE.yml
371
412
  - config/locales/gl.yml
413
+ - config/locales/hr-HR.yml
414
+ - config/locales/hr.yml
372
415
  - config/locales/hu.yml
373
416
  - config/locales/id-ID.yml
417
+ - config/locales/is-IS.yml
418
+ - config/locales/is.yml
374
419
  - config/locales/it.yml
420
+ - config/locales/ja-JP.yml
421
+ - config/locales/ja.yml
422
+ - config/locales/ko-KR.yml
423
+ - config/locales/ko.yml
424
+ - config/locales/lt-LT.yml
425
+ - config/locales/lt.yml
426
+ - config/locales/lv.yml
427
+ - config/locales/mt-MT.yml
428
+ - config/locales/mt.yml
375
429
  - config/locales/nl.yml
376
430
  - config/locales/no.yml
431
+ - config/locales/om-ET.yml
377
432
  - config/locales/pl.yml
378
433
  - config/locales/pt-BR.yml
379
434
  - config/locales/pt.yml
435
+ - config/locales/ro-RO.yml
380
436
  - config/locales/ru.yml
437
+ - config/locales/sk-SK.yml
438
+ - config/locales/sk.yml
439
+ - config/locales/sl.yml
440
+ - config/locales/so-SO.yml
441
+ - config/locales/sr-CS.yml
381
442
  - config/locales/sv.yml
443
+ - config/locales/ti-ER.yml
382
444
  - config/locales/tr-TR.yml
383
445
  - config/locales/uk.yml
446
+ - config/locales/vi-VN.yml
447
+ - config/locales/vi.yml
448
+ - config/locales/zh-CN.yml
449
+ - config/locales/zh-TW.yml
384
450
  - lib/decidim/dev.rb
385
451
  - lib/decidim/dev/assets/Exampledocument.pdf
452
+ - lib/decidim/dev/assets/assemblies.json
453
+ - lib/decidim/dev/assets/assemblies_with_null.json
386
454
  - lib/decidim/dev/assets/avatar.jpg
387
455
  - lib/decidim/dev/assets/city.jpeg
388
456
  - lib/decidim/dev/assets/city2.jpeg
389
457
  - lib/decidim/dev/assets/city3.jpeg
390
458
  - lib/decidim/dev/assets/dni.jpg
459
+ - lib/decidim/dev/assets/geocoder_result_here.json
460
+ - lib/decidim/dev/assets/geocoder_result_osm.json
391
461
  - lib/decidim/dev/assets/icon.png
392
462
  - lib/decidim/dev/assets/id.jpg
393
463
  - lib/decidim/dev/assets/import_participatory_space_private_users.csv
464
+ - lib/decidim/dev/assets/import_participatory_space_private_users_nok.csv
394
465
  - lib/decidim/dev/assets/iso-8859-15.md
395
466
  - lib/decidim/dev/assets/malicious.jpg
396
467
  - lib/decidim/dev/assets/participatory_processes.json
@@ -400,6 +471,7 @@ files:
400
471
  - lib/decidim/dev/assets/participatory_text_wrong.odt
401
472
  - lib/decidim/dev/assets/verify_user_groups.csv
402
473
  - lib/decidim/dev/common_rake.rb
474
+ - lib/decidim/dev/dummy_translator.rb
403
475
  - lib/decidim/dev/railtie.rb
404
476
  - lib/decidim/dev/test/authorization_shared_examples.rb
405
477
  - lib/decidim/dev/test/base_spec_helper.rb
@@ -413,22 +485,26 @@ files:
413
485
  - lib/decidim/dev/test/rspec_support/authorization.rb
414
486
  - lib/decidim/dev/test/rspec_support/capybara.rb
415
487
  - lib/decidim/dev/test/rspec_support/capybara_data_picker.rb
416
- - lib/decidim/dev/test/rspec_support/capybara_proposals_picker.rb
417
488
  - lib/decidim/dev/test/rspec_support/capybara_scopes_picker.rb
418
489
  - lib/decidim/dev/test/rspec_support/comments.rb
419
490
  - lib/decidim/dev/test/rspec_support/component.rb
420
491
  - lib/decidim/dev/test/rspec_support/component_context.rb
492
+ - lib/decidim/dev/test/rspec_support/confirmation_helpers.rb
421
493
  - lib/decidim/dev/test/rspec_support/content_processing.rb
422
494
  - lib/decidim/dev/test/rspec_support/download_helper.rb
423
495
  - lib/decidim/dev/test/rspec_support/factory_bot.rb
496
+ - lib/decidim/dev/test/rspec_support/frontend.rb
424
497
  - lib/decidim/dev/test/rspec_support/gamification.rb
425
498
  - lib/decidim/dev/test/rspec_support/geocoder.rb
426
499
  - lib/decidim/dev/test/rspec_support/helpers.rb
427
500
  - lib/decidim/dev/test/rspec_support/html_matchers.rb
428
501
  - lib/decidim/dev/test/rspec_support/orderly_matchers.rb
502
+ - lib/decidim/dev/test/rspec_support/organization.rb
429
503
  - lib/decidim/dev/test/rspec_support/permissions_shared_examples.rb
504
+ - lib/decidim/dev/test/rspec_support/rake_tasks.rb
430
505
  - lib/decidim/dev/test/rspec_support/react_select.rb
431
506
  - lib/decidim/dev/test/rspec_support/route_helpers.rb
507
+ - lib/decidim/dev/test/rspec_support/timezone.rb
432
508
  - lib/decidim/dev/test/rspec_support/translation_helpers.rb
433
509
  - lib/decidim/dev/test/rspec_support/warden.rb
434
510
  - lib/decidim/dev/test/rspec_support/webmock.rb
@@ -449,12 +525,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
449
525
  requirements:
450
526
  - - ">="
451
527
  - !ruby/object:Gem::Version
452
- version: '2.5'
528
+ version: '2.6'
453
529
  required_rubygems_version: !ruby/object:Gem::Requirement
454
530
  requirements:
455
- - - ">="
531
+ - - ">"
456
532
  - !ruby/object:Gem::Version
457
- version: '0'
533
+ version: 1.3.1
458
534
  requirements: []
459
535
  rubygems_version: 3.0.3
460
536
  signing_key:
@@ -1,51 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "capybara_data_picker"
4
-
5
- module Capybara
6
- module ProposalsPicker
7
- include DataPicker
8
-
9
- RSpec::Matchers.define :have_data_picked do |expected, text|
10
- match do |data_picker|
11
- data_picker_elem = data_picker.data_picker
12
- expect(data_picker_elem).to have_selector(".picker-values div input[value='#{expected&.id || data_picker.global_value}']", visible: false)
13
- expect(data_picker_elem).to have_selector(:xpath, "//div[contains(@class,'picker-values')]/div/a[text()[contains(.,'#{text}')]]")
14
- end
15
- end
16
-
17
- def proposal_pick(proposal_picker, proposal)
18
- data_picker = proposal_picker.data_picker
19
- # use scope_repick to change single scope picker selected scope
20
- expect(data_picker).to have_selector(".picker-values:empty", visible: false) if data_picker.has_css?(".picker-single")
21
-
22
- expect(data_picker).to have_selector(".picker-prompt")
23
- data_picker.find(".picker-prompt").click
24
-
25
- proposal_picker_search_perform(proposal.title)
26
- proposal_picker_search_choose_result(proposal.id)
27
- data_picker_pick_current
28
-
29
- expect(proposal_picker).to have_data_picked(proposal, proposal.title)
30
- end
31
-
32
- private
33
-
34
- def proposal_picker_search_perform(term)
35
- body = find(:xpath, "//body")
36
- input_selector = "#data_picker-modal .picker-content input#data_picker-autocomplete"
37
- expect(body).to have_selector(input_selector)
38
- body.find("#data_picker-modal .picker-content").fill_in("data_picker-autocomplete", with: term)
39
- end
40
-
41
- def proposal_picker_search_choose_result(proposal_id)
42
- body = find(:xpath, "//body")
43
- expect(body).to have_selector(".autocomplete-suggestions .autocomplete-suggestion")
44
- body.find(".autocomplete-suggestions div.autocomplete-suggestion[data-model-id='#{proposal_id}']").click
45
- end
46
- end
47
- end
48
-
49
- RSpec.configure do |config|
50
- config.include Capybara::ProposalsPicker, type: :system
51
- end