|
1 | 1 | Feature: GraphQL mutation support
|
| 2 | + |
2 | 3 | @createSchema
|
3 | 4 | Scenario: Introspect types
|
4 | 5 | When I send the following GraphQL request:
|
@@ -30,14 +31,14 @@ Feature: GraphQL mutation support
|
30 | 31 | Then the response status code should be 200
|
31 | 32 | And the response should be in JSON
|
32 | 33 | And the header "Content-Type" should be equal to "application/json"
|
33 |
| - And the JSON node "data.__type.fields[0].name" should contain "delete" |
34 |
| - And the JSON node "data.__type.fields[0].description" should match '/^Deletes a [A-z0-9]+.$/' |
35 |
| - And the JSON node "data.__type.fields[0].type.name" should match "/^delete[A-z0-9]+Payload$/" |
36 |
| - And the JSON node "data.__type.fields[0].type.kind" should be equal to "OBJECT" |
37 |
| - And the JSON node "data.__type.fields[0].args[0].name" should be equal to "input" |
38 |
| - And the JSON node "data.__type.fields[0].args[0].type.kind" should be equal to "NON_NULL" |
39 |
| - And the JSON node "data.__type.fields[0].args[0].type.ofType.name" should match "/^delete[A-z0-9]+Input$/" |
40 |
| - And the JSON node "data.__type.fields[0].args[0].type.ofType.kind" should be equal to "INPUT_OBJECT" |
| 34 | + And the JSON node "data.__type.fields[2].name" should contain "delete" |
| 35 | + And the JSON node "data.__type.fields[2].description" should match '/^Deletes a [A-z0-9]+.$/' |
| 36 | + And the JSON node "data.__type.fields[2].type.name" should match "/^delete[A-z0-9]+Payload$/" |
| 37 | + And the JSON node "data.__type.fields[2].type.kind" should be equal to "OBJECT" |
| 38 | + And the JSON node "data.__type.fields[2].args[0].name" should be equal to "input" |
| 39 | + And the JSON node "data.__type.fields[2].args[0].type.kind" should be equal to "NON_NULL" |
| 40 | + And the JSON node "data.__type.fields[2].args[0].type.ofType.name" should match "/^delete[A-z0-9]+Input$/" |
| 41 | + And the JSON node "data.__type.fields[2].args[0].type.ofType.kind" should be equal to "INPUT_OBJECT" |
41 | 42 |
|
42 | 43 | Scenario: Create an item
|
43 | 44 | When I send the following GraphQL request:
|
@@ -420,3 +421,56 @@ Feature: GraphQL mutation support
|
420 | 421 | And the header "Content-Type" should be equal to "application/json"
|
421 | 422 | And the JSON node "data.testCustomArgumentsDummyCustomMutation.dummyCustomMutation.result" should be equal to "18"
|
422 | 423 | And the JSON node "data.testCustomArgumentsDummyCustomMutation.clientMutationId" should be equal to "myId"
|
| 424 | + |
| 425 | + Scenario: Uploading a file with a custom mutation |
| 426 | + Given I have the following file for a GraphQL request: |
| 427 | + | name | file | |
| 428 | + | file | test.gif | |
| 429 | + And I have the following GraphQL multipart request map: |
| 430 | + """ |
| 431 | + { |
| 432 | + "file": ["variables.file"] |
| 433 | + } |
| 434 | + """ |
| 435 | + When I send the following GraphQL multipart request operations: |
| 436 | + """ |
| 437 | + { |
| 438 | + "query": "mutation($file: Upload!) { uploadMediaObject(input: {file: $file}) { mediaObject { id contentUrl } } }", |
| 439 | + "variables": { |
| 440 | + "file": null |
| 441 | + } |
| 442 | + } |
| 443 | + """ |
| 444 | + Then the response status code should be 200 |
| 445 | + And the response should be in JSON |
| 446 | + And the JSON node "data.uploadMediaObject.mediaObject.contentUrl" should be equal to "test.gif" |
| 447 | + |
| 448 | + Scenario: Uploading multiple files with a custom mutation |
| 449 | + Given I have the following files for a GraphQL request: |
| 450 | + | name | file | |
| 451 | + | 0 | test.gif | |
| 452 | + | 1 | test.gif | |
| 453 | + | 2 | test.gif | |
| 454 | + And I have the following GraphQL multipart request map: |
| 455 | + """ |
| 456 | + { |
| 457 | + "0": ["variables.files.0"], |
| 458 | + "1": ["variables.files.1"], |
| 459 | + "2": ["variables.files.2"] |
| 460 | + } |
| 461 | + """ |
| 462 | + When I send the following GraphQL multipart request operations: |
| 463 | + """ |
| 464 | + { |
| 465 | + "query": "mutation($files: [Upload!]!) { uploadMultipleMediaObject(input: {files: $files}) { mediaObject { id contentUrl } } }", |
| 466 | + "variables": { |
| 467 | + "files": [ |
| 468 | + null, |
| 469 | + null, |
| 470 | + null |
| 471 | + ] |
| 472 | + } |
| 473 | + } |
| 474 | + """ |
| 475 | + Then the response status code should be 200 |
| 476 | + And the JSON node "data.uploadMultipleMediaObject.mediaObject.contentUrl" should be equal to "test.gif" |
0 commit comments