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
@@ -0,0 +1,170 @@
1
+ Feature: CODL
2
+ As a Test engineer
3
+ I want to ensure that CODL test applications can be built using a variety of flags
4
+ So that they can be used to functionally test each of our components
5
+
6
+ Scenario: AC-01a Create a NON processable app and ensure it exists in the domain
7
+ When I create a "non-processable" "CODL" application
8
+ Then the application exists within the database
9
+
10
+ Scenario: AC-01b Create processable app and ensure state machine is on preparation hook and in a running state
11
+ When I create a "processable" "CODL" application
12
+ Then the application exists within the database
13
+ And I allow the state machine time to be started
14
+ And the application process engine fulfilment execution has a status of "RUNNING"
15
+ And the state machine is waiting on the PreparationHook
16
+
17
+ Scenario: AC-02a Create NON processable app with passport images flag and ensure it exists in domain
18
+ When I create a "non-processable" "CODL" application with "with_passport_images" flag
19
+ Then the application exists within the database
20
+ And the application has Passport images
21
+
22
+ Scenario: AC-02b Create processable app with passport images flag and ensure state machine is on preparation hook and in a running state
23
+ When I create a "processable" "CODL" application with "with_passport_images" flag
24
+ Then the application exists within the database
25
+ And the application has Passport images
26
+ And I allow the state machine time to be started
27
+ And the application process engine fulfilment execution has a status of "SUCCEEDED"
28
+
29
+ @delete_images
30
+ Scenario: AC-03a Create NON processable app with unique images flag and add ensure it exists in domain
31
+ When I create a "non-processable" "CODL" application with "unique_images" flag
32
+ Then the application exists within the database
33
+ And the application has unique_image_ids for photos and signatures
34
+
35
+ @delete_images
36
+ Scenario: AC-03b Create processable app with unique images flag and ensure state machine is on preparation hook and in a running state
37
+ When I create a "processable" "CODL" application with "unique_images" flag
38
+ Then the application exists within the database
39
+ And the application has unique_image_ids for photos and signatures
40
+ And I allow the state machine time to be started
41
+ And the state machine is waiting on the PreparationHook
42
+
43
+ Scenario: AC-03c NON processable app which contains the static_image ids
44
+ When I create a "non-processable" "CODL" application
45
+ Then the application exists within the database
46
+ And the application has static_image_ids for photos and signatures
47
+
48
+ Scenario: AC-03d Create processable app with static_image ids, ensure retrieved application contains them and ensure state machine is on preparation hook and in a running state
49
+ When I create a "processable" "CODL" application
50
+ Then the application exists within the database
51
+ And the application has static_image_ids for photos and signatures
52
+ And I allow the state machine time to be started
53
+ And the application process engine fulfilment execution has a status of "RUNNING"
54
+ And the state machine is waiting on the PreparationHook
55
+
56
+ Scenario: AC-04a Create NON processable app with a home office comparison photo
57
+ When I create a "non-processable" "CODL" application with "with_home_office_comparison_photo" flag
58
+ Then the application exists within the database
59
+ And the application has a Home Office image
60
+
61
+ Scenario: AC-04b Create processable app with a home office comparison photo, ensure retrieved application contains them and ensure state machine is on preparation hook and in a running state
62
+ When I create a "processable" "CODL" application with "with_home_office_comparison_photo" flag
63
+ Then the application exists within the database
64
+ And the application has a Home Office image
65
+ And I allow the state machine time to be started
66
+ And the application process engine fulfilment execution has a status of "RUNNING"
67
+ And the state machine is waiting on the PreparationHook
68
+
69
+ Scenario: AC-10a Create NON processable app with 'has_phone_number' and add it into domain
70
+ When I create a "non-processable" "CODL" application with "has_phone_number" flag
71
+ Then the application exists within the database
72
+ And the application contains a phone number
73
+
74
+ Scenario: AC-10b Create processable app with user 'has_phone_number' and ensure state machine is on preparation hook and in a running state
75
+ When I create a "processable" "CODL" application with "has_phone_number" flag
76
+ Then the application exists within the database
77
+ And the application contains a phone number
78
+ And I allow the state machine time to be started
79
+ And the application process engine fulfilment execution has a status of "RUNNING"
80
+ And the state machine is waiting on the PreparationHook
81
+
82
+ Scenario: AC-11 Create NON processable app with 'with_customer_id' and add it into domain
83
+ When I create a "non-processable" "CODL" application with "with_customer_id" flag
84
+ Then the application exists within the database
85
+ And the application contains the seeded customer id
86
+
87
+ # AC-11b Cannot create a processable CODL app with a custom customer_id in the dev environment, as the customer_id is used by the channel-api-stub
88
+
89
+ Scenario Outline: AC-12a Create NON processable app with 'is_organ_donor' and add it into domain
90
+ Given organ_donation is set to <organ_donation>
91
+ When I create a "non-processable" "CODL" application with "is_organ_donor" flag
92
+ Then the application exists within the database
93
+ And the application any_organs field is <organ_donation>
94
+ Examples:
95
+ | organ_donation |
96
+ | true |
97
+ | false |
98
+
99
+ Scenario Outline: AC-12b Create processable app with user 'is_organ_donor' and ensure state machine is on preparation hook and in a running state
100
+ Given organ_donation is set to <organ_donation>
101
+ When I create a "processable" "CODL" application with "is_organ_donor" flag
102
+ Then the application exists within the database
103
+ And the application any_organs field is <organ_donation>
104
+ And I allow the state machine time to be started
105
+ And the application process engine fulfilment execution has a status of "RUNNING"
106
+ And the state machine is waiting on the PreparationHook
107
+ Examples:
108
+ | organ_donation |
109
+ | true |
110
+ | false |
111
+
112
+ Scenario: AC-13a Create NON processable app with 'with_payments' and add it into domain
113
+ When I create a "non-processable" "CODL" application with "with_payments" flag
114
+ Then the application exists within the database
115
+ And the application contains the seeded payment
116
+
117
+ Scenario: AC-13b Create processable app and ensure a payment is present and state machine is on preparation hook and in a running state
118
+ When I create a "processable" "CODL" application
119
+ Then the application exists within the database
120
+ And the application contains a payment object
121
+ And I allow the state machine time to be started
122
+ And the application process engine fulfilment execution has a status of "RUNNING"
123
+ And the state machine is waiting on the PreparationHook
124
+
125
+ Scenario: AC-14a Create NON processable app with 'with_applicant' and add it into domain
126
+ When I create a "non-processable" "CODL" application with "with_applicant" flag
127
+ Then the application exists within the database
128
+ And the application contains the seeded applicant
129
+
130
+ Scenario: AC-14b Create processable app with user 'with_applicant' and ensure state machine is on preparation hook and in a running state
131
+ When I create a "processable" "CODL" application with "with_applicant" flag
132
+ Then the application exists within the database
133
+ And the application contains the seeded applicant
134
+ And I allow the state machine time to be started
135
+ And the application process engine fulfilment execution has a status of "RUNNING"
136
+ And the state machine is waiting on the PreparationHook
137
+
138
+ Scenario Outline: AC-17a Create NON processable app with 'with_application_status' and add it into domain
139
+ Given I want the application to have the specific status of "<app status>"
140
+ When I create a "non-processable" "CODL" application with "with_application_status" flag
141
+ Then the application exists within the database
142
+ And the application status matches "<app status>"
143
+ Examples:
144
+ | app status |
145
+ | Started |
146
+ | Received |
147
+ | Payment settlement requested |
148
+ | Preparing |
149
+ | Submitted |
150
+ | Approved |
151
+ | Returned |
152
+ | Unapproved |
153
+ | Rejected |
154
+ | Cancelled |
155
+ | Deleted |
156
+
157
+ # This is a sense check, processable apps cannot have a different status passed in, it will always be Started!, need to update the helper code to handle the flags better
158
+ Scenario: AC-17b Create processable app with user 'with_application_status' and ensure state machine is on preparation hook and in a running state
159
+ Given I want the application to have a random status which is not Started
160
+ When I create a "processable" "CODL" application with "with_application_status" flag
161
+ Then the application exists within the database
162
+ And the application status matches "Started"
163
+ And I allow the state machine time to be started
164
+ And the application process engine fulfilment execution has a status of "RUNNING"
165
+ And the state machine is waiting on the PreparationHook
166
+
167
+ Scenario: AC-18a Create NON processable app with 'extend_application_deadline' and add it into domain
168
+ When I create a "non-processable" "CODL" application with "extend_application_deadline" flag
169
+ Then the application exists within the database
170
+ And the application contains the call to action field
@@ -0,0 +1,140 @@
1
+ Feature: CODL Image Review States
2
+ As a Test engineer
3
+ I want to ensure that CODL image review states update correctly
4
+ So that they can be used to functionally test each of our components
5
+ # These tests have been seperated from main UODL feature to help speed up the pipeline
6
+
7
+ Scenario Outline: AC-16a Create NON processable app with 'with_photo_review_state' and add it into domain and ensure images review update correctly
8
+ Given I want a specific Photo review state of "<review state>" to be set
9
+ When I create a "non-processable" "CODL" application with "with_photo_review_state" flag
10
+ Then the application exists within the database
11
+ And the application contains the seeded Photo review state of "<review state>"
12
+
13
+ Examples:
14
+ | review state |
15
+ | CLERK_IN_PROGRESS |
16
+ | CLERK_REJECTED |
17
+ | CLERK_REFER_TO_SUPERVISOR_STANDARDS |
18
+ | CLERK_REFER_TO_SUPERVISOR_COMPARE |
19
+ | CLERK_APPROVED |
20
+ | SUPERVISOR_REJECTED |
21
+ | SUPERVISOR_REFER_TO_FRAUD |
22
+ | SUPERVISOR_APPROVED |
23
+ | FRAUD_BEGIN_INVESTIGATION |
24
+ | FRAUD_APPROVED |
25
+ | FRAUD_REJECTED |
26
+ | FRAUD_REVIEW_REJECTION_WITH_REFUND |
27
+ | FRAUD_REVIEW_REJECTION_WITHOUT_REFUND |
28
+ | FRAUD_REVIEW_APPROVED |
29
+
30
+ Scenario Outline: AC-16b Create processable app with 'with_photo_review_state' and add it into domain and ensure images review update correctly for rejected states
31
+ Given I want a specific Photo review state of "<review state>" to be set
32
+ And I want a specific Signature review state of "CLERK_APPROVED" to be set
33
+ And I create a "processable" "CODL" application with "with_photo_review_state,with_signature_review_state" flag
34
+ And I allow the application actions time to be updated
35
+ When the application exists within the database
36
+ Then the application contains the seeded Photo review state of "<review state>"
37
+ And I allow the state machine time to be started
38
+ And the application process engine fulfilment execution has a status of "RUNNING"
39
+ And the state machine is waiting on the PreparationHook
40
+
41
+ Examples:
42
+ | review state |
43
+ | CLERK_IN_PROGRESS |
44
+ | CLERK_REJECTED |
45
+ | CLERK_REFER_TO_SUPERVISOR_STANDARDS |
46
+ | CLERK_REFER_TO_SUPERVISOR_COMPARE |
47
+ | SUPERVISOR_REJECTED |
48
+ | SUPERVISOR_REFER_TO_FRAUD |
49
+ | FRAUD_BEGIN_INVESTIGATION |
50
+ | FRAUD_REJECTED |
51
+
52
+ Scenario Outline: AC-16c Create processable app with 'with_photo_review_state' and add it into domain and ensure images review update correctly and app succeeds
53
+ Given I want a specific Photo review state of "<review state>" to be set
54
+ And I want a specific Signature review state of "CLERK_APPROVED" to be set
55
+ And I create a "processable" "CODL" application with "with_photo_review_state,with_signature_review_state" flag
56
+ And I allow the application actions time to be updated
57
+ When the application exists within the database
58
+ Then the application contains the seeded Photo review state of "<review state>"
59
+ And I allow the state machine time to be started
60
+ And the application process engine fulfilment execution has a status of "SUCCEEDED"
61
+
62
+ Examples:
63
+ | review state |
64
+ | CLERK_APPROVED |
65
+ | SUPERVISOR_APPROVED |
66
+ | FRAUD_APPROVED |
67
+ | FRAUD_REVIEW_APPROVED |
68
+ | FRAUD_REVIEW_REJECTION_WITH_REFUND |
69
+ | FRAUD_REVIEW_REJECTION_WITHOUT_REFUND |
70
+
71
+ Scenario Outline: AC-16d Create NON processable app with 'with_signature_review_state' and add it into domain and ensure images review update correctly
72
+ Given I want a specific Signature review state of "<review state>" to be set
73
+ When I create a "non-processable" "CODL" application with "with_signature_review_state" flag
74
+ Then the application exists within the database
75
+ And the application contains the seeded Signature review state of "<review state>"
76
+
77
+ Examples:
78
+ | review state |
79
+ | CLERK_IN_PROGRESS |
80
+ | CLERK_REJECTED |
81
+ | CLERK_APPROVED |
82
+
83
+ Scenario: AC-16e Create processable app with 'with_signature_review_state' and add it into domain and ensure images review update correctly for rejected states
84
+ Given I want a specific Signature review state of "CLERK_IN_PROGRESS" to be set
85
+ And I want a specific Photo review state of "CLERK_APPROVED" to be set
86
+ And I create a "processable" "CODL" application with "with_signature_review_state,with_photo_review_state" flag
87
+ And I allow the application actions time to be updated
88
+ When the application exists within the database
89
+ Then the application contains the seeded Signature review state of "CLERK_IN_PROGRESS"
90
+ And I allow the state machine time to be started
91
+ And the application process engine fulfilment execution has a status of "RUNNING"
92
+ And the state machine is waiting on the PreparationHook
93
+
94
+ Scenario: AC-16f Create processable app with 'with_signature_review_state' and add it into domain and ensure images review update correctly and app succeeds
95
+ Given I want a specific Signature review state of "CLERK_APPROVED" to be set
96
+ And I want a specific Photo review state of "CLERK_APPROVED" to be set
97
+ And I create a "processable" "CODL" application with "with_signature_review_state,with_photo_review_state" flag
98
+ And I allow the application actions time to be updated
99
+ When the application exists within the database
100
+ Then the application contains the seeded Signature review state of "CLERK_APPROVED"
101
+ And I allow the state machine time to be started
102
+ And the application process engine fulfilment execution has a status of "SUCCEEDED"
103
+
104
+ Scenario: AC-16g Create processable app with 'with_signature_review_state' and add it into domain and ensure images review update correctly for rejected states
105
+ Given I want a specific Signature review state of "CLERK_REJECTED" to be set
106
+ And I want a specific Photo review state of "CLERK_APPROVED" to be set
107
+ And I create a "processable" "CODL" application with "with_signature_review_state,with_photo_review_state" flag
108
+ And I allow the application actions time to be updated
109
+ When the application exists within the database
110
+ Then the application contains the seeded Signature review state of "CLERK_REJECTED"
111
+ And I allow the state machine time to be started
112
+ And the application process engine fulfilment execution has a status of "RUNNING"
113
+ And the state machine is waiting on the PreparationHook
114
+
115
+ Scenario Outline: AC-16h Create processable app with 'with_photo_review_state' and add it into domain and ensure images review update correctly and app succeeds
116
+ Given I want a specific Photo review state of "<review state>" to be set
117
+ And I create a "processable" "CODL" application with "with_home_office_comparison_photo,with_photo_review_state" flag
118
+ And I allow the application actions time to be updated
119
+ When the application exists within the database
120
+ Then the application contains the seeded Comparison review state of "<review state>"
121
+ And I allow the state machine time to be started
122
+ And the application process engine fulfilment execution has a status of "SUCCEEDED"
123
+
124
+ Examples:
125
+ | review state |
126
+ | CLERK_REJECT_COMPARISON_PHOTO |
127
+ | FRAUD_REJECT_COMPARISON_PHOTO |
128
+ | SUPERVISOR_REJECT_COMPARISON_PHOTO |
129
+
130
+ Scenario Outline: AC-16i Create NON processable app with 'with_photo_review_state' and add it into domain and ensure images review update correctly
131
+ Given I want a specific Photo review state of "<review state>" to be set
132
+ When I create a "non-processable" "CODL" application with "with_home_office_comparison_photo,with_photo_review_state" flag
133
+ Then the application exists within the database
134
+ And the application contains the seeded Comparison review state of "<review state>"
135
+
136
+ Examples:
137
+ | review state |
138
+ | CLERK_REJECT_COMPARISON_PHOTO |
139
+ | FRAUD_REJECT_COMPARISON_PHOTO |
140
+ | SUPERVISOR_REJECT_COMPARISON_PHOTO |
@@ -0,0 +1,54 @@
1
+ Feature: CSUDL
2
+
3
+ As a Test engineer
4
+ I want to ensure that CSUDL test applications can be built using a variety of flags
5
+ So that they can be used to functionally test each of our components
6
+
7
+ Scenario: AC-01a Create NON processable CSUDL app with no flags, add it into domain
8
+ When I create a "non-processable" "CSUDL" application
9
+ Then the application exists within the database
10
+ And the CSUDL application contains the correct images
11
+
12
+ Scenario: AC-01b Create NON processable CSUDL app with passport photo flag and ensure it exists in domain
13
+ When I create a "non-processable" "CSUDL" application with "with_passport_images" flag
14
+ Then the application exists within the database
15
+ And the application has Passport images
16
+
17
+ Scenario Outline: AC-02a Create NON processable app with each application status, add it into domain
18
+ Given I want the application to have the specific status of "<app status>"
19
+ When I create a "non-processable" "CSUDL" application with "with_application_status" flag
20
+ Then the application exists within the database
21
+ And the application status matches "<app status>"
22
+ Examples:
23
+ | app status |
24
+ | Started |
25
+ | Received |
26
+ | Payment settlement requested |
27
+ | Preparing |
28
+ | Submitted |
29
+ | Approved |
30
+ | Returned |
31
+ | Unapproved |
32
+ | Cancelled |
33
+ | Rejected |
34
+ | Deleted |
35
+
36
+ Scenario: AC-02b Create NON processable CSUDL app with licence possession reason, add it into domain
37
+ When I create a "non-processable" "CSUDL" application with "with_unable_to_prove_licence_possession_reason" flag
38
+ Then the application exists within the database
39
+ And the application contains an unable to prove licence possession reason of "LOST_OR_STOLEN"
40
+
41
+ Scenario: AC-02c Create NON processable CSUDL app with photo compliance, add it into domain
42
+ When I create a "non-processable" "CSUDL" application with "with_photo_compliance_checks" flag
43
+ Then the application exists within the database
44
+ And the application contains photo compliance checks
45
+
46
+ Scenario: AC-02d Create NON processable CSUDL app with licence data, add it into domain
47
+ When I create a "non-processable" "CSUDL" application with "with_licence_data" flag
48
+ Then the application exists within the database
49
+ And the application contains licence data
50
+
51
+ Scenario: AC-02e Create NON processable CSUDL app with updateAddress, add it into domain
52
+ When I create a "non-processable" "CSUDL" application with "with_update_address" flag
53
+ Then the application exists within the database
54
+ And the application contains the address to be updated
@@ -0,0 +1,20 @@
1
+ Feature: CSUDL Image Review States
2
+
3
+ As a Test engineer
4
+ I want to ensure that CSUDL image review states update correctly
5
+ So that they can be used to functionally test each of our components
6
+
7
+ # These tests have been seperated from main CSUDL feature to help speed up the pipeline
8
+
9
+ Scenario Outline: AC-02 Create NON processable app with 'with_review_state' and add it into domain and ensure images review update correctly
10
+ Given I want a specific Photo review state of "<review state>" to be set
11
+ When I create a "non-processable" "CSUDL" application with "with_photo_review_state" flag
12
+ Then the application exists within the database
13
+ And the CSUDL application contains the seeded Photo review state of "<review state>"
14
+ Examples:
15
+ | review state |
16
+ | CLERK_IN_PROGRESS |
17
+ | CLERK_REJECTED |
18
+ | CLERK_REFER_TO_SUPERVISOR_STANDARDS |
19
+ | CLERK_REFER_TO_SUPERVISOR_COMPARE |
20
+ | CLERK_APPROVED |
@@ -0,0 +1,213 @@
1
+ Then(/^the application exists within the database$/) do
2
+ artefacts.retrieved_application = DVLA::Application::ApplicationDomain.retrieve_application_by_app_id(application_id: artefacts.submitted_application.application_id)
3
+
4
+ # iterate through the retrieved application object and check them against the submitted application
5
+ artefacts.retrieved_application.instance_variable_names.each do |field|
6
+ LOG.info "checking if fields match for: #{field}"
7
+
8
+ # added conditional here to ignore images array when a review state is passed in, images review history checked in another step and will differ from original seeded images
9
+ if artefacts.review_state.nil? && artefacts.signature_review_state.nil? && field != '@images'
10
+ expect(artefacts.retrieved_application.instance_variable_get(field)).to eq(artefacts.submitted_application.instance_variable_get(field)), "Error, #{field} does not match between submitted and retrieved application"
11
+ end
12
+ end
13
+ end
14
+
15
+ Given(/^organ_donation is set to (true|false)$/) do |organ_donor|
16
+ # sets organ_donor boolean
17
+ artefacts.organ_donor = organ_donor == 'true'
18
+ end
19
+
20
+ And(/^the application has welsh language preference$/) do
21
+ LOG.info 'checking if language preference field matches'
22
+ expect(artefacts.retrieved_application.data.applicant.language_preference).to eq('Welsh'), 'Expected applicant language preference to be welsh'
23
+ end
24
+
25
+ And(/^the application contains a (BFPO|Free Key) address$/) do |address_type|
26
+ expected_class = if address_type == 'BFPO'
27
+ DVLAApplicationDomainServiceOpenAPIClient::BFPOAddress
28
+ else
29
+ DVLAApplicationDomainServiceOpenAPIClient::UnstructuredAddress
30
+ end
31
+
32
+ # logic to handle location of updated address field depending on schema used
33
+ retrieved_address_class = if is_app_v3?(artefacts.retrieved_application.data_schema)
34
+ artefacts.retrieved_application.data.update_address.new_address.class
35
+ else
36
+ artefacts.retrieved_application.data.driving_licence_actions.update_address.new_address.class
37
+ end
38
+ expect(retrieved_address_class).to eq(expected_class), "Expected #{address_type} to match the OpenApiClient class"
39
+ end
40
+
41
+ And(/^the application contains the driver_id in the product_id$/) do
42
+ expect(artefacts.retrieved_application.product_id).to eq(artefacts.driver_id), 'Expected driver_id to be stored within the application.product_id'
43
+ end
44
+
45
+ And(/^the application no fee flag is set to (true|false)$/) do |no_fee_flag|
46
+ expect(artefacts.retrieved_application.no_fee_application).to eq(no_fee_flag.convert_to_bool?), "Expected no_fee flag to be set to: #{no_fee_flag}"
47
+ end
48
+
49
+ And(/^the application contains a phone number$/) do
50
+ expect(artefacts.retrieved_application.data.applicant.phone_number).to_not be_nil, 'Expected Phone number to be present, but field is empty'
51
+ end
52
+
53
+ And(/^the application contains the seeded customer id$/) do
54
+ expect(artefacts.retrieved_application.customer_id).to eq(artefacts.customer_id), 'Expected customer_id to match the seeded customer_id'
55
+ end
56
+
57
+ And(/^the application any_organs field is (true|false)$/) do |any_organ|
58
+ if any_organ.convert_to_bool?
59
+ expect(artefacts.retrieved_application.data.organ_donor.any_organs).to be(any_organ.convert_to_bool?), "Expected any_organs field to be: #{any_organ}"
60
+ else
61
+ expect(artefacts.retrieved_application.data.organ_donor.to_json).to eq('{}'), 'Expected organ_donor to be an empty object'
62
+ end
63
+ end
64
+
65
+ And(/^the application contains the seeded payment$/) do
66
+ expect(artefacts.retrieved_application.payments[0].payment_amount).to eq(artefacts.payment[0][:paymentAmount]), 'Expected application to contain seeded payment amount'
67
+ expect(artefacts.retrieved_application.payments[0].payment_id).to eq(artefacts.payment[0][:paymentId]), 'Expected application to contain seeded paymentId'
68
+ expect(artefacts.retrieved_application.payments[0].payment_status).to eq(artefacts.payment[0][:paymentStatus]), 'Expected application to contain seeded payment status'
69
+ expect(artefacts.retrieved_application.payments[0].payment_reference).to eq(artefacts.payment[0][:paymentReference]), 'Expected application to contain seeded payment reference'
70
+ end
71
+
72
+ And(/^the application contains a payment object$/) do
73
+ expect(artefacts.retrieved_application.payments[0].class).to eq(DVLAApplicationDomainServiceOpenAPIClient::Payment), 'Expected payment object to be of the correct type'
74
+ end
75
+
76
+ And(/^the application contains the seeded applicant$/) do
77
+ # iterate through the submitted applicant fields to check the retrieved ones match
78
+ artefacts.submitted_application.data.applicant.instance_variable_names.each do |field|
79
+ LOG.info "checking if applicant fields match for: #{field}"
80
+ retrieved_field = artefacts.retrieved_application.data.applicant.instance_variable_get(field)
81
+ submitted_field = artefacts.submitted_application.data.applicant.instance_variable_get(field)
82
+ expect(retrieved_field).to eq(submitted_field), "Error, #{field} does not match between submitted and retrieved applicant"
83
+ end
84
+ end
85
+
86
+ And(/^the application contains the driving licence action updateAddress$/) do
87
+ # added logic to handle difference in schema structure between V3 and V1/V2
88
+ if is_app_v3?(artefacts.retrieved_application.data_schema)
89
+ expect(artefacts.retrieved_application.data.instance_variables.include?(:@update_address)).to be(true), 'Error, update address field not present in driving licence actions'
90
+ else
91
+ expect(artefacts.retrieved_application.data.driving_licence_actions.instance_variable_names.include?('@update_address')).to be(true), 'Error, update address field not present in driving licence actions'
92
+ end
93
+ end
94
+
95
+ Given(/^I want the application to have a random status which is not Started$/) do
96
+ artefacts.application_status = ['Received', 'Payment settlement requested', 'Preparing', 'Submitted', 'Approved', 'Returned', 'Unapproved', 'Rejected', 'Completed', 'Deleted', 'Cancelled'].sample
97
+ LOG.info "Setting Application Status to: #{artefacts.application_status}"
98
+ end
99
+
100
+ Given(/^I want the application to have the specific status of "([^"]*)"$/) do |status|
101
+ LOG.info "Setting Application Status to: #{status}"
102
+ artefacts.application_status = status
103
+ end
104
+
105
+ And(/^the application status matches "([^"]*)"$/) do |status|
106
+ retrieved_status = artefacts.retrieved_application.application_state.status
107
+ expect(retrieved_status).to eq(status), "Expected retrieved app status: #{retrieved_status} to match the seeded status of: #{status}"
108
+ end
109
+
110
+ And(/^the application contains the customer context for "([^"]*)"$/) do |context|
111
+ expect(artefacts.retrieved_application.data.customer_context.customer_intent).to eq(context), 'Error, update address field not present in customer context'
112
+ expect(artefacts.retrieved_application.data.customer_context.transaction_outcome).to eq(context), 'Error, update address field not present in customer context'
113
+ end
114
+
115
+ And(/^the application contains the call to action field$/) do
116
+ expect(artefacts.retrieved_application.instance_variable_names.include?('@call_to_action_deadline_date')).to be(true), 'Error, Call to action field not present in the retrieved application'
117
+ expect(artefacts.retrieved_application.call_to_action_deadline_date).not_to be_nil, 'Error, Call to action field not present in the retrieved application'
118
+ end
119
+
120
+ And(/^the application has the correct driving licence action$/) do
121
+ expect(artefacts.retrieved_application.data.driving_licence_actions).to include(artefacts.driving_licence_action), "Error, specified driving licence actions not found
122
+ \nExpected: #{artefacts.driving_licence_action.to_json}
123
+ \nRetrieved: #{artefacts.retrieved_application.data.driving_licence_actions.to_json}"
124
+ end
125
+
126
+ And(/^the application contains the product type$/) do
127
+ expected_product_type = artefacts.product_type
128
+ retrieved_product_type = artefacts.retrieved_application.product_type
129
+ expect(retrieved_product_type).to eq(expected_product_type), "Expected product type: #{expected_product_type}\n Retrieved product type: #{retrieved_product_type}"
130
+ end
131
+
132
+ And(/^the application has the "inform-paper-to-plastic" eligibility$/) do
133
+ expect(artefacts.retrieved_application.data.customer_context.applications_eligibility_response.length).to be >= 1, 'Expected an applications_eligibility_response but found none'
134
+ expect(artefacts.retrieved_application.data.customer_context.applications_eligibility_response[0].application_type).to eq('update-ordinary-licence'), 'Expected the applications_eligibility_response to be for UODL'
135
+ paper_to_plastic_action = artefacts.retrieved_application.data.customer_context.applications_eligibility_response[0].available_actions.find { |item| item.action_type == 'inform-paper-to-plastic' }
136
+ expect(paper_to_plastic_action).not_to be_nil, 'Expected inform-paper-to-plastic eligibility to be present in the applications_eligibility_response'
137
+ end
138
+
139
+ And(/^the application has a reference number starting with "([^"]*)"$/) do |prefix|
140
+ expect(artefacts.retrieved_application.application_reference_number).to start_with(prefix)
141
+ end
142
+
143
+ And(/^the application contains the driver_id in the product_id for (.*)$/) do |application_type|
144
+ expected_driver_id = case application_type
145
+ when 'paper-dup'
146
+ Settings.test.driver_id.paper_duplicate
147
+ when 'paper-rep'
148
+ Settings.test.driver_id.paper_replacement
149
+ else
150
+ raise 'Specified application type does not have a driver id in config'
151
+ end
152
+ expect(artefacts.retrieved_application.product_id).to eq(expected_driver_id), 'Expected driver_id to be stored within the application.product_id'
153
+ end
154
+
155
+ And(/^the CSUDL application contains the correct images$/) do
156
+ user_image = artefacts.retrieved_application.images.find { |image| image.image_type == 'Photo' && image.image_purpose == 'Application' && image.image_origin_type == 'Counter Service' && image.image_source == 'image-utility' }
157
+ comparison_image = artefacts.retrieved_application.images.find { |image| image.image_type == 'Photo' && image.image_purpose == 'Comparison' && image.image_origin_type == 'Driving Licence' && image.image_source == 'image-utility' }
158
+ signature_image = artefacts.retrieved_application.images.find { |image| image.image_type == 'Signature' && image.image_purpose == 'Application' && image.image_origin_type == 'Counter Service' && image.image_source == 'image-utility' }
159
+ front_image = artefacts.retrieved_application.images.find { |image| image.image_type == 'Photocard front' && image.image_purpose == 'Application' && image.image_origin_type == 'Counter Service' && image.image_source == 'image-utility' }
160
+ back_image = artefacts.retrieved_application.images.find { |image| image.image_type == 'Photocard back' && image.image_purpose == 'Application' && image.image_origin_type == 'Counter Service' && image.image_source == 'image-utility' }
161
+
162
+ expect(user_image).not_to be_nil, 'Expected to find a counter service application image in the application images'
163
+ expect(comparison_image).not_to be_nil, 'Expected to find a comparison image in the application images'
164
+ expect(signature_image).not_to be_nil, 'Expected to find a counter service signature image in the application images'
165
+ expect(front_image).not_to be_nil, 'Expected to find a front photocard image in the application images'
166
+ expect(back_image).not_to be_nil, 'Expected to find a back photocard image in the application images'
167
+ end
168
+
169
+ And(/^the application contains an unable to prove licence possession reason of "([^"]*)"$/) do |reason|
170
+ expect(artefacts.retrieved_application.data.unable_to_prove_licence_possession_reason).to eq(reason), 'Error, licence possession field not present in application'
171
+ end
172
+
173
+ And(/^the application contains photo compliance checks$/) do
174
+ expected_compliance = {
175
+ photoOverride: false,
176
+ icaoCompliant: true,
177
+ eyesOpen: true,
178
+ exposure: true,
179
+ frontalView: true,
180
+ greyscaleDensity: true,
181
+ uniformLighting: true,
182
+ headWidth: true,
183
+ headLength: true,
184
+ widthHeightRatio: true,
185
+ resolution: true,
186
+ verticalPosition: true,
187
+ horizontallyCentered: true,
188
+ }
189
+
190
+ expect(artefacts.retrieved_application.data.photo_compliance_checks.as_json).to eq(expected_compliance.as_json), 'Error, photo compliance checks not present in application'
191
+ end
192
+
193
+ And(/^the application contains licence data$/) do
194
+ expected_licence_data = {
195
+ photoCardIssueNumber: '2',
196
+ }
197
+
198
+ expect(artefacts.retrieved_application.data.licence_data.as_json).to eq(expected_licence_data.as_json), 'Error, licence data not present in application'
199
+ end
200
+
201
+ And(/^the application contains the address to be updated$/) do
202
+ expected_update_address = {
203
+ newAddress: {
204
+ unstructuredAddress: {
205
+ line1: 'TEST 5357 Gilberto Forge',
206
+ line5: 'New Lewisfort',
207
+ postcode: 'SA3 1AD',
208
+ },
209
+ },
210
+ }
211
+
212
+ expect(artefacts.retrieved_application.data.update_address.as_json).to eq(expected_update_address.as_json), 'Error, licence possession field not present in application'
213
+ end