@dataverse-to-code/test 0.0.0-stage → 0.22.0

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/README.md CHANGED
@@ -1,3 +1,50 @@
1
- # Temporary Holding Version
1
+ # @dataverse-to-code/test
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Run a [DataverseToCode](https://marketplace.visualstudio.com/items?itemName=CloudFish.dataverse-to-code) project's tests with Playwright. Your forms run offline in Chromium with their real scripts and business rules (no Dataverse connection); `.test.yaml` files and your own `.spec.ts` files run side by side.
4
+
5
+ Works with Microsoft Dataverse; not a Microsoft product.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install -D @dataverse-to-code/test @playwright/test
11
+ npx playwright install chromium
12
+ ```
13
+
14
+ ## Run your .test.yaml files
15
+
16
+ Add `tests/yaml.spec.ts`:
17
+
18
+ ```ts
19
+ import { yamlTests } from '@dataverse-to-code/test';
20
+
21
+ yamlTests();
22
+ ```
23
+
24
+ Then `npx playwright test`. Each case is a Playwright test; one that reaches something the offline run can't do fails as "Not supported offline", and cases marked for review or online-only are skipped.
25
+
26
+ ## Write tests in TypeScript
27
+
28
+ ```ts
29
+ import { expect, test } from '@dataverse-to-code/test';
30
+
31
+ test('picking the account names the project', async ({ form }) => {
32
+ await form.open('si_project/main/project', { records: [{ table: 'account', id: 'a1', values: { name: 'Contoso' } }], open: 'new' });
33
+ await form.set('si_accountid', 'a1');
34
+ expect(form.field('si_name')?.value).toBe('Contoso project');
35
+ });
36
+ ```
37
+
38
+ `form.set` takes values as test files write them (a choice by label, a lookup by record id, dates as `YYYY-MM-DD`). `form.field(name)` gives the value, its text, and whether it's required, visible, disabled, its label and notifications.
39
+
40
+ Running tests runs your project's JavaScript on this computer, as any test suite does.
41
+
42
+ ## Without Playwright's runner
43
+
44
+ `npx dvtest run` runs the tests in Node (no browser), as `dvschema test` does; `npx dvtest run --browser` uses Chromium.
45
+
46
+ ## Online runs
47
+
48
+ To run the same `.test.yaml` files against the real app in a development environment, use `dvschema test --online --env <name>` (or **Run online** in VS Code). It uses the Playwright you install here.
49
+
50
+ New to testing? The DataverseToCode extension's **Testing Guide** (in VS Code, **Dataverse: Open Testing Guide**) explains it from the start, including a section on Playwright.
package/dist/.built ADDED
@@ -0,0 +1 @@
1
+ 2026-10-13T07:46:17.020Z