Skip to content

Commit

Permalink
add functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aktaskaan committed May 17, 2024
1 parent ede303a commit 2038f57
Show file tree
Hide file tree
Showing 8 changed files with 178 additions and 10 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ task functional(type: Test, description: 'Runs the functional tests.', group: 'V
}

finalizedBy {
generateCucumberReports.enabled = true
generateCucumberReports {
doLast{
delete "${rootDir}/BEFTA Report for Functional Tests/"
Expand Down
63 changes: 53 additions & 10 deletions src/functionalTest/resources/features/F-002/F-002.feature
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ Feature: F-002: Get Document Binary Content by Document ID
Then a negative response is received,
And the response has all other details as expected.

#Generic Scenarios for Security
@S-024 @Ignore
Scenario: generic scenario for Unauthorized

@S-025 @Ignore
Scenario: generic scenario for Forbidden

@S-026 @Ignore
Scenario: generic scenario for Unsupported Media Type

@S-114 @Ignore #this scenario is not valid anymore after CCD-3138.
Scenario: must receive an error response when CCD Data Store tries to access Get Document Binary Content API
Given a user with [an active caseworker profile in CCD with full permissions on a document field],
Expand Down Expand Up @@ -108,3 +98,56 @@ Feature: F-002: Get Document Binary Content by Document ID
And it is submitted to call the [Get Binary Content by Document ID] operation of [CCD Case Document AM API],
Then a negative response is received
And the response has all other details as expected.

@S-024
Scenario: must successfully stream a document's binary content
Given a user with [an active caseworker profile in CCD with full permissions on a document field],
And a successful call [by another privileged user to upload a document with mandatory metadata] as in [Default_Document_Upload_Data],
And another successful call [to create a token for case creation] as in [Befta_Jurisdiction2_Default_Token_Creation_Data_For_Case_Creation]
And another successful call [to create a case of this case type] as in [S-020_Case_Create]
When a request is prepared with appropriate values,
And it is submitted to call the [Stream Binary Content by Document ID] operation of [CCD Case Document AM API],
Then a positive response is received,
And the response [contains the binary content for the uploaded document],
And the response has all other details as expected.

@S-025
Scenario: must receive an error response from streaming endpoint for a non existing document id
Given a user with [an active caseworker profile in CCD with full permissions on a document field],
When a request is prepared with appropriate values,
And the request [contains a non existing document id],
And it is submitted to call the [Stream Binary Content by Document ID] operation of [CCD Case Document AM API],
Then a negative response is received,
And the response has all other details as expected.

@S-026
Scenario: must receive an error response from streaming endpoint for a malformed document ID
Given a user with [an active caseworker profile in CCD with full permissions on a document field],
When a request is prepared with appropriate values,
And the request [contains a malformed document ID],
And it is submitted to call the [Stream Binary Content by Document ID] operation of [CCD Case Document AM API],
Then a negative response is received,
And the response has all the details as expected.

@S-027
Scenario: must receive an error response from streaming endpoint for an active caseworker who does not have document access
Given a user with [an active caseworker profile in CCD with limited permissions on a document field],
And a successful call [by another privileged user to upload a document with mandatory metadata] as in [Default_Document_Upload_Data],
And another successful call [to create a token for case creation] as in [Befta_Jurisdiction2_Default_Token_Creation_Data_For_Case_Creation]
And another successful call [to create a case of this case type] as in [S-027_Case_Create]
When a request is prepared with appropriate values,
And the request [contains an active caseworker who does not have document access],
And it is submitted to call the [Stream Binary Content by Document ID] operation of [CCD Case Document AM API],
Then a negative response is received,
And the response has all other details as expected.


#Generic Scenarios for Security
@S-028 @Ignore
Scenario: generic scenario for Unauthorized

@S-029 @Ignore
Scenario: generic scenario for Forbidden

@S-030 @Ignore
Scenario: generic scenario for Unsupported Media Type
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"_guid_": "F-002_Test_Stream_Base",
"_extends_": "F-002-Base-Root",
"productName": "CCD Case Document AM API",
"operationName": "Stream Binary Content by Document ID",
"s2sClientId": "xui_webapp",
"specs": [
"an active caseworker profile in CCD with full permissions on a document field"
],
"method": "GET",
"uri": "/v2/cases/documents/{documentId}/binary"
}
32 changes: 32 additions & 0 deletions src/functionalTest/resources/features/F-002/S-024.td.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"title": "must successfully stream a document's binary content",
"_guid_": "S-024",
"_extends_": "F-002_Test_Stream_Base",
"specs": [
"contains the binary content for the uploaded document"
],
"request": {
"pathVariables": {
"documentId": "${[scenarioContext][childContexts][Default_Document_Upload_Data][customValues][documentIdInTheResponse]}"
}
},
"expectedResponse": {
"_extends_": "Common_200_Response",
"headers": {
"Accept-Ranges": "bytes",
"Content-Disposition": "[[ANYTHING_PRESENT]]",
"Content-Type": "[[ANYTHING_PRESENT]]",
"data-source": "contentURI",
"OriginalFileName": "[[ANYTHING_PRESENT]]",
"Content-Encoding": "gzip",
"Transfer-Encoding": "chunked"
},
"body": {
"__fileInBody__": {
"fullPath": "file",
"size": "[[ANYTHING_PRESENT]]",
"contentHash": "hash"
}
}
}
}
23 changes: 23 additions & 0 deletions src/functionalTest/resources/features/F-002/S-025.td.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"title": "must receive an error response from streaming endpoint for a non existing document id",
"_guid_": "S-025",
"_extends_": "F-002_Test_Stream_Base",
"specs": [
"contains a non existing document id"
],
"request": {
"pathVariables": {
"documentId": "00000000-0000-0000-0000-000000000000"
}
},
"expectedResponse": {
"_extends_": "AM_404_Response",
"headers": {
"Content-Type": "application/json",
"Content-Length": "[[ANYTHING_PRESENT]]"
},
"body": {
"error": "Meta data does not exist for documentId: 00000000-0000-0000-0000-000000000000"
}
}
}
23 changes: 23 additions & 0 deletions src/functionalTest/resources/features/F-002/S-026.td.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"title": "must receive an error response from streaming endpoint for a malformed document ID",
"_guid_": "S-026",
"_extends_": "F-002_Test_Stream_Base",
"specs": [
"contains a malformed document ID"
],
"request": {
"pathVariables": {
"documentId": "8de9957b-d7a6-40a1-@£$&-6aac30d33644"
}
},
"expectedResponse": {
"_extends_": "AM_400_Response",
"headers": {
"Content-Type": "application/json",
"Content-Length": "[[ANYTHING_PRESENT]]"
},
"body": {
"error": "[[ANYTHING_PRESENT]]"
}
}
}
30 changes: 30 additions & 0 deletions src/functionalTest/resources/features/F-002/S-027.td.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"title": "must receive an error response from streaming endpoint for an active caseworker who does not have document access",
"_guid_": "S-027",
"_extends_": "F-002_Test_Stream_Base",
"specs": [
"an active caseworker profile in CCD with limited permissions on a document field",
"contains an active caseworker who does not have document access"
],
"users": {
"invokingUser": {
"username": "[email protected]",
"password": "[[$CCD_BEFTA_CASEWORKER_2_SOLICITOR_1_PWD]]"
}
},
"request": {
"pathVariables": {
"documentId": "${[scenarioContext][childContexts][Default_Document_Upload_Data][customValues][documentIdInTheResponse]}"
}
},
"expectedResponse": {
"_extends_": "AM_404_Response",
"headers": {
"Content-Type": "application/json",
"Content-Length": "[[ANYTHING_PRESENT]]"
},
"body": {
"error": "Case reference ${[scenarioContext][childContexts][S-027_Case_Create][testData][actualResponse][body][id]} not found for requested document."
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"_guid_": "S-027_Case_Create",
"_extends_": "Befta_Jurisdiction2_Default_Full_Case_Creation_Data"
}

0 comments on commit 2038f57

Please sign in to comment.