Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 33 additions & 11 deletions code/Test_definitions/device-swap-checkDeviceSwap.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Feature: CAMARA Device Swap API, v1.0.0 - Operation checkDeviceSwap
# Input to be provided by the implementation to the tester
#
# Testing assets:
# * A device object which a device swap occured in the last 240 hours.
# * A device object which a device swap occurred in the last 240 hours.
# * for additional testing another device without device swapping last 240 hours.
# References to OAS spec schemas refer to schemas specifies in device-swap.yaml

Expand All @@ -16,7 +16,7 @@ Feature: CAMARA Device Swap API, v1.0.0 - Operation checkDeviceSwap

# This first scenario serves as a minimum, not testing any specific verificationResult
@check_device_swap_1_generic_success_scenario
Scenario: Common validations for any sucess scenario
Scenario: Common validations for any success scenario
Given a valid phone number identified by the token or provided in the request body
When the request "checkDeviceSwap" is sent
Then the response status code is 200
Expand All @@ -25,6 +25,8 @@ Feature: CAMARA Device Swap API, v1.0.0 - Operation checkDeviceSwap
And the response body complies with the OAS schema at "/components/schemas/CheckDeviceSwapInfo"

# Scenarios testing specific situations

# For some Operators, the activation date is considered the first device swap event and if it is within the maxAge it is considered a swap
@check_device_swap_2_valid_device_swap_no_max_age
Scenario: Check that the response shows that the device has been swapped using default value for maxAge
Given a valid phone number identified by the token or provided in the request body
Expand All @@ -33,6 +35,7 @@ Feature: CAMARA Device Swap API, v1.0.0 - Operation checkDeviceSwap
Then the response status code is 200
And the value of response property "$.swapped" == true

# For some Operators, the activation date is considered the first device swap event and if it is within the maxAge it is considered a swap
@check_device_swap_3_valid_device_swap_max_age
Scenario Outline: Check that the response shows that the device has been swapped - maxAge is provided in the request
Given a valid phone number identified by the token or provided in the request body
Expand All @@ -52,7 +55,7 @@ Feature: CAMARA Device Swap API, v1.0.0 - Operation checkDeviceSwap
@check_device_swap_4_more_than_240_hours
Scenario: Check that the response shows that the device has not been swapped when "maxAge" is not set and the last swap was more than 240 (default) hours ago
Given a valid phone number identified by the token or provided in the request body
And the request body property "maxAge" is not setted
And the request body property "maxAge" is not set
And the device has been swapped more than 240 hours ago
When the request "checkDeviceSwap" is sent
Then the response status code is 200
Expand Down Expand Up @@ -93,10 +96,19 @@ Feature: CAMARA Device Swap API, v1.0.0 - Operation checkDeviceSwap
| 24 |
| 12 |

@check_device_swap_8_more_than_monitored_period
Scenario: Check that the response shows that the device has not been swapped when "maxAge" is not set and the last swap was more than outside the monitored period allowed by local regulation
Given a valid phone number identified by the token or provided in the request body
And the request body property "maxAge" is not set
And the device has been swapped outside the monitored period allowed by local regulation
When the request "checkDeviceSwap" is sent
Then the response status code is 200
And the value of response property "$.swapped" == false

# Specific errors

# This scenario may not apply if the Operators's implementation does not allow a valid access token to be issued for a phone number that has never been connected to the network and, therefore, cannot reach the API.
@check_device_swap_8_NoDeviceSwapPhoneNumberNeverConnected
@check_device_swap_422.1_NoDeviceSwapPhoneNumberNeverConnected
Scenario: Error when the phone number has never connected to the Operators's network so the device has never been activated
Given a valid phone number provided in the request body
And the sim for that device has never been connected to the Operator's network
Expand All @@ -108,7 +120,7 @@ Feature: CAMARA Device Swap API, v1.0.0 - Operation checkDeviceSwap

# Test cases related to the device identifier

@check_device_swap_9_C02_01_phone_number_not_schema_compliant
@check_device_swap_C02_01_phone_number_not_schema_compliant
Scenario: Phone number value does not comply with the schema
Given the header "Authorization" is set to a valid access token which does not identify a single phone number
And the request body property "$.phoneNumber" does not comply with the OAS schema at "/components/schemas/PhoneNumber"
Expand All @@ -118,7 +130,7 @@ Feature: CAMARA Device Swap API, v1.0.0 - Operation checkDeviceSwap
And the response property "$.code" is "INVALID_ARGUMENT"
And the response property "$.message" contains a user friendly text

@check_device_swap_10_C02_02_phone_number_not_found
@check_device_swap_C02_02_phone_number_not_found
Scenario: Phone number not found
Given the header "Authorization" is set to a valid access token which does not identify a single phone number
And the request body property "$.phoneNumber" is compliant with the schema but does not identify a valid phone number
Expand All @@ -128,7 +140,7 @@ Feature: CAMARA Device Swap API, v1.0.0 - Operation checkDeviceSwap
And the response property "$.code" is "IDENTIFIER_NOT_FOUND"
And the response property "$.message" contains a user friendly text

@check_device_swap_11_C02_03_unnecessary_phone_number
@check_device_swap_C02_03_unnecessary_phone_number
Scenario: Phone number not to be included when it can be deduced from the access token
Given the header "Authorization" is set to a valid access token identifying a phone number
And the request body property "$.phoneNumber" is set to a valid phone number
Expand All @@ -138,7 +150,7 @@ Feature: CAMARA Device Swap API, v1.0.0 - Operation checkDeviceSwap
And the response property "$.code" is "UNNECESSARY_IDENTIFIER"
And the response property "$.message" contains a user friendly text

@check_device_swap_12_C02_04_missing_phone_number
@check_device_swap_C02_04_missing_phone_number
Scenario: Phone number not included and cannot be deducted from the access token
Given the header "Authorization" is set to a valid access token which does not identify a single phone number
And the request body property "$.phoneNumber" is not included
Expand All @@ -148,7 +160,7 @@ Feature: CAMARA Device Swap API, v1.0.0 - Operation checkDeviceSwap
And the response property "$.code" is "MISSING_IDENTIFIER"
And the response property "$.message" contains a user friendly text

@check_device_swap_13_C02_05_phone_number_not_supported
@check_device_swap_C02_05_phone_number_not_supported
Scenario: Service not available for the phone number
Given that the service is not available for all phone numbers commercialized by the operator
And a valid phone number, identified by the token or provided in the request body, for which the service is not applicable
Expand Down Expand Up @@ -192,7 +204,7 @@ Feature: CAMARA Device Swap API, v1.0.0 - Operation checkDeviceSwap

# Generic 400 errors

@check_device_swap_400.2_invalid_max_age
@check_device_swap_400.1_invalid_max_age
Scenario: Check that the response shows an error when the max age is invalid
Given the request body property "$.maxAge" does not comply with the OAS schema at "/components/schemas/CreateCheckDeviceSwap"
When the HTTP "POST" request is sent
Expand All @@ -201,11 +213,21 @@ Feature: CAMARA Device Swap API, v1.0.0 - Operation checkDeviceSwap
And the response property "$.code" is "INVALID_ARGUMENT"
And the response property "$.message" contains a user friendly text

@check_device_swap_400.3_out_of_range
@check_device_swap_400.2_out_of_range
Scenario: Error when maxAge is out of range
Given the request body property "$.maxAge" is set to a value greater than the allowed range
When the HTTP "POST" request is sent
Then the response status code is 400
And the response property "$.status" is 400
And the response property "$.code" is "OUT_OF_RANGE"
And the response property "$.message" contains a user friendly text

@check_device_swap_400.3_max_age_out_of_monitored_period
Scenario: Check that the response shows an error when the max age is above the supported monitored period of the API Provider
# This test only applies if the API Provider has a restricted monitored period by local regulations
Given the request body property "$.maxAge" is set to a valid value above the supported monitored period of the API Provider
When the request "checkDeviceSwap" is sent
Then the response status code is 400
And the response property "$.status" is 400
And the response property "$.code" is "OUT_OF_RANGE"
And the response property "$.message" contains a user friendly text
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ Feature: CAMARA Device Swap API, v1.0.0 - Operation retrieveDeviceSwapDate
When the request "retrieveDeviceSwapDate" is sent
Then the response status code is 200
And the response property "$.latestDeviceChange" is null
And the response optionally contains the property "$.monitoredPeriod" with the value of monitored time frame (in days) supported by the MNO

# Specific errors

# This test applies if the operator allows to do the request for a sim that has never been connected to the network
@retrieve_device_swap_date_5_not_activated
@retrieve_device_swap_date_422.1_not_activated
Scenario: Error device swap date for a non-activated sim
Given a valid phone number provided in the request body
And the sim for that device has never been connected to the Operator's network
Expand All @@ -67,7 +68,7 @@ Feature: CAMARA Device Swap API, v1.0.0 - Operation retrieveDeviceSwapDate

# Test cases related to the device identifier

@retrieve_device_swap_date_6_C02_01_phone_number_not_schema_compliant
@retrieve_device_swap_date_C02_01_phone_number_not_schema_compliant
Scenario: Phone number value does not comply with the schema
Given the header "Authorization" is set to a valid access token which does not identify a single phone number
And the request body property "$.phoneNumber" does not comply with the OAS schema at "/components/schemas/PhoneNumber"
Expand All @@ -77,7 +78,7 @@ Feature: CAMARA Device Swap API, v1.0.0 - Operation retrieveDeviceSwapDate
And the response property "$.code" is "INVALID_ARGUMENT"
And the response property "$.message" contains a user friendly text

@retrieve_device_swap_date_7_C02_02_phone_number_not_found
@retrieve_device_swap_date_C02_02_phone_number_not_found
Scenario: Phone number not found
Given the header "Authorization" is set to a valid access token which does not identify a single phone number
And the request body property "$.phoneNumber" is compliant with the schema but does not identify a valid phone number
Expand All @@ -87,7 +88,7 @@ Feature: CAMARA Device Swap API, v1.0.0 - Operation retrieveDeviceSwapDate
And the response property "$.code" is "IDENTIFIER_NOT_FOUND"
And the response property "$.message" contains a user friendly text

@retrieve_device_swap_date_8_C02_03_unnecessary_phone_number
@retrieve_device_swap_date_C02_03_unnecessary_phone_number
Scenario: Phone number not to be included when it can be deduced from the access token
Given the header "Authorization" is set to a valid access token identifying a phone number
And the request body property "$.phoneNumber" is set to a valid phone number
Expand All @@ -97,7 +98,7 @@ Feature: CAMARA Device Swap API, v1.0.0 - Operation retrieveDeviceSwapDate
And the response property "$.code" is "UNNECESSARY_IDENTIFIER"
And the response property "$.message" contains a user friendly text

@check_device_swap_9_C02_04_missing_phone_number
@check_device_swap_C02_04_missing_phone_number
Scenario: Phone number not included and cannot be deducted from the access token
Given the header "Authorization" is set to a valid access token which does not identify a single phone number
And the request body property "$.phoneNumber" is not included
Expand All @@ -107,7 +108,7 @@ Feature: CAMARA Device Swap API, v1.0.0 - Operation retrieveDeviceSwapDate
And the response property "$.code" is "MISSING_IDENTIFIER"
And the response property "$.message" contains a user friendly text

@retrieve_device_swap_date_10_C02_05_phone_number_not_supported
@retrieve_device_swap_date_C02_05_phone_number_not_supported
Scenario: Service not available for the phone number
Given that the service is not available for all phone numbers commercialized by the operator
And a valid phone number, identified by the token or provided in the request body, for which the service is not applicable
Expand Down