dvla-application_helper 5.1.5

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.
Files changed (101) hide show
  1. checksums.yaml +7 -0
  2. data/.drone.yml +481 -0
  3. data/.env.template +4 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +21 -0
  6. data/.ruby-gemset +1 -0
  7. data/.ruby-version +1 -0
  8. data/README.md +674 -0
  9. data/Rakefile +31 -0
  10. data/config/settings/drone-dev.yml +41 -0
  11. data/config/settings/drone-ext.yml +35 -0
  12. data/config/settings/drone-link.yml +35 -0
  13. data/config/settings/drone-perf.yml +35 -0
  14. data/config/settings/local-dev.yml +40 -0
  15. data/config/settings/local-ext.yml +35 -0
  16. data/config/settings/local-link.yml +35 -0
  17. data/config/settings/local-perf.yml +35 -0
  18. data/config/settings.yml +29 -0
  19. data/config/yarp.yml +6 -0
  20. data/functional-tests/Rakefile +74 -0
  21. data/functional-tests/chutney.yml +110 -0
  22. data/functional-tests/features/codl.feature +170 -0
  23. data/functional-tests/features/codl_image_review_states.feature +140 -0
  24. data/functional-tests/features/csudl.feature +54 -0
  25. data/functional-tests/features/csudl_image_review_states.feature +20 -0
  26. data/functional-tests/features/step_definitions/app_domain_steps.rb +213 -0
  27. data/functional-tests/features/step_definitions/application_creation_steps.rb +115 -0
  28. data/functional-tests/features/step_definitions/image_steps.rb +144 -0
  29. data/functional-tests/features/step_definitions/state_machine_steps.rb +43 -0
  30. data/functional-tests/features/support/data/artefacts.rb +27 -0
  31. data/functional-tests/features/support/data/image_helpers.rb +20 -0
  32. data/functional-tests/features/support/data/schema_helpers.rb +3 -0
  33. data/functional-tests/features/support/data/string_manipulation.rb +9 -0
  34. data/functional-tests/features/support/env.rb +25 -0
  35. data/functional-tests/features/support/hooks.rb +56 -0
  36. data/functional-tests/features/support/yarp_integration/yarp_helpers.rb +23 -0
  37. data/functional-tests/features/uodl_image_review_states.feature +244 -0
  38. data/functional-tests/features/uodl_non_processable.feature +441 -0
  39. data/functional-tests/features/uodl_processable.feature +416 -0
  40. data/lib/dvla/application_helper/builders/V1/application_builder.rb +298 -0
  41. data/lib/dvla/application_helper/builders/V1/codl_application_builder.rb +205 -0
  42. data/lib/dvla/application_helper/builders/V1/csudl_application_builder.rb +329 -0
  43. data/lib/dvla/application_helper/builders/V2/base_uodl_v2_application_builder.rb +357 -0
  44. data/lib/dvla/application_helper/builders/V2/cop_v2_application_builder.rb +59 -0
  45. data/lib/dvla/application_helper/builders/V2/dup_v2_application_builder.rb +84 -0
  46. data/lib/dvla/application_helper/builders/V2/exc_v2_application_builder.rb +55 -0
  47. data/lib/dvla/application_helper/builders/V2/rep_v2_application_builder.rb +84 -0
  48. data/lib/dvla/application_helper/builders/V2/tyr_v2_application_builder.rb +62 -0
  49. data/lib/dvla/application_helper/builders/V2/uodl_v2_application_builder.rb +278 -0
  50. data/lib/dvla/application_helper/builders/V3/base_uodl_v3_application_builder.rb +342 -0
  51. data/lib/dvla/application_helper/builders/V3/cop_v3_application_builder.rb +56 -0
  52. data/lib/dvla/application_helper/builders/V3/dup_v3_application_builder.rb +78 -0
  53. data/lib/dvla/application_helper/builders/V3/exc_v3_application_builder.rb +56 -0
  54. data/lib/dvla/application_helper/builders/V3/rep_v3_application_builder.rb +81 -0
  55. data/lib/dvla/application_helper/builders/V3/tyr_v3_application_builder.rb +59 -0
  56. data/lib/dvla/application_helper/builders/dup_rep_builder_mixin.rb +71 -0
  57. data/lib/dvla/application_helper/builders/photo_builder_mixin.rb +49 -0
  58. data/lib/dvla/application_helper/builders/photo_signature_builder_mixin.rb +68 -0
  59. data/lib/dvla/application_helper/configuration.rb +37 -0
  60. data/lib/dvla/application_helper/constants.rb +21 -0
  61. data/lib/dvla/application_helper/enums/review_state.rb +30 -0
  62. data/lib/dvla/application_helper/enums/unable_to_prove_licence_possession_reasons.rb +8 -0
  63. data/lib/dvla/application_helper/factories/address.rb +21 -0
  64. data/lib/dvla/application_helper/factories/application_details.rb +353 -0
  65. data/lib/dvla/application_helper/factories/casework.rb +7 -0
  66. data/lib/dvla/application_helper/factories/csudl_photo_signature_image.rb +156 -0
  67. data/lib/dvla/application_helper/factories/csudl_photo_signature_images.rb +85 -0
  68. data/lib/dvla/application_helper/factories/organ_donor.rb +32 -0
  69. data/lib/dvla/application_helper/factories/person.rb +73 -0
  70. data/lib/dvla/application_helper/factories/photo_image.rb +147 -0
  71. data/lib/dvla/application_helper/factories/photo_images.rb +183 -0
  72. data/lib/dvla/application_helper/factories/photo_signature_image.rb +158 -0
  73. data/lib/dvla/application_helper/factories/photo_signature_images.rb +64 -0
  74. data/lib/dvla/application_helper/fixtures/photo/comparison_image.jpeg +0 -0
  75. data/lib/dvla/application_helper/fixtures/photo/passport_image.jpg +0 -0
  76. data/lib/dvla/application_helper/fixtures/photo/photocard_back.jpg +0 -0
  77. data/lib/dvla/application_helper/fixtures/photo/photocard_front.jpg +0 -0
  78. data/lib/dvla/application_helper/fixtures/photo/rejected_user_uploaded_image.jpeg +0 -0
  79. data/lib/dvla/application_helper/fixtures/photo/user_uploaded_image.jpg +0 -0
  80. data/lib/dvla/application_helper/fixtures/signature/csudl_signature_image.tiff +0 -0
  81. data/lib/dvla/application_helper/fixtures/signature/passport_image.jpg +0 -0
  82. data/lib/dvla/application_helper/fixtures/signature/rejected_user_uploaded_image.jpg +0 -0
  83. data/lib/dvla/application_helper/fixtures/signature/user_uploaded_image.jpg +0 -0
  84. data/lib/dvla/application_helper/processors/application_status.rb +45 -0
  85. data/lib/dvla/application_helper/processors/application_task.rb +301 -0
  86. data/lib/dvla/application_helper/services/application_diary.rb +123 -0
  87. data/lib/dvla/application_helper/services/application_domain.rb +239 -0
  88. data/lib/dvla/application_helper/services/application_process_engine.rb +120 -0
  89. data/lib/dvla/application_helper/services/check_aws_credentials.rb +24 -0
  90. data/lib/dvla/application_helper/services/driving_licence_channel_api.rb +67 -0
  91. data/lib/dvla/application_helper/services/image_service.rb +116 -0
  92. data/lib/dvla/application_helper/services/image_utility.rb +82 -0
  93. data/lib/dvla/application_helper/services/state_machine_helpers.rb +146 -0
  94. data/lib/dvla/application_helper/version.rb +5 -0
  95. data/lib/dvla/application_helper.rb +92 -0
  96. data/renovate.json +4 -0
  97. data/scripts/application-login.sh +56 -0
  98. data/scripts/drone-aws-login.sh +18 -0
  99. data/scripts/seed_application.rb +268 -0
  100. data/sonar-project.properties +4 -0
  101. metadata +343 -0
data/Rakefile ADDED
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require 'rubocop/rake_task'
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
13
+
14
+ task specs: %i[spec]
15
+
16
+ namespace :seed_app do
17
+ task :dev do |_t|
18
+ ENV['ENVIRONMENT'] = 'local-dev'
19
+ require './scripts/seed_application.rb'
20
+ end
21
+
22
+ task :link do |_t|
23
+ ENV['ENVIRONMENT'] = 'local-link'
24
+ require './scripts/seed_application.rb'
25
+ end
26
+
27
+ task :drone do |_t|
28
+ ENV['ENVIRONMENT'] = 'drone-dev' unless ENV.has_key?('ENVIRONMENT')
29
+ require './scripts/seed_application.rb'
30
+ end
31
+ end
@@ -0,0 +1,41 @@
1
+ application_helper:
2
+ services:
3
+ aws:
4
+ vpce_id: 02c656e6ddb2ce558
5
+ driving_licence_channel_api:
6
+ stage_name: dev
7
+ api_id: v5xx72m7z5
8
+ application_diary:
9
+ stage_name: dev
10
+ api_id: 0r7n1n0t2i
11
+ application_domain:
12
+ stage_name: dev
13
+ api_id: pc4j6sohv8
14
+ application_process_engine:
15
+ stage_name: dev
16
+ api_id: tokuf48me0
17
+ state_machine:
18
+ stage: dev
19
+ account_id: 129805137803
20
+ image_service:
21
+ base_url: https://flvh6n0yx6-vpce-02c656e6ddb2ce558.execute-api.eu-west-2.amazonaws.com/link/
22
+ image_utility:
23
+ base_url: https://r8t8c9sl7g-vpce-02c656e6ddb2ce558.execute-api.eu-west-2.amazonaws.com/link/
24
+ applicant_email:
25
+ email_prefix: <%= ENV.fetch('EMAIL_PREFIX', '') %>
26
+ email_domain: <%= ENV.fetch('EMAIL_DOMAIN', 'dvla.msdc.co') %>
27
+
28
+ customer_helper:
29
+ services:
30
+ customer_domain:
31
+ url: https://customer-account-domain-link.int-api.dvla.gov.uk
32
+
33
+ poirot:
34
+ services:
35
+ addressing:
36
+ base: https://common-services-addressing-link.int-api.dvla.gov.uk
37
+ identity_stub:
38
+ base: https://identity-identity-stub-link.int-api.dvla.gov.uk
39
+ headers:
40
+ Content-Type: 'application/json'
41
+
@@ -0,0 +1,35 @@
1
+ application_helper:
2
+ services:
3
+ aws:
4
+ vpce_id: 02c656e6ddb2ce558
5
+ driving_licence_channel_api:
6
+ stage_name: ext
7
+ api_id: a88xitdml4
8
+ application_diary:
9
+ stage_name: ext
10
+ api_id: 1h0v1ex2i5
11
+ application_domain:
12
+ stage_name: ext
13
+ api_id: 1hqw5nske8
14
+ application_process_engine:
15
+ stage_name: ext
16
+ api_id: 4xikwxe17a
17
+ state_machine:
18
+ stage: ext
19
+ account_id: 736948357641
20
+ image_service:
21
+ base_url: https://oh1b5v3xde-vpce-0c9077c8fe760fea6.execute-api.eu-west-2.amazonaws.com/preprod/
22
+ image_utility:
23
+ base_url: https://nzzfur5hr8-vpce-0c9077c8fe760fea6.execute-api.eu-west-2.amazonaws.com/preprod/
24
+ applicant_email:
25
+ email_prefix: <%= ENV.fetch('EMAIL_PREFIX', '') %>
26
+ email_domain: <%= ENV.fetch('EMAIL_DOMAIN', 'dvla.msdc.co') %>
27
+
28
+ poirot:
29
+ services:
30
+ addressing:
31
+ base: https://common-services-addressing-link.int-api.dvla.gov.uk
32
+ identity_stub:
33
+ base: https://identity-identity-stub-link.int-api.dvla.gov.uk
34
+ headers:
35
+ Content-Type: 'application/json'
@@ -0,0 +1,35 @@
1
+ application_helper:
2
+ services:
3
+ aws:
4
+ vpce_id: 02c656e6ddb2ce558
5
+ driving_licence_channel_api:
6
+ stage_name: link
7
+ api_id: f4mwdzovfb
8
+ application_diary:
9
+ stage_name: link
10
+ api_id: 8udjdqaoy4
11
+ application_domain:
12
+ stage_name: link
13
+ api_id: ehjf4jjgz4
14
+ application_process_engine:
15
+ stage_name: link
16
+ api_id: kq9xf7gl1j
17
+ state_machine:
18
+ stage: link
19
+ account_id: 736948357641
20
+ image_service:
21
+ base_url: https://flvh6n0yx6-vpce-02c656e6ddb2ce558.execute-api.eu-west-2.amazonaws.com/link/
22
+ image_utility:
23
+ base_url: https://r8t8c9sl7g-vpce-02c656e6ddb2ce558.execute-api.eu-west-2.amazonaws.com/link/
24
+ applicant_email:
25
+ email_prefix: <%= ENV.fetch('EMAIL_PREFIX', '') %>
26
+ email_domain: <%= ENV.fetch('EMAIL_DOMAIN', 'dvla.msdc.co') %>
27
+
28
+ poirot:
29
+ services:
30
+ addressing:
31
+ base: https://common-services-addressing-link.int-api.dvla.gov.uk
32
+ identity_stub:
33
+ base: https://identity-identity-stub-link.int-api.dvla.gov.uk
34
+ headers:
35
+ Content-Type: 'application/json'
@@ -0,0 +1,35 @@
1
+ application_helper:
2
+ services:
3
+ aws:
4
+ vpce_id: 02c656e6ddb2ce558
5
+ driving_licence_channel_api:
6
+ stage_name: perf
7
+ api_id: j64krkvhc3
8
+ application_diary:
9
+ stage_name: perf
10
+ api_id: m14vif8hpb
11
+ application_domain:
12
+ stage_name: perf
13
+ api_id: wemjsgw805
14
+ application_process_engine:
15
+ stage_name: perf
16
+ api_id: 4xikwxe17a
17
+ state_machine:
18
+ stage: perf
19
+ account_id: 736948357641
20
+ image_service:
21
+ base_url: https://oh1b5v3xde-vpce-0c9077c8fe760fea6.execute-api.eu-west-2.amazonaws.com/preprod/
22
+ image_utility:
23
+ base_url: https://nzzfur5hr8-vpce-0c9077c8fe760fea6.execute-api.eu-west-2.amazonaws.com/preprod/
24
+ applicant_email:
25
+ email_prefix: <%= ENV.fetch('EMAIL_PREFIX', '') %>
26
+ email_domain: <%= ENV.fetch('EMAIL_DOMAIN', 'dvla.msdc.co') %>
27
+
28
+ poirot:
29
+ services:
30
+ addressing:
31
+ base: https://common-services-addressing-link.int-api.dvla.gov.uk
32
+ identity_stub:
33
+ base: https://identity-identity-stub-link.int-api.dvla.gov.uk
34
+ headers:
35
+ Content-Type: 'application/json'
@@ -0,0 +1,40 @@
1
+ application_helper:
2
+ services:
3
+ aws:
4
+ vpce_id: 0c9077c8fe760fea6
5
+ driving_licence_channel_api:
6
+ stage_name: dev
7
+ api_id: v5xx72m7z5
8
+ application_diary:
9
+ stage_name: dev
10
+ api_id: 0r7n1n0t2i
11
+ application_domain:
12
+ stage_name: dev
13
+ api_id: pc4j6sohv8
14
+ application_process_engine:
15
+ stage_name: dev
16
+ api_id: tokuf48me0
17
+ state_machine:
18
+ stage: dev
19
+ account_id: 129805137803
20
+ image_service:
21
+ base_url: https://flvh6n0yx6-vpce-0c9077c8fe760fea6.execute-api.eu-west-2.amazonaws.com/link/
22
+ image_utility:
23
+ base_url: https://r8t8c9sl7g-vpce-0c9077c8fe760fea6.execute-api.eu-west-2.amazonaws.com/link/
24
+ applicant_email:
25
+ email_prefix: <%= ENV.fetch('EMAIL_PREFIX', '') %>
26
+ email_domain: <%= ENV.fetch('EMAIL_DOMAIN', 'dvla.msdc.co') %>
27
+
28
+ customer_helper:
29
+ services:
30
+ customer_domain:
31
+ url: https://customer-account-domain-link.int-api.dvla.gov.uk
32
+
33
+ poirot:
34
+ services:
35
+ addressing:
36
+ base: https://common-services-addressing-link.int-api.dvla.gov.uk
37
+ identity_stub:
38
+ base: https://identity-identity-stub-link.int-api.dvla.gov.uk
39
+ headers:
40
+ Content-Type: "application/json"
@@ -0,0 +1,35 @@
1
+ application_helper:
2
+ services:
3
+ aws:
4
+ vpce_id: 0c9077c8fe760fea6
5
+ driving_licence_channel_api:
6
+ stage_name: ext
7
+ api_id: a88xitdml4
8
+ application_diary:
9
+ stage_name: ext
10
+ api_id: 1h0v1ex2i5
11
+ application_domain:
12
+ stage_name: ext
13
+ api_id: nhlx046br4
14
+ application_process_engine:
15
+ stage_name: ext
16
+ api_id: 4xikwxe17a
17
+ state_machine:
18
+ stage: ext
19
+ account_id: 736948357641
20
+ image_service:
21
+ base_url: https://oh1b5v3xde-vpce-0c9077c8fe760fea6.execute-api.eu-west-2.amazonaws.com/preprod/
22
+ image_utility:
23
+ base_url: https://nzzfur5hr8-vpce-0c9077c8fe760fea6.execute-api.eu-west-2.amazonaws.com/preprod/
24
+ applicant_email:
25
+ email_prefix: <%= ENV.fetch('EMAIL_PREFIX', '') %>
26
+ email_domain: <%= ENV.fetch('EMAIL_DOMAIN', 'dvla.msdc.co') %>
27
+
28
+ poirot:
29
+ services:
30
+ addressing:
31
+ base: https://common-services-addressing-link.int-api.dvla.gov.uk
32
+ identity_stub:
33
+ base: https://identity-identity-stub-link.int-api.dvla.gov.uk
34
+ headers:
35
+ Content-Type: 'application/json'
@@ -0,0 +1,35 @@
1
+ application_helper:
2
+ services:
3
+ aws:
4
+ vpce_id: 0c9077c8fe760fea6
5
+ driving_licence_channel_api:
6
+ stage_name: link
7
+ api_id: f4mwdzovfb
8
+ application_diary:
9
+ stage_name: link
10
+ api_id: 8udjdqaoy4
11
+ application_domain:
12
+ stage_name: link
13
+ api_id: ehjf4jjgz4
14
+ application_process_engine:
15
+ stage_name: link
16
+ api_id: ugfo40du36
17
+ state_machine:
18
+ stage: link
19
+ account_id: 736948357641
20
+ image_service:
21
+ base_url: https://flvh6n0yx6-vpce-0c9077c8fe760fea6.execute-api.eu-west-2.amazonaws.com/link/
22
+ image_utility:
23
+ base_url: https://r8t8c9sl7g-vpce-0c9077c8fe760fea6.execute-api.eu-west-2.amazonaws.com/link/
24
+ applicant_email:
25
+ email_prefix: <%= ENV.fetch('EMAIL_PREFIX', '') %>
26
+ email_domain: <%= ENV.fetch('EMAIL_DOMAIN', 'dvla.msdc.co') %>
27
+
28
+ poirot:
29
+ services:
30
+ addressing:
31
+ base: https://common-services-addressing-link.int-api.dvla.gov.uk
32
+ identity_stub:
33
+ base: https://identity-identity-stub-link.int-api.dvla.gov.uk
34
+ headers:
35
+ Content-Type: "application/json"
@@ -0,0 +1,35 @@
1
+ application_helper:
2
+ services:
3
+ aws:
4
+ vpce_id: 0c9077c8fe760fea6
5
+ driving_licence_channel_api:
6
+ stage_name: perf
7
+ api_id: j64krkvhc3
8
+ application_diary:
9
+ stage_name: perf
10
+ api_id: m14vif8hpb
11
+ application_domain:
12
+ stage_name: perf
13
+ api_id: wemjsgw805
14
+ application_process_engine:
15
+ stage_name: perf
16
+ api_id: 4xikwxe17a
17
+ state_machine:
18
+ stage: perf
19
+ account_id: 736948357641
20
+ image_service:
21
+ base_url: https://oh1b5v3xde-vpce-0c9077c8fe760fea6.execute-api.eu-west-2.amazonaws.com/preprod/
22
+ image_utility:
23
+ base_url: https://nzzfur5hr8-vpce-0c9077c8fe760fea6.execute-api.eu-west-2.amazonaws.com/preprod/
24
+ applicant_email:
25
+ email_prefix: <%= ENV.fetch('EMAIL_PREFIX', '') %>
26
+ email_domain: <%= ENV.fetch('EMAIL_DOMAIN', 'dvla.msdc.co') %>
27
+
28
+ poirot:
29
+ services:
30
+ addressing:
31
+ base: https://common-services-addressing-link.int-api.dvla.gov.uk
32
+ identity_stub:
33
+ base: https://identity-identity-stub-link.int-api.dvla.gov.uk
34
+ headers:
35
+ Content-Type: 'application/json'
@@ -0,0 +1,29 @@
1
+ logs:
2
+ log_level: DEBUG
3
+
4
+ customer_id: '01102e86-26fe-4068-b654-7e3524d1a090'
5
+
6
+ application_helper:
7
+ applicant_email:
8
+ email_prefix: <%= ENV.fetch('EMAIL_PREFIX', 'dvla-tyr') %>
9
+ email_domain: <%= ENV.fetch('EMAIL_DOMAIN', 'dvla.msdc.co') %>
10
+
11
+ yarp:
12
+ enabled: <%= ENV.fetch('YARP_ENABLED', false) %>
13
+
14
+ test:
15
+ product_type: [Vehicles,Driving Licence,Test]
16
+ # driverId's below are static ids used within the DL channel api stub, allows aps to pass through eligibility and validation with the required response
17
+ driver_id:
18
+ always_duplicate: 8053dc90-a91c-4ee4-88c3-d89c114661bc
19
+ always_replacement: 16112ae7-77f5-4a1c-a615-c3e82244a692
20
+ always_exchange: 21b6e437-8f0c-42ae-8b61-62d53f377841
21
+ optional_cop: cef7f25e-a799-40cb-88c4-ec2a5e5e5fad
22
+ mandatory_tyr: fb2e0dff-b948-4337-84b4-adfd668f68fd
23
+ paper_duplicate: 06ab86ce-7775-4848-84f0-df19406ee951
24
+ paper_replacement: fdd8d5b1-ea21-440f-814a-6ae0e272e9c5
25
+
26
+ application:
27
+ v1_schema: https://osl-data-dictionary-schemas.engineering.dvla.gov.uk/driving-licence-application/applications/v1/update-ordinary-driving-licence-application.json#properties/data
28
+ v2_schema: https://osl-data-dictionary-schemas.engineering.dvla.gov.uk/driving-licence-application/applications/v2/update-ordinary-driving-licence-application.json
29
+ v3_schema: https://osl-data-dictionary-schemas.engineering.dvla.gov.uk/driving-licence-application/applications/v3/update-ordinary-driving-licence-application.json
data/config/yarp.yml ADDED
@@ -0,0 +1,6 @@
1
+ #api_key: <%= ENV['YARP_api_key'] || nil %> # Set YARP_BUILD_NUMBER | Likely to be set in your CI/CD pipeline
2
+ #build_number: # Set YARP_BUILD_NUMBER | Likely to be set in your CI/CD pipeline
3
+ endpoint: https://yarp.prod.tooling.dvla.gov.uk/
4
+ error_limit: 5
5
+ launch:
6
+ project: ap/drivers-application-helper-gem
@@ -0,0 +1,74 @@
1
+ require 'bundler/setup'
2
+ Bundler.require
3
+
4
+ require 'chutney'
5
+ require 'chutney/formatter'
6
+ require 'chutney/formatter/rainbow_formatter'
7
+ require 'config'
8
+ require 'pastel'
9
+ require 'parallel_tests'
10
+ require 'open3'
11
+
12
+ pastel = Pastel.new
13
+ parallel = ParallelTests::CLI.new
14
+ test_formatter = ENV['YARP_ENABLED'] == 'true' ? 'DVLA::Yarp::Cucumber' : 'pretty'
15
+
16
+ task default: ['test:functional']
17
+
18
+ desc 'Scan for unused step definitions'
19
+ task :unused_step_defs do
20
+ puts pastel.yellow('Starting scan for unused step definitions...')
21
+ command_string = "bundle exec cucumber --dry-run --format stepdefs | grep -B1 'NOT MATCHED BY ANY STEPS' | grep -v 'NOT MATCHED BY ANY STEPS' | grep -v 'be axe clean'"
22
+ stdout, _stderr, _status = Open3.capture3(command_string)
23
+ # fail build if offence found
24
+ abort("\nI've found some unused step definitions. Please fix the following: \n#{pastel.red(stdout)}\n") unless stdout.empty?
25
+ # if no offence found
26
+ puts pastel.green("\n...No unused step definitions found. Great work!\n")
27
+ end
28
+
29
+ desc 'Scan for undefined step definitions'
30
+ task :undefined_step_defs do
31
+ puts pastel.yellow('Starting scan for undefined step definitions...')
32
+ command_string = "bundle exec cucumber --dry-run --format stepdefs | grep -A 100 'You can implement step definitions for undefined steps with these snippets:'| grep -v 'be axe clean'"
33
+ stdout, _stderr, _status = Open3.capture3(command_string)
34
+
35
+ if stdout.empty?
36
+ puts pastel.green("\n...No undefined step definitions found. Great work!\n")
37
+ else
38
+ abort("\nI've found some undefined step definitions. Please fix the following: \n#{pastel.red(stdout)}\n")
39
+ end
40
+ end
41
+
42
+ desc 'Scan for failure ignores in the drone.yml'
43
+ task :fail_safe do
44
+ container = ''
45
+ file = File.readlines('../.drone.yml')
46
+ file.each do |line|
47
+ line.match?(/- name:*/) ? (container = line) : nil
48
+
49
+ if line.match?(/failure: ignore/) && container.match?(/test/)
50
+ abort(pastel.red("Failure ignore found in tests: #{pastel.red(container)}"))
51
+ elsif line.match?(/failure: ignore/)
52
+ puts "Failure ignore found in:#{pastel.yellow(container)}"
53
+ end
54
+ end
55
+ end
56
+
57
+ desc 'Run linting on functional-tests'
58
+ task :lint do
59
+ sh 'bundle exec chutney'
60
+ sh 'bundle exec rubocop'
61
+ sh 'bundle exec rake unused_step_defs'
62
+ sh 'bundle exec rake undefined_step_defs'
63
+ sh 'bundle exec rake fail_safe'
64
+ end
65
+
66
+ namespace :test do
67
+ desc 'Run the functional test suite'
68
+ task :functional, %i[cucumber_path threads] do |_t, args|
69
+ puts "running function tests with path #{args[:cucumber_path]}"
70
+ puts "test_formatter is: #{test_formatter}"
71
+ puts "number of threads is: #{args[:threads]}"
72
+ parallel.run(%W[-n #{args[:threads]} --type cucumber --group-by scenarios --serialize-stdout -- -f #{test_formatter} --out /dev/null -f progress -t #{'not @wip'} --retry 1 -- #{args[:cucumber_path]}])
73
+ end
74
+ end
@@ -0,0 +1,110 @@
1
+ AvoidOutlineForSingleExample:
2
+ Enabled: false
3
+ # Revert this back to true once V3 updates have all gone in and tests uncommented
4
+
5
+ AvoidPeriod:
6
+ Enabled: true
7
+
8
+ AvoidScripting:
9
+ Enabled: true
10
+
11
+ avoid_splat_steps_in_background:
12
+ Enabled: true
13
+
14
+ avoid_splat_steps_in_scenarios:
15
+ Enabled: true
16
+
17
+ AvoidTypographersQuotes:
18
+ Enabled: true
19
+
20
+ BackgroundDoesMoreThanSetup:
21
+ Enabled: true
22
+
23
+ BackgroundRequiresMultipleScenarios:
24
+ Enabled: true
25
+
26
+ BadScenarioName:
27
+ Enabled: true
28
+
29
+ BeDeclarative:
30
+ Enabled: true
31
+
32
+ FileNameDiffersFeatureName:
33
+ Enabled: true
34
+
35
+ GivensAfterBackground:
36
+ Enabled: true
37
+
38
+ MissingExampleName:
39
+ Enabled: true
40
+
41
+ MissingFeatureDescription:
42
+ Enabled: true
43
+
44
+ MissingFeatureName:
45
+ Enabled: true
46
+
47
+ MissingScenarioName:
48
+ Enabled: true
49
+
50
+ MissingScenarioOutline:
51
+ Enabled: true
52
+
53
+ MissingTestAction:
54
+ Enabled: true
55
+
56
+ MissingVerification:
57
+ Enabled: true
58
+
59
+ InvalidFileName:
60
+ Enabled: true
61
+
62
+ InvalidStepFlow:
63
+ Enabled: true
64
+
65
+ RequiredTagsStartsWith:
66
+ Enabled: true
67
+
68
+ SameTagDifferentCase:
69
+ Enabled: true
70
+
71
+ SameTagForAllScenarios:
72
+ Enabled: true
73
+
74
+ ScenarioNamesMatch:
75
+ Enabled: true
76
+ Matcher: ^AC.*
77
+
78
+ TagUsedMultipleTimes:
79
+ Enabled: true
80
+
81
+ TooClumsy:
82
+ Enabled: false
83
+
84
+ TooManyDifferentTags:
85
+ Enabled: false
86
+
87
+ TooManySteps:
88
+ Enabled: true
89
+
90
+ TooManyTags:
91
+ Enabled: true
92
+
93
+ TooLongStep:
94
+ Enabled: true
95
+ MaxLength: 140
96
+
97
+ UniqueScenarioNames:
98
+ Enabled: true
99
+
100
+ UnknownVariable:
101
+ Enabled: true
102
+
103
+ UnusedVariable:
104
+ Enabled: true
105
+
106
+ UseBackground:
107
+ Enabled: true
108
+
109
+ UseOutline:
110
+ Enabled: false