@shipvo/test 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +40 -1
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -20,4 +20,43 @@ npx shipvo sim # the simulator, http://localhost:4545
20
20
  npx vitest run
21
21
  ```
22
22
 
23
- Works with any runner through `openApp` from `@shipvo/test`. Full guide, CI workflow and API: [Test your app in CI](/docs/testing/).
23
+ ## Failure-path examples
24
+
25
+ Runnable versions are in [`examples/flows.ts`](examples/flows.ts). They use the Tide & Tackle labels. Change them to match your app. The checkout flows need a cart, so open the phone with one: `openApp({ seedCart: [{ product_id: "rod-surf-36", quantity: 1 }] })`. The full purchase is in [`checkout.test.ts`](../../apps/tide-and-tackle/tests/checkout.test.ts).
26
+
27
+ **Permission denied**
28
+
29
+ ```ts
30
+ await phone.tap(/^Open cart/);
31
+ await phone.tap("Choose delivery and pay");
32
+ await phone.tap("Use my location");
33
+ await phone.tap("Deny");
34
+ await phone.waitFor("Location permission was not granted.");
35
+ ```
36
+
37
+ **Offline**
38
+
39
+ ```ts
40
+ await phone.device.set({ online: false });
41
+ await phone.waitFor("You're offline");
42
+ ```
43
+
44
+ **Payment decline**
45
+
46
+ ```ts
47
+ await phone.device.set({ payment: { nextResult: "decline", pin: "1234" }, biometrics: { enrolled: true, nextResult: "success" } });
48
+ await phone.tap(/^Open cart/);
49
+ await phone.tap("Choose delivery and pay");
50
+ await phone.tap(/^Any day Shop pickup/);
51
+ await phone.tap("Mobile money");
52
+ await phone.type("Mobile money number", "677000111");
53
+ await phone.tap("Place order");
54
+ await phone.tap("Use fingerprint");
55
+ await phone.type("Mobile money PIN", "1234");
56
+ await phone.tap("Confirm payment");
57
+ await phone.waitFor("Payment declined");
58
+ ```
59
+
60
+ The tests for these flows run against a small fake simulator, not the real app. The fake follows the real screen order and button names.
61
+
62
+ Works with any runner through `openApp` from `@shipvo/test`. Full guide, CI workflow and API: [Test your app in CI](https://shipvo.dev/docs/testing/).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipvo/test",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Typed end-to-end tests for React Native apps that run in the Shipvo simulator: open the app, tap, type, set the phone's location, camera and permissions, and assert on what is on screen. Works in Vitest or any test runner, headless, in CI.",
@@ -51,6 +51,6 @@
51
51
  },
52
52
  "scripts": {
53
53
  "build": "tsc -p tsconfig.json",
54
- "test": "vitest run"
54
+ "test": "tsc -p tsconfig.examples.json && vitest run"
55
55
  }
56
56
  }