offline_spec_test.json 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254
  1. {
  2. "Empty queries are resolved if client goes offline": {
  3. "describeName": "Offline:",
  4. "itName": "Empty queries are resolved if client goes offline",
  5. "tags": [],
  6. "config": {
  7. "useGarbageCollection": true,
  8. "numClients": 1
  9. },
  10. "steps": [
  11. {
  12. "userListen": [
  13. 2,
  14. {
  15. "path": "collection",
  16. "filters": [],
  17. "orderBys": []
  18. }
  19. ],
  20. "expectedState": {
  21. "activeTargets": {
  22. "2": {
  23. "queries": [
  24. {
  25. "path": "collection",
  26. "filters": [],
  27. "orderBys": []
  28. }
  29. ],
  30. "resumeToken": ""
  31. }
  32. }
  33. }
  34. },
  35. {
  36. "watchStreamClose": {
  37. "error": {
  38. "code": 14,
  39. "message": "Simulated Backend Error"
  40. },
  41. "runBackoffTimer": true
  42. },
  43. "expectedSnapshotEvents": [
  44. {
  45. "query": {
  46. "path": "collection",
  47. "filters": [],
  48. "orderBys": []
  49. },
  50. "errorCode": 0,
  51. "fromCache": true,
  52. "hasPendingWrites": false
  53. }
  54. ]
  55. },
  56. {
  57. "watchStreamClose": {
  58. "error": {
  59. "code": 14,
  60. "message": "Simulated Backend Error"
  61. },
  62. "runBackoffTimer": true
  63. }
  64. },
  65. {
  66. "watchStreamClose": {
  67. "error": {
  68. "code": 14,
  69. "message": "Simulated Backend Error"
  70. },
  71. "runBackoffTimer": true
  72. }
  73. }
  74. ]
  75. },
  76. "A successful message delays offline status": {
  77. "describeName": "Offline:",
  78. "itName": "A successful message delays offline status",
  79. "tags": [],
  80. "config": {
  81. "useGarbageCollection": true,
  82. "numClients": 1
  83. },
  84. "steps": [
  85. {
  86. "userListen": [
  87. 2,
  88. {
  89. "path": "collection",
  90. "filters": [],
  91. "orderBys": []
  92. }
  93. ],
  94. "expectedState": {
  95. "activeTargets": {
  96. "2": {
  97. "queries": [
  98. {
  99. "path": "collection",
  100. "filters": [],
  101. "orderBys": []
  102. }
  103. ],
  104. "resumeToken": ""
  105. }
  106. }
  107. }
  108. },
  109. {
  110. "watchAck": [
  111. 2
  112. ]
  113. },
  114. {
  115. "watchStreamClose": {
  116. "error": {
  117. "code": 14,
  118. "message": "Simulated Backend Error"
  119. },
  120. "runBackoffTimer": true
  121. }
  122. },
  123. {
  124. "watchStreamClose": {
  125. "error": {
  126. "code": 14,
  127. "message": "Simulated Backend Error"
  128. },
  129. "runBackoffTimer": true
  130. },
  131. "expectedSnapshotEvents": [
  132. {
  133. "query": {
  134. "path": "collection",
  135. "filters": [],
  136. "orderBys": []
  137. },
  138. "errorCode": 0,
  139. "fromCache": true,
  140. "hasPendingWrites": false
  141. }
  142. ]
  143. },
  144. {
  145. "watchStreamClose": {
  146. "error": {
  147. "code": 14,
  148. "message": "Simulated Backend Error"
  149. },
  150. "runBackoffTimer": true
  151. }
  152. },
  153. {
  154. "watchStreamClose": {
  155. "error": {
  156. "code": 14,
  157. "message": "Simulated Backend Error"
  158. },
  159. "runBackoffTimer": true
  160. }
  161. }
  162. ]
  163. },
  164. "Removing all listeners delays \"Offline\" status on next listen": {
  165. "describeName": "Offline:",
  166. "itName": "Removing all listeners delays \"Offline\" status on next listen",
  167. "tags": [
  168. "eager-gc"
  169. ],
  170. "comment": "Marked as no-lru because when a listen is re-added, it gets a new target id rather than reusing one",
  171. "config": {
  172. "useGarbageCollection": true,
  173. "numClients": 1
  174. },
  175. "steps": [
  176. {
  177. "userListen": [
  178. 2,
  179. {
  180. "path": "collection",
  181. "filters": [],
  182. "orderBys": []
  183. }
  184. ],
  185. "expectedState": {
  186. "activeTargets": {
  187. "2": {
  188. "queries": [
  189. {
  190. "path": "collection",
  191. "filters": [],
  192. "orderBys": []
  193. }
  194. ],
  195. "resumeToken": ""
  196. }
  197. }
  198. }
  199. },
  200. {
  201. "watchStreamClose": {
  202. "error": {
  203. "code": 14,
  204. "message": "Simulated Backend Error"
  205. },
  206. "runBackoffTimer": true
  207. },
  208. "expectedSnapshotEvents": [
  209. {
  210. "query": {
  211. "path": "collection",
  212. "filters": [],
  213. "orderBys": []
  214. },
  215. "errorCode": 0,
  216. "fromCache": true,
  217. "hasPendingWrites": false
  218. }
  219. ]
  220. },
  221. {
  222. "userUnlisten": [
  223. 2,
  224. {
  225. "path": "collection",
  226. "filters": [],
  227. "orderBys": []
  228. }
  229. ],
  230. "expectedState": {
  231. "activeTargets": {}
  232. }
  233. },
  234. {
  235. "watchStreamClose": {
  236. "error": {
  237. "code": 14,
  238. "message": "Simulated Backend Error"
  239. },
  240. "runBackoffTimer": true
  241. }
  242. },
  243. {
  244. "userListen": [
  245. 4,
  246. {
  247. "path": "collection",
  248. "filters": [],
  249. "orderBys": []
  250. }
  251. ],
  252. "expectedState": {
  253. "activeTargets": {
  254. "4": {
  255. "queries": [
  256. {
  257. "path": "collection",
  258. "filters": [],
  259. "orderBys": []
  260. }
  261. ],
  262. "resumeToken": ""
  263. }
  264. }
  265. }
  266. },
  267. {
  268. "watchStreamClose": {
  269. "error": {
  270. "code": 14,
  271. "message": "Simulated Backend Error"
  272. },
  273. "runBackoffTimer": true
  274. },
  275. "expectedSnapshotEvents": [
  276. {
  277. "query": {
  278. "path": "collection",
  279. "filters": [],
  280. "orderBys": []
  281. },
  282. "errorCode": 0,
  283. "fromCache": true,
  284. "hasPendingWrites": false
  285. }
  286. ]
  287. }
  288. ]
  289. },
  290. "Queries revert to fromCache=true when offline.": {
  291. "describeName": "Offline:",
  292. "itName": "Queries revert to fromCache=true when offline.",
  293. "tags": [],
  294. "config": {
  295. "useGarbageCollection": true,
  296. "numClients": 1
  297. },
  298. "steps": [
  299. {
  300. "userListen": [
  301. 2,
  302. {
  303. "path": "collection",
  304. "filters": [],
  305. "orderBys": []
  306. }
  307. ],
  308. "expectedState": {
  309. "activeTargets": {
  310. "2": {
  311. "queries": [
  312. {
  313. "path": "collection",
  314. "filters": [],
  315. "orderBys": []
  316. }
  317. ],
  318. "resumeToken": ""
  319. }
  320. }
  321. }
  322. },
  323. {
  324. "watchAck": [
  325. 2
  326. ]
  327. },
  328. {
  329. "watchEntity": {
  330. "docs": [
  331. {
  332. "key": "collection/a",
  333. "version": 1000,
  334. "value": {
  335. "key": "a"
  336. },
  337. "options": {
  338. "hasLocalMutations": false,
  339. "hasCommittedMutations": false
  340. }
  341. }
  342. ],
  343. "targets": [
  344. 2
  345. ]
  346. }
  347. },
  348. {
  349. "watchCurrent": [
  350. [
  351. 2
  352. ],
  353. "resume-token-1000"
  354. ]
  355. },
  356. {
  357. "watchSnapshot": {
  358. "version": 1000,
  359. "targetIds": []
  360. },
  361. "expectedSnapshotEvents": [
  362. {
  363. "query": {
  364. "path": "collection",
  365. "filters": [],
  366. "orderBys": []
  367. },
  368. "added": [
  369. {
  370. "key": "collection/a",
  371. "version": 1000,
  372. "value": {
  373. "key": "a"
  374. },
  375. "options": {
  376. "hasLocalMutations": false,
  377. "hasCommittedMutations": false
  378. }
  379. }
  380. ],
  381. "errorCode": 0,
  382. "fromCache": false,
  383. "hasPendingWrites": false
  384. }
  385. ]
  386. },
  387. {
  388. "watchStreamClose": {
  389. "error": {
  390. "code": 14,
  391. "message": "Simulated Backend Error"
  392. },
  393. "runBackoffTimer": true
  394. },
  395. "expectedState": {
  396. "activeTargets": {
  397. "2": {
  398. "queries": [
  399. {
  400. "path": "collection",
  401. "filters": [],
  402. "orderBys": []
  403. }
  404. ],
  405. "resumeToken": "resume-token-1000"
  406. }
  407. }
  408. }
  409. },
  410. {
  411. "watchStreamClose": {
  412. "error": {
  413. "code": 14,
  414. "message": "Simulated Backend Error"
  415. },
  416. "runBackoffTimer": true
  417. },
  418. "expectedSnapshotEvents": [
  419. {
  420. "query": {
  421. "path": "collection",
  422. "filters": [],
  423. "orderBys": []
  424. },
  425. "errorCode": 0,
  426. "fromCache": true,
  427. "hasPendingWrites": false
  428. }
  429. ]
  430. },
  431. {
  432. "watchAck": [
  433. 2
  434. ]
  435. },
  436. {
  437. "watchEntity": {
  438. "docs": [],
  439. "targets": [
  440. 2
  441. ]
  442. }
  443. },
  444. {
  445. "watchCurrent": [
  446. [
  447. 2
  448. ],
  449. "resume-token-1000"
  450. ]
  451. },
  452. {
  453. "watchSnapshot": {
  454. "version": 1000,
  455. "targetIds": []
  456. },
  457. "expectedSnapshotEvents": [
  458. {
  459. "query": {
  460. "path": "collection",
  461. "filters": [],
  462. "orderBys": []
  463. },
  464. "errorCode": 0,
  465. "fromCache": false,
  466. "hasPendingWrites": false
  467. }
  468. ]
  469. }
  470. ]
  471. },
  472. "Queries with limbo documents handle going offline.": {
  473. "describeName": "Offline:",
  474. "itName": "Queries with limbo documents handle going offline.",
  475. "tags": [],
  476. "config": {
  477. "useGarbageCollection": true,
  478. "numClients": 1
  479. },
  480. "steps": [
  481. {
  482. "userListen": [
  483. 2,
  484. {
  485. "path": "collection",
  486. "filters": [],
  487. "orderBys": []
  488. }
  489. ],
  490. "expectedState": {
  491. "activeTargets": {
  492. "2": {
  493. "queries": [
  494. {
  495. "path": "collection",
  496. "filters": [],
  497. "orderBys": []
  498. }
  499. ],
  500. "resumeToken": ""
  501. }
  502. }
  503. }
  504. },
  505. {
  506. "watchAck": [
  507. 2
  508. ]
  509. },
  510. {
  511. "watchEntity": {
  512. "docs": [
  513. {
  514. "key": "collection/a",
  515. "version": 1000,
  516. "value": {
  517. "key": "a"
  518. },
  519. "options": {
  520. "hasLocalMutations": false,
  521. "hasCommittedMutations": false
  522. }
  523. }
  524. ],
  525. "targets": [
  526. 2
  527. ]
  528. }
  529. },
  530. {
  531. "watchCurrent": [
  532. [
  533. 2
  534. ],
  535. "resume-token-1000"
  536. ]
  537. },
  538. {
  539. "watchSnapshot": {
  540. "version": 1000,
  541. "targetIds": []
  542. },
  543. "expectedSnapshotEvents": [
  544. {
  545. "query": {
  546. "path": "collection",
  547. "filters": [],
  548. "orderBys": []
  549. },
  550. "added": [
  551. {
  552. "key": "collection/a",
  553. "version": 1000,
  554. "value": {
  555. "key": "a"
  556. },
  557. "options": {
  558. "hasLocalMutations": false,
  559. "hasCommittedMutations": false
  560. }
  561. }
  562. ],
  563. "errorCode": 0,
  564. "fromCache": false,
  565. "hasPendingWrites": false
  566. }
  567. ]
  568. },
  569. {
  570. "watchReset": [
  571. 2
  572. ]
  573. },
  574. {
  575. "watchCurrent": [
  576. [
  577. 2
  578. ],
  579. "resume-token-1001"
  580. ]
  581. },
  582. {
  583. "watchSnapshot": {
  584. "version": 1001,
  585. "targetIds": []
  586. },
  587. "expectedState": {
  588. "limboDocs": [
  589. "collection/a"
  590. ],
  591. "activeTargets": {
  592. "1": {
  593. "queries": [
  594. {
  595. "path": "collection/a",
  596. "filters": [],
  597. "orderBys": []
  598. }
  599. ],
  600. "resumeToken": ""
  601. },
  602. "2": {
  603. "queries": [
  604. {
  605. "path": "collection",
  606. "filters": [],
  607. "orderBys": []
  608. }
  609. ],
  610. "resumeToken": ""
  611. }
  612. }
  613. },
  614. "expectedSnapshotEvents": [
  615. {
  616. "query": {
  617. "path": "collection",
  618. "filters": [],
  619. "orderBys": []
  620. },
  621. "errorCode": 0,
  622. "fromCache": true,
  623. "hasPendingWrites": false
  624. }
  625. ]
  626. },
  627. {
  628. "watchStreamClose": {
  629. "error": {
  630. "code": 14,
  631. "message": "Simulated Backend Error"
  632. },
  633. "runBackoffTimer": true
  634. },
  635. "expectedState": {
  636. "activeTargets": {
  637. "1": {
  638. "queries": [
  639. {
  640. "path": "collection/a",
  641. "filters": [],
  642. "orderBys": []
  643. }
  644. ],
  645. "resumeToken": ""
  646. },
  647. "2": {
  648. "queries": [
  649. {
  650. "path": "collection",
  651. "filters": [],
  652. "orderBys": []
  653. }
  654. ],
  655. "resumeToken": "resume-token-1001"
  656. }
  657. }
  658. }
  659. },
  660. {
  661. "watchStreamClose": {
  662. "error": {
  663. "code": 14,
  664. "message": "Simulated Backend Error"
  665. },
  666. "runBackoffTimer": true
  667. }
  668. },
  669. {
  670. "watchAck": [
  671. 2
  672. ]
  673. },
  674. {
  675. "watchEntity": {
  676. "docs": [],
  677. "targets": [
  678. 2
  679. ]
  680. }
  681. },
  682. {
  683. "watchCurrent": [
  684. [
  685. 2
  686. ],
  687. "resume-token-1001"
  688. ]
  689. },
  690. {
  691. "watchSnapshot": {
  692. "version": 1001,
  693. "targetIds": []
  694. }
  695. },
  696. {
  697. "watchAck": [
  698. 1
  699. ]
  700. },
  701. {
  702. "watchEntity": {
  703. "docs": [],
  704. "targets": [
  705. 1
  706. ]
  707. }
  708. },
  709. {
  710. "watchCurrent": [
  711. [
  712. 1
  713. ],
  714. "resume-token-1001"
  715. ]
  716. },
  717. {
  718. "watchSnapshot": {
  719. "version": 1001,
  720. "targetIds": []
  721. },
  722. "expectedSnapshotEvents": [
  723. {
  724. "query": {
  725. "path": "collection",
  726. "filters": [],
  727. "orderBys": []
  728. },
  729. "removed": [
  730. {
  731. "key": "collection/a",
  732. "version": 1000,
  733. "value": {
  734. "key": "a"
  735. },
  736. "options": {
  737. "hasLocalMutations": false,
  738. "hasCommittedMutations": false
  739. }
  740. }
  741. ],
  742. "errorCode": 0,
  743. "fromCache": false,
  744. "hasPendingWrites": false
  745. }
  746. ],
  747. "expectedState": {
  748. "limboDocs": [],
  749. "activeTargets": {
  750. "2": {
  751. "queries": [
  752. {
  753. "path": "collection",
  754. "filters": [],
  755. "orderBys": []
  756. }
  757. ],
  758. "resumeToken": "resume-token-1001"
  759. }
  760. }
  761. }
  762. }
  763. ]
  764. },
  765. "OnlineState timeout triggers offline behavior": {
  766. "describeName": "Offline:",
  767. "itName": "OnlineState timeout triggers offline behavior",
  768. "tags": [],
  769. "config": {
  770. "useGarbageCollection": true,
  771. "numClients": 1
  772. },
  773. "steps": [
  774. {
  775. "userListen": [
  776. 2,
  777. {
  778. "path": "collection",
  779. "filters": [],
  780. "orderBys": []
  781. }
  782. ],
  783. "expectedState": {
  784. "activeTargets": {
  785. "2": {
  786. "queries": [
  787. {
  788. "path": "collection",
  789. "filters": [],
  790. "orderBys": []
  791. }
  792. ],
  793. "resumeToken": ""
  794. }
  795. }
  796. }
  797. },
  798. {
  799. "runTimer": "online_state_timeout",
  800. "expectedSnapshotEvents": [
  801. {
  802. "query": {
  803. "path": "collection",
  804. "filters": [],
  805. "orderBys": []
  806. },
  807. "errorCode": 0,
  808. "fromCache": true,
  809. "hasPendingWrites": false
  810. }
  811. ]
  812. },
  813. {
  814. "watchStreamClose": {
  815. "error": {
  816. "code": 14,
  817. "message": "Simulated Backend Error"
  818. },
  819. "runBackoffTimer": true
  820. }
  821. },
  822. {
  823. "watchStreamClose": {
  824. "error": {
  825. "code": 14,
  826. "message": "Simulated Backend Error"
  827. },
  828. "runBackoffTimer": true
  829. }
  830. },
  831. {
  832. "watchAck": [
  833. 2
  834. ]
  835. },
  836. {
  837. "watchEntity": {
  838. "docs": [
  839. {
  840. "key": "collection/a",
  841. "version": 1000,
  842. "value": {
  843. "key": "a"
  844. },
  845. "options": {
  846. "hasLocalMutations": false,
  847. "hasCommittedMutations": false
  848. }
  849. }
  850. ],
  851. "targets": [
  852. 2
  853. ]
  854. }
  855. },
  856. {
  857. "watchCurrent": [
  858. [
  859. 2
  860. ],
  861. "resume-token-1000"
  862. ]
  863. },
  864. {
  865. "watchSnapshot": {
  866. "version": 1000,
  867. "targetIds": []
  868. },
  869. "expectedSnapshotEvents": [
  870. {
  871. "query": {
  872. "path": "collection",
  873. "filters": [],
  874. "orderBys": []
  875. },
  876. "added": [
  877. {
  878. "key": "collection/a",
  879. "version": 1000,
  880. "value": {
  881. "key": "a"
  882. },
  883. "options": {
  884. "hasLocalMutations": false,
  885. "hasCommittedMutations": false
  886. }
  887. }
  888. ],
  889. "errorCode": 0,
  890. "fromCache": false,
  891. "hasPendingWrites": false
  892. }
  893. ]
  894. },
  895. {
  896. "runTimer": "all"
  897. },
  898. {
  899. "watchStreamClose": {
  900. "error": {
  901. "code": 14,
  902. "message": "Simulated Backend Error"
  903. },
  904. "runBackoffTimer": true
  905. },
  906. "expectedState": {
  907. "activeTargets": {
  908. "2": {
  909. "queries": [
  910. {
  911. "path": "collection",
  912. "filters": [],
  913. "orderBys": []
  914. }
  915. ],
  916. "resumeToken": "resume-token-1000"
  917. }
  918. }
  919. }
  920. },
  921. {
  922. "runTimer": "online_state_timeout",
  923. "expectedSnapshotEvents": [
  924. {
  925. "query": {
  926. "path": "collection",
  927. "filters": [],
  928. "orderBys": []
  929. },
  930. "errorCode": 0,
  931. "fromCache": true,
  932. "hasPendingWrites": false
  933. }
  934. ]
  935. }
  936. ]
  937. },
  938. "New queries return immediately with fromCache=true when offline due to stream failures.": {
  939. "describeName": "Offline:",
  940. "itName": "New queries return immediately with fromCache=true when offline due to stream failures.",
  941. "tags": [],
  942. "config": {
  943. "useGarbageCollection": true,
  944. "numClients": 1
  945. },
  946. "steps": [
  947. {
  948. "userListen": [
  949. 2,
  950. {
  951. "path": "collection",
  952. "filters": [],
  953. "orderBys": []
  954. }
  955. ],
  956. "expectedState": {
  957. "activeTargets": {
  958. "2": {
  959. "queries": [
  960. {
  961. "path": "collection",
  962. "filters": [],
  963. "orderBys": []
  964. }
  965. ],
  966. "resumeToken": ""
  967. }
  968. }
  969. }
  970. },
  971. {
  972. "watchStreamClose": {
  973. "error": {
  974. "code": 14,
  975. "message": "Simulated Backend Error"
  976. },
  977. "runBackoffTimer": true
  978. },
  979. "expectedSnapshotEvents": [
  980. {
  981. "query": {
  982. "path": "collection",
  983. "filters": [],
  984. "orderBys": []
  985. },
  986. "errorCode": 0,
  987. "fromCache": true,
  988. "hasPendingWrites": false
  989. }
  990. ]
  991. },
  992. {
  993. "userListen": [
  994. 4,
  995. {
  996. "path": "collection2",
  997. "filters": [],
  998. "orderBys": []
  999. }
  1000. ],
  1001. "expectedState": {
  1002. "activeTargets": {
  1003. "2": {
  1004. "queries": [
  1005. {
  1006. "path": "collection",
  1007. "filters": [],
  1008. "orderBys": []
  1009. }
  1010. ],
  1011. "resumeToken": ""
  1012. },
  1013. "4": {
  1014. "queries": [
  1015. {
  1016. "path": "collection2",
  1017. "filters": [],
  1018. "orderBys": []
  1019. }
  1020. ],
  1021. "resumeToken": ""
  1022. }
  1023. }
  1024. },
  1025. "expectedSnapshotEvents": [
  1026. {
  1027. "query": {
  1028. "path": "collection2",
  1029. "filters": [],
  1030. "orderBys": []
  1031. },
  1032. "errorCode": 0,
  1033. "fromCache": true,
  1034. "hasPendingWrites": false
  1035. }
  1036. ]
  1037. }
  1038. ]
  1039. },
  1040. "New queries return immediately with fromCache=true when offline due to OnlineState timeout.": {
  1041. "describeName": "Offline:",
  1042. "itName": "New queries return immediately with fromCache=true when offline due to OnlineState timeout.",
  1043. "tags": [],
  1044. "config": {
  1045. "useGarbageCollection": true,
  1046. "numClients": 1
  1047. },
  1048. "steps": [
  1049. {
  1050. "userListen": [
  1051. 2,
  1052. {
  1053. "path": "collection",
  1054. "filters": [],
  1055. "orderBys": []
  1056. }
  1057. ],
  1058. "expectedState": {
  1059. "activeTargets": {
  1060. "2": {
  1061. "queries": [
  1062. {
  1063. "path": "collection",
  1064. "filters": [],
  1065. "orderBys": []
  1066. }
  1067. ],
  1068. "resumeToken": ""
  1069. }
  1070. }
  1071. }
  1072. },
  1073. {
  1074. "runTimer": "online_state_timeout",
  1075. "expectedSnapshotEvents": [
  1076. {
  1077. "query": {
  1078. "path": "collection",
  1079. "filters": [],
  1080. "orderBys": []
  1081. },
  1082. "errorCode": 0,
  1083. "fromCache": true,
  1084. "hasPendingWrites": false
  1085. }
  1086. ]
  1087. },
  1088. {
  1089. "userListen": [
  1090. 4,
  1091. {
  1092. "path": "collection2",
  1093. "filters": [],
  1094. "orderBys": []
  1095. }
  1096. ],
  1097. "expectedState": {
  1098. "activeTargets": {
  1099. "2": {
  1100. "queries": [
  1101. {
  1102. "path": "collection",
  1103. "filters": [],
  1104. "orderBys": []
  1105. }
  1106. ],
  1107. "resumeToken": ""
  1108. },
  1109. "4": {
  1110. "queries": [
  1111. {
  1112. "path": "collection2",
  1113. "filters": [],
  1114. "orderBys": []
  1115. }
  1116. ],
  1117. "resumeToken": ""
  1118. }
  1119. }
  1120. },
  1121. "expectedSnapshotEvents": [
  1122. {
  1123. "query": {
  1124. "path": "collection2",
  1125. "filters": [],
  1126. "orderBys": []
  1127. },
  1128. "errorCode": 0,
  1129. "fromCache": true,
  1130. "hasPendingWrites": false
  1131. }
  1132. ]
  1133. }
  1134. ]
  1135. },
  1136. "Queries return from cache when network disabled": {
  1137. "describeName": "Offline:",
  1138. "itName": "Queries return from cache when network disabled",
  1139. "tags": [
  1140. "eager-gc"
  1141. ],
  1142. "config": {
  1143. "useGarbageCollection": true,
  1144. "numClients": 1
  1145. },
  1146. "steps": [
  1147. {
  1148. "enableNetwork": false,
  1149. "expectedState": {
  1150. "activeTargets": {},
  1151. "limboDocs": []
  1152. }
  1153. },
  1154. {
  1155. "userListen": [
  1156. 2,
  1157. {
  1158. "path": "collection",
  1159. "filters": [],
  1160. "orderBys": []
  1161. }
  1162. ],
  1163. "expectedState": {
  1164. "activeTargets": {
  1165. "2": {
  1166. "queries": [
  1167. {
  1168. "path": "collection",
  1169. "filters": [],
  1170. "orderBys": []
  1171. }
  1172. ],
  1173. "resumeToken": ""
  1174. }
  1175. }
  1176. },
  1177. "expectedSnapshotEvents": [
  1178. {
  1179. "query": {
  1180. "path": "collection",
  1181. "filters": [],
  1182. "orderBys": []
  1183. },
  1184. "errorCode": 0,
  1185. "fromCache": true,
  1186. "hasPendingWrites": false
  1187. }
  1188. ]
  1189. },
  1190. {
  1191. "userUnlisten": [
  1192. 2,
  1193. {
  1194. "path": "collection",
  1195. "filters": [],
  1196. "orderBys": []
  1197. }
  1198. ],
  1199. "expectedState": {
  1200. "activeTargets": {}
  1201. }
  1202. },
  1203. {
  1204. "userListen": [
  1205. 4,
  1206. {
  1207. "path": "collection",
  1208. "filters": [],
  1209. "orderBys": []
  1210. }
  1211. ],
  1212. "expectedState": {
  1213. "activeTargets": {
  1214. "4": {
  1215. "queries": [
  1216. {
  1217. "path": "collection",
  1218. "filters": [],
  1219. "orderBys": []
  1220. }
  1221. ],
  1222. "resumeToken": ""
  1223. }
  1224. }
  1225. },
  1226. "expectedSnapshotEvents": [
  1227. {
  1228. "query": {
  1229. "path": "collection",
  1230. "filters": [],
  1231. "orderBys": []
  1232. },
  1233. "errorCode": 0,
  1234. "fromCache": true,
  1235. "hasPendingWrites": false
  1236. }
  1237. ]
  1238. },
  1239. {
  1240. "userUnlisten": [
  1241. 4,
  1242. {
  1243. "path": "collection",
  1244. "filters": [],
  1245. "orderBys": []
  1246. }
  1247. ],
  1248. "expectedState": {
  1249. "activeTargets": {}
  1250. }
  1251. }
  1252. ]
  1253. }
  1254. }