@shipvo/test 0.1.3 → 0.1.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipvo/test",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
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.",
@@ -17,6 +17,7 @@
17
17
  }
18
18
  },
19
19
  "files": [
20
+ "skills",
20
21
  "dist",
21
22
  "README.md"
22
23
  ],
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: shipvo-test
3
+ description: Write and run end-to-end tests for a React Native app with @shipvo/test. Use when the project depends on @shipvo/test and you need a typed test, plain-language steps or a network mock.
4
+ ---
5
+
6
+ # @shipvo/test
7
+
8
+ Headless end-to-end tests that run in the Shipvo simulator. No emulator needed.
9
+
10
+ ```bash
11
+ shipvo sim # simulator on http://localhost:4545
12
+ npx vitest run # run typed tests
13
+ shipvo test # run tests/*.steps
14
+ ```
15
+
16
+ ## A typed test
17
+
18
+ ```ts
19
+ import { test, expect } from "@shipvo/test/vitest";
20
+
21
+ test("adds a lure to the cart", async ({ phone }) => {
22
+ await phone.tap("Add 1 to cart");
23
+ expect(phone).toSee("Cart");
24
+ await phone.waitFor(/1 item/);
25
+ });
26
+ ```
27
+
28
+ Other calls: `phone.type("Search", "popper")`, `phone.scroll("down")`, `phone.back()`, `phone.device.set({ location: { latitude: 4.05, longitude: 9.77 } })`.
29
+
30
+ ## Plain-language steps
31
+
32
+ One step per line in `tests/<name>.steps`. `#` starts a comment.
33
+
34
+ ```
35
+ tap "Add 1 to cart"
36
+ type "popper" into "Search" and press enter
37
+ scroll down
38
+ go back
39
+ see "X"
40
+ do not see "X"
41
+ wait for "Cart"
42
+ ```
43
+
44
+ An unknown line fails with code `step_unparsed` and its line number. `shipvo test --repair` shows a diff for broken steps; add `--write` to save it.
45
+
46
+ ## Mock the network
47
+
48
+ ```ts
49
+ await phone.mockNetwork([{ url: /\/api\/products/, status: 503, body: { error: "down" }, delayMs: 300 }]);
50
+ await phone.clearNetworkMocks();
51
+ ```