@jscutlery/cypress-harness 0.4.0 → 0.4.2

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +32 -2
  3. package/package.json +6 -5
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.4.2](https://github.com/jscutlery/devkit/compare/cypress-harness-0.4.1...cypress-harness-0.4.2) (2022-12-03)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **cypress-harness:** 🐞 fix webpack import error ([787219c](https://github.com/jscutlery/devkit/commit/787219c243128c819567fe9f8678168d30fd8e12))
11
+
12
+
13
+
14
+ ## [0.4.1](https://github.com/jscutlery/devkit/compare/cypress-harness-0.4.0...cypress-harness-0.4.1) (2022-12-01)
15
+
16
+
17
+
5
18
  # [0.4.0](https://github.com/jscutlery/devkit/compare/cypress-harness-0.3.12...cypress-harness-0.4.0) (2022-12-01)
6
19
 
7
20
 
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. Import support commands
27
+ ### 2. Setup
28
28
 
29
- Update your e2e folder's `*-e2e/src/support/index.ts` and add:
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,14 +1,14 @@
1
1
  {
2
2
  "name": "@jscutlery/cypress-harness",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "repository": {
5
5
  "url": "https://github.com/jscutlery/devkit"
6
6
  },
7
7
  "exports": {
8
8
  ".": {
9
9
  "types": "./src/index.d.ts",
10
- "default": "./src/index.js",
11
- "require": "./src/index.js"
10
+ "require": "./src/index.js",
11
+ "default": "./src/index.js"
12
12
  },
13
13
  "./preprocessor-config": {
14
14
  "types": "./src/preprocessor-config.d.ts",
@@ -24,11 +24,12 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "@cypress/webpack-batteries-included-preprocessor": "^2.2.4"
27
+ "@cypress/webpack-batteries-included-preprocessor": "^2.2.4",
28
+ "@cypress/webpack-preprocessor": "^5.0.0",
29
+ "webpack": "^5.0.0"
28
30
  },
29
31
  "peerDependencies": {
30
32
  "@angular/cdk": "*",
31
- "@cypress/webpack-preprocessor": "^5.0.0",
32
33
  "cypress": "*",
33
34
  "cypress-pipe": "*",
34
35
  "zone.js": "*",