@jscutlery/cypress-harness 0.3.12 → 0.4.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.
- package/CHANGELOG.md +14 -0
- package/README.md +32 -2
- package/package.json +27 -4
- package/src/preprocessor-config.d.ts +2 -0
- package/src/preprocessor-config.js +22 -0
- package/src/preprocessor-config.js.map +1 -0
- package/src/support-ct.d.ts +1 -0
- package/src/support-ct.js +4 -0
- package/src/support-ct.js.map +1 -0
- package/{support.d.ts → src/support.d.ts} +0 -0
- package/{support.js → src/support.js} +0 -0
- package/src/support.js.map +1 -0
- package/support.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.4.1](https://github.com/jscutlery/devkit/compare/cypress-harness-0.4.0...cypress-harness-0.4.1) (2022-12-01)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# [0.4.0](https://github.com/jscutlery/devkit/compare/cypress-harness-0.3.12...cypress-harness-0.4.0) (2022-12-01)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* **cypress-harness:** ✨ provide getPreprocessorConfig util ([56d74c9](https://github.com/jscutlery/devkit/commit/56d74c954785b4cc30d4aac63d7e87015e4b858f))
|
|
15
|
+
* **cypress-harness:** ✨add support for Cypress 10 & 11 ([4d29535](https://github.com/jscutlery/devkit/commit/4d2953594f280031d8df0e5f429f74171ad236bf))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
5
19
|
## [0.3.12](https://github.com/jscutlery/devkit/compare/cypress-harness-0.3.11...cypress-harness-0.3.12) (2022-06-24)
|
|
6
20
|
|
|
7
21
|
|
package/README.md
CHANGED
|
@@ -24,14 +24,43 @@ yarn add -D @jscutlery/cypress-harness @angular/cdk cypress-pipe
|
|
|
24
24
|
npm install -D @jscutlery/cypress-harness @angular/cdk cypress-pipe
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
### 2.
|
|
27
|
+
### 2. Setup
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
#### 2.a. Cypress E2E
|
|
30
|
+
|
|
31
|
+
Update your e2e folder's `cypress/support/e2e.ts` and add:
|
|
30
32
|
|
|
31
33
|
```ts
|
|
32
34
|
import '@jscutlery/cypress-harness/support';
|
|
33
35
|
```
|
|
34
36
|
|
|
37
|
+
then update the `cypress.config.ts` file as follows:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { defineConfig } from 'cypress';
|
|
41
|
+
import { getPreprocessorConfig } from '@jscutlery/cypress-harness/preprocessor-config';
|
|
42
|
+
|
|
43
|
+
export default defineConfig({
|
|
44
|
+
e2e: {
|
|
45
|
+
// ... other existing settings if any (like nxE2EPreset() if using Nx).
|
|
46
|
+
...getPreprocessorConfig()
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This last part is needed to add support for [package exports conditionals](https://nodejs.org/api/packages.html#conditional-exports)
|
|
52
|
+
and allow us to import harnesses from `@angular/cdk/testing` for example.
|
|
53
|
+
|
|
54
|
+
#### 2.b. Cypress Component Testing
|
|
55
|
+
|
|
56
|
+
If you are using Cypress Component Testing then there is a different import to add to the following file: `cypress/support/component.ts`:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import '@jscutlery/cypress-harness/support-ct';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
_(the `getPreprocessorConfig()` is not required here as it is already set up by `cypress/angular`.)_
|
|
63
|
+
|
|
35
64
|
## Usage
|
|
36
65
|
|
|
37
66
|
```ts
|
|
@@ -42,6 +71,7 @@ describe('datepicker', () => {
|
|
|
42
71
|
const calendars = getAllHarnesses(MatCalendarHarness);
|
|
43
72
|
|
|
44
73
|
it('should set date', () => {
|
|
74
|
+
cy.visit('/'); // or cy.mount(MyComponent); for component testing.
|
|
45
75
|
datepicker.setValue('1/1/2010');
|
|
46
76
|
datepicker.openCalendar();
|
|
47
77
|
datepicker.getCalendar().invoke('next'); // next method is already used
|
package/package.json
CHANGED
|
@@ -1,17 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jscutlery/cypress-harness",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "https://github.com/jscutlery/devkit"
|
|
6
6
|
},
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./src/index.d.ts",
|
|
10
|
+
"default": "./src/index.js",
|
|
11
|
+
"require": "./src/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./preprocessor-config": {
|
|
14
|
+
"types": "./src/preprocessor-config.d.ts",
|
|
15
|
+
"default": "./src/preprocessor-config.js"
|
|
16
|
+
},
|
|
17
|
+
"./support": {
|
|
18
|
+
"types": "./src/support.d.ts",
|
|
19
|
+
"default": "./src/support.js"
|
|
20
|
+
},
|
|
21
|
+
"./support-ct": {
|
|
22
|
+
"types": "./src/support-ct.d.ts",
|
|
23
|
+
"default": "./src/support-ct.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@cypress/webpack-batteries-included-preprocessor": "^2.2.4",
|
|
28
|
+
"@cypress/webpack-preprocessor": "^5.0.0",
|
|
29
|
+
"webpack": "^5.0.0"
|
|
30
|
+
},
|
|
7
31
|
"peerDependencies": {
|
|
8
32
|
"@angular/cdk": "*",
|
|
9
33
|
"cypress": "*",
|
|
10
34
|
"cypress-pipe": "*",
|
|
11
|
-
"zone.js": "
|
|
35
|
+
"zone.js": "*",
|
|
12
36
|
"tslib": "2.4.0"
|
|
13
37
|
},
|
|
14
38
|
"main": "./src/index.js",
|
|
15
|
-
"
|
|
16
|
-
"dependencies": {}
|
|
39
|
+
"types": "./src/index.d.ts"
|
|
17
40
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPreprocessorConfig = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const webpack_batteries_included_preprocessor_1 = tslib_1.__importDefault(require("@cypress/webpack-batteries-included-preprocessor"));
|
|
6
|
+
function getPreprocessorConfig() {
|
|
7
|
+
return {
|
|
8
|
+
setupNodeEvents(on) {
|
|
9
|
+
/**
|
|
10
|
+
* We need this setup in e2e tests to fix "package exports conditionals"
|
|
11
|
+
* support.
|
|
12
|
+
* In fact, without this, importing @angular/cdk/testing (used by harnesses)
|
|
13
|
+
* will simply fail with a "Module not found" error.
|
|
14
|
+
*/
|
|
15
|
+
on('file:preprocessor', (0, webpack_batteries_included_preprocessor_1.default)({
|
|
16
|
+
typescript: require.resolve('typescript')
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
exports.getPreprocessorConfig = getPreprocessorConfig;
|
|
22
|
+
//# sourceMappingURL=preprocessor-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preprocessor-config.js","sourceRoot":"","sources":["../../../../packages/cypress-harness/src/preprocessor-config.ts"],"names":[],"mappings":";;;;AAAA,uIAAmF;AAGnF,SAAgB,qBAAqB;IACnC,OAAO;QACL,eAAe,CAAC,EAAE;YAChB;;;;;eAKG;YACH,EAAE,CAAC,mBAAmB,EAAE,IAAA,iDAAmB,EAAC;gBAC1C,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;aAC1C,CAAC,CAAC,CAAC;QACN,CAAC;KACF,CAAC;AACJ,CAAC;AAdD,sDAcC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'cypress-pipe';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"support-ct.js","sourceRoot":"","sources":["../../../../packages/cypress-harness/src/support-ct.ts"],"names":[],"mappings":";;AAAA,wBAAsB"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"support.js","sourceRoot":"","sources":["../../../../packages/cypress-harness/src/support.ts"],"names":[],"mappings":";;AAAA,wBAAsB;AAEtB;;;;;GAKG;AACH,6BAA2B;AAE3B,mEAAmE;AACnE,8DAA8D;AAC7D,UAAkB,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC;AAEvD,qCAAmC"}
|
package/support.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"support.js","sourceRoot":"","sources":["../../../packages/cypress-harness/support.ts"],"names":[],"mappings":";;AAAA,wBAAsB;AAEtB;;;;;GAKG;AACH,6BAA2B;AAC3B,mEAAmE;AACnE,8DAA8D;AAC7D,UAAkB,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC;AACvD,qCAAmC"}
|