@dataverse-to-code/test 0.0.0-stage → 0.21.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 +47 -2
- package/dist/.built +1 -0
- package/dist/cli.js +77799 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +8340 -0
- package/dist/sim.css +57 -0
- package/dist/sim.js +4713 -0
- package/package.json +14 -4
package/README.md
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @dataverse-to-code/test
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Run a [DataverseToCode](https://github.com/SimonAllport/DataverseToCode) 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.
|
package/dist/.built
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2026-10-11T07:34:53.718Z
|