@@ -44,8 +44,10 @@ Feature: GraphQL collection support
44
44
}
45
45
}
46
46
pageInfo {
47
+ startCursor
47
48
endCursor
48
49
hasNextPage
50
+ hasPreviousPage
49
51
}
50
52
}
51
53
}
@@ -55,7 +57,9 @@ Feature: GraphQL collection support
55
57
And the header "Content-Type" should be equal to "application/json"
56
58
And the JSON node "data.dummies.edges" should have 0 element
57
59
And the JSON node "data.dummies.pageInfo.endCursor" should be null
60
+ And the JSON node "data.dummies.pageInfo.startCursor" should be null
58
61
And the JSON node "data.dummies.pageInfo.hasNextPage" should be false
62
+ And the JSON node "data.dummies.pageInfo.hasPreviousPage" should be false
59
63
60
64
@createSchema
61
65
Scenario : Retrieve a collection with a nested collection through a GraphQL query
@@ -197,12 +201,12 @@ Feature: GraphQL collection support
197
201
Then the response status code should be 200
198
202
And the response should be in JSON
199
203
And the header "Content-Type" should be equal to "application/json"
200
- And the JSON node "data.dummies.pageInfo.endCursor" should be equal to "Mw =="
204
+ And the JSON node "data.dummies.pageInfo.endCursor" should be equal to "MQ =="
201
205
And the JSON node "data.dummies.pageInfo.hasNextPage" should be true
202
206
And the JSON node "data.dummies.totalCount" should be equal to 4
203
207
And the JSON node "data.dummies.edges[1].node.name" should be equal to "Dummy #2"
204
208
And the JSON node "data.dummies.edges[1].cursor" should be equal to "MQ=="
205
- And the JSON node "data.dummies.edges[1].node.relatedDummies.pageInfo.endCursor" should be equal to "Mw =="
209
+ And the JSON node "data.dummies.edges[1].node.relatedDummies.pageInfo.endCursor" should be equal to "MQ =="
206
210
And the JSON node "data.dummies.edges[1].node.relatedDummies.pageInfo.hasNextPage" should be true
207
211
And the JSON node "data.dummies.edges[1].node.relatedDummies.totalCount" should be equal to 4
208
212
And the JSON node "data.dummies.edges[1].node.relatedDummies.edges[0].node.name" should be equal to "RelatedDummy12"
@@ -277,9 +281,11 @@ Feature: GraphQL collection support
277
281
And the header "Content-Type" should be equal to "application/json"
278
282
And the JSON node "data.dummies.edges" should have 1 element
279
283
And the JSON node "data.dummies.pageInfo.hasNextPage" should be false
284
+ And the JSON node "data.dummies.pageInfo.endCursor" should be equal to "Mw=="
280
285
And the JSON node "data.dummies.edges[0].node.name" should be equal to "Dummy #4"
281
286
And the JSON node "data.dummies.edges[0].cursor" should be equal to "Mw=="
282
287
And the JSON node "data.dummies.edges[0].node.relatedDummies.pageInfo.hasNextPage" should be false
288
+ And the JSON node "data.dummies.edges[0].node.relatedDummies.pageInfo.endCursor" should be equal to "Mw=="
283
289
And the JSON node "data.dummies.edges[0].node.relatedDummies.edges" should have 2 elements
284
290
And the JSON node "data.dummies.edges[0].node.relatedDummies.edges[1].node.name" should be equal to "RelatedDummy44"
285
291
And the JSON node "data.dummies.edges[0].node.relatedDummies.edges[1].cursor" should be equal to "Mw=="
@@ -317,6 +323,165 @@ Feature: GraphQL collection support
317
323
And the header "Content-Type" should be equal to "application/json"
318
324
And the JSON node "data.dummies.edges" should have 0 element
319
325
326
+ @createSchema
327
+ Scenario : Paginate backwards through collections through a GraphQL query
328
+ Given there are 4 dummy objects having each 4 relatedDummies
329
+ When I send the following GraphQL request:
330
+ """
331
+ {
332
+ dummies(last: 2) {
333
+ edges {
334
+ node {
335
+ name
336
+ relatedDummies(last: 2) {
337
+ edges {
338
+ node {
339
+ name
340
+ }
341
+ cursor
342
+ }
343
+ totalCount
344
+ pageInfo {
345
+ startCursor
346
+ hasPreviousPage
347
+ }
348
+ }
349
+ }
350
+ cursor
351
+ }
352
+ totalCount
353
+ pageInfo {
354
+ startCursor
355
+ hasPreviousPage
356
+ }
357
+ }
358
+ }
359
+ """
360
+ Then the response status code should be 200
361
+ And the response should be in JSON
362
+ And the header "Content-Type" should be equal to "application/json"
363
+ And the JSON node "data.dummies.pageInfo.startCursor" should be equal to "Mg=="
364
+ And the JSON node "data.dummies.pageInfo.hasPreviousPage" should be true
365
+ And the JSON node "data.dummies.totalCount" should be equal to 4
366
+ And the JSON node "data.dummies.edges[1].node.name" should be equal to "Dummy #4"
367
+ And the JSON node "data.dummies.edges[1].cursor" should be equal to "Mw=="
368
+ And the JSON node "data.dummies.edges[1].node.relatedDummies.pageInfo.startCursor" should be equal to "Mg=="
369
+ And the JSON node "data.dummies.edges[1].node.relatedDummies.pageInfo.hasPreviousPage" should be true
370
+ And the JSON node "data.dummies.edges[1].node.relatedDummies.totalCount" should be equal to 4
371
+ And the JSON node "data.dummies.edges[1].node.relatedDummies.edges[0].node.name" should be equal to "RelatedDummy34"
372
+ And the JSON node "data.dummies.edges[1].node.relatedDummies.edges[0].cursor" should be equal to "Mg=="
373
+ When I send the following GraphQL request:
374
+ """
375
+ {
376
+ dummies(last: 2, before: "Mw==") {
377
+ edges {
378
+ node {
379
+ name
380
+ relatedDummies(last: 2, before: "Mg==") {
381
+ edges {
382
+ node {
383
+ name
384
+ }
385
+ cursor
386
+ }
387
+ pageInfo {
388
+ startCursor
389
+ hasPreviousPage
390
+ }
391
+ }
392
+ }
393
+ cursor
394
+ }
395
+ pageInfo {
396
+ startCursor
397
+ hasPreviousPage
398
+ }
399
+ }
400
+ }
401
+ """
402
+ Then the response status code should be 200
403
+ And the response should be in JSON
404
+ And the header "Content-Type" should be equal to "application/json"
405
+ And the JSON node "data.dummies.edges[0].node.name" should be equal to "Dummy #2"
406
+ And the JSON node "data.dummies.edges[0].cursor" should be equal to "MQ=="
407
+ And the JSON node "data.dummies.edges[1].node.relatedDummies.edges[0].node.name" should be equal to "RelatedDummy13"
408
+ And the JSON node "data.dummies.edges[1].node.relatedDummies.edges[0].cursor" should be equal to "MA=="
409
+ When I send the following GraphQL request:
410
+ """
411
+ {
412
+ dummies(last: 2, before: "MQ==") {
413
+ edges {
414
+ node {
415
+ name
416
+ relatedDummies(last: 3, before: "Mg==") {
417
+ edges {
418
+ node {
419
+ name
420
+ }
421
+ cursor
422
+ }
423
+ pageInfo {
424
+ startCursor
425
+ hasPreviousPage
426
+ }
427
+ }
428
+ }
429
+ cursor
430
+ }
431
+ pageInfo {
432
+ startCursor
433
+ hasPreviousPage
434
+ }
435
+ }
436
+ }
437
+ """
438
+ Then the response status code should be 200
439
+ And the response should be in JSON
440
+ And the header "Content-Type" should be equal to "application/json"
441
+ And the JSON node "data.dummies.edges" should have 1 element
442
+ And the JSON node "data.dummies.pageInfo.hasPreviousPage" should be false
443
+ And the JSON node "data.dummies.pageInfo.startCursor" should be equal to "MA=="
444
+ And the JSON node "data.dummies.edges[0].node.name" should be equal to "Dummy #1"
445
+ And the JSON node "data.dummies.edges[0].cursor" should be equal to "MA=="
446
+ And the JSON node "data.dummies.edges[0].node.relatedDummies.pageInfo.hasPreviousPage" should be false
447
+ And the JSON node "data.dummies.edges[0].node.relatedDummies.pageInfo.startCursor" should be equal to "MA=="
448
+ And the JSON node "data.dummies.edges[0].node.relatedDummies.edges" should have 2 elements
449
+ And the JSON node "data.dummies.edges[0].node.relatedDummies.edges[1].node.name" should be equal to "RelatedDummy21"
450
+ And the JSON node "data.dummies.edges[0].node.relatedDummies.edges[1].cursor" should be equal to "MQ=="
451
+ When I send the following GraphQL request:
452
+ """
453
+ {
454
+ dummies(last: 2, before: "MA==") {
455
+ edges {
456
+ node {
457
+ name
458
+ relatedDummies(last: 1, before: "MQ==") {
459
+ edges {
460
+ node {
461
+ name
462
+ }
463
+ cursor
464
+ }
465
+ pageInfo {
466
+ startCursor
467
+ hasPreviousPage
468
+ }
469
+ }
470
+ }
471
+ cursor
472
+ }
473
+ pageInfo {
474
+ startCursor
475
+ hasPreviousPage
476
+ }
477
+ }
478
+ }
479
+ """
480
+ Then the response status code should be 200
481
+ And the response should be in JSON
482
+ And the header "Content-Type" should be equal to "application/json"
483
+ And the JSON node "data.dummies.edges" should have 0 element
484
+
320
485
@!mongodb
321
486
@createSchema
322
487
Scenario : Retrieve an item with composite primitive identifiers through a GraphQL query
0 commit comments