@genesislcap/foundation-testing 14.63.1-alpha-e78a361.0 → 14.64.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 +18 -21
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Genesis Foundation
|
|
1
|
+
# Genesis Foundation testing
|
|
2
2
|
|
|
3
3
|
[](https://lerna.js.org/)
|
|
4
4
|
[](https://www.typescriptlang.org/)
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
### [API Docs](./docs/api/index.md)
|
|
9
9
|
|
|
10
|
-
## Unit
|
|
10
|
+
## Unit testing with UVU
|
|
11
11
|
|
|
12
12
|
Unit testing is provided by [UVU](https://github.com/lukeed/uvu)
|
|
13
13
|
|
|
@@ -18,7 +18,7 @@ Unit testing is provided by [UVU](https://github.com/lukeed/uvu)
|
|
|
18
18
|
* Individually executable test files
|
|
19
19
|
* Supports `async`/`await` tests
|
|
20
20
|
* Supports native ES Modules
|
|
21
|
-
* Browser-
|
|
21
|
+
* Browser-compatible
|
|
22
22
|
* Familiar API
|
|
23
23
|
|
|
24
24
|
## E2E Testing with Playwright
|
|
@@ -35,23 +35,22 @@ E2E testing is provided by [Playwright](https://playwright.dev/docs/intro)
|
|
|
35
35
|
|
|
36
36
|
## Test Organisation
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
You can unit-test specific logic by adding a test file alongside the source file.
|
|
39
39
|
|
|
40
40
|
```
|
|
41
41
|
logic.ts
|
|
42
42
|
logic.test.ts
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
If your test spans more than one file or is more of an end-to-end test, you may wish to add your test to your package's
|
|
46
|
-
`/test` directory instead. An example structure might be:
|
|
45
|
+
If your test spans more than one file or is more of an end-to-end test, you may wish to add your test to your package's **/test** directory instead. An example structure might be:
|
|
47
46
|
|
|
48
47
|
```
|
|
49
|
-
├── src
|
|
48
|
+
├── src
|
|
50
49
|
│ └── logic.ts
|
|
51
50
|
│ └── logic.test.ts
|
|
52
51
|
│ └── component.ts
|
|
53
52
|
│ └── component.test.ts
|
|
54
|
-
├── test
|
|
53
|
+
├── test
|
|
55
54
|
│ └── e2e
|
|
56
55
|
│ └── baseline.e2e.ts
|
|
57
56
|
│ └── unit
|
|
@@ -60,7 +59,7 @@ If your test spans more than one file or is more of an end-to-end test, you may
|
|
|
60
59
|
└── playwright.config.ts
|
|
61
60
|
```
|
|
62
61
|
|
|
63
|
-
The contents of your package's
|
|
62
|
+
The contents of your package's **playwright.config.ts** may include:
|
|
64
63
|
|
|
65
64
|
```ts
|
|
66
65
|
export { configDefaults as default } from '@genesislcap/foundation-testing/e2e';
|
|
@@ -78,16 +77,16 @@ export default {
|
|
|
78
77
|
};
|
|
79
78
|
```
|
|
80
79
|
|
|
81
|
-
If you need to customise JSDOM, you can create
|
|
80
|
+
If you need to customise JSDOM, you can create a **jsdom.setup.ts** file in your package directory:
|
|
82
81
|
|
|
83
82
|
```ts
|
|
84
83
|
// custom code
|
|
85
84
|
export * from '@genesislcap/foundation-testing/jsdom';
|
|
86
85
|
```
|
|
87
86
|
|
|
88
|
-
## Test
|
|
87
|
+
## Test scripts
|
|
89
88
|
|
|
90
|
-
The test
|
|
89
|
+
The test-related scripts to add to your package's **package.json** file may include:
|
|
91
90
|
|
|
92
91
|
```
|
|
93
92
|
"test": "genx test",
|
|
@@ -102,9 +101,9 @@ The test related scripts to add to your package's `package.json` file may includ
|
|
|
102
101
|
"test:debug": "genx test --debug"
|
|
103
102
|
```
|
|
104
103
|
|
|
105
|
-
## Testing
|
|
104
|
+
## Testing logic
|
|
106
105
|
|
|
107
|
-
The
|
|
106
|
+
The **logic.test.ts** usually uses `createLogicSuite`, which is used to test function output given certain input
|
|
108
107
|
arguments. Based on user feedback, these arguments are now passed as an array by convention:
|
|
109
108
|
|
|
110
109
|
```ts
|
|
@@ -130,11 +129,9 @@ Suite('myFunction should provide expected results', ({ runCases }) => {
|
|
|
130
129
|
Suite.run();
|
|
131
130
|
```
|
|
132
131
|
|
|
133
|
-
## Testing
|
|
132
|
+
## Testing components
|
|
134
133
|
|
|
135
|
-
The
|
|
136
|
-
`createComponentSuite`. Apart from setting up and tearing down your element fixture with a wrapping design system and DI
|
|
137
|
-
container, this util also allows you to provide DI container mocks, which will be required for certain testing flows.
|
|
134
|
+
The **component.test.ts** or any test that directly or indirectly makes use of the DI uses `createComponentSuite`. Apart from setting up and tearing down your element fixture with a wrapping design system and DI container, this util also allows you to provide DI container mocks, which are required for certain testing flows.
|
|
138
135
|
|
|
139
136
|
```ts
|
|
140
137
|
// component.test.ts
|
|
@@ -222,7 +219,7 @@ Suite.run();
|
|
|
222
219
|
|
|
223
220
|
## Testing E2E
|
|
224
221
|
|
|
225
|
-
The
|
|
222
|
+
The **baseline.e2e.ts** uses `playwright`; test cases have access to the fixtures provided during set-up.
|
|
226
223
|
|
|
227
224
|
```ts
|
|
228
225
|
import { test, expect } from '@genesislcap/foundation-testing/e2e';
|
|
@@ -238,7 +235,7 @@ _We will be adding more details on E2E in future updates._
|
|
|
238
235
|
|
|
239
236
|
## License
|
|
240
237
|
|
|
241
|
-
Note: this project provides front
|
|
238
|
+
Note: this project provides front-end dependencies and uses licensed components listed in the next section; thus, licenses for those components are required during development. Contact [Genesis Global](https://genesis.global/contact-us/) for more details.
|
|
242
239
|
|
|
243
240
|
### Licensed components
|
|
244
|
-
Genesis low-code platform
|
|
241
|
+
Genesis low-code platform
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-testing",
|
|
3
3
|
"description": "Genesis Foundation Testing",
|
|
4
|
-
"version": "14.
|
|
4
|
+
"version": "14.64.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"typescript": "^4.5.5"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@genesislcap/foundation-utils": "14.
|
|
47
|
+
"@genesislcap/foundation-utils": "14.64.0",
|
|
48
48
|
"@microsoft/fast-element": "^1.7.0",
|
|
49
49
|
"@microsoft/fast-foundation": "^2.33.2",
|
|
50
50
|
"@playwright/test": "^1.18.1",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "b9342cf385809ba4b2ad9bc592ae9dffe9360ce4"
|
|
69
69
|
}
|