cypress-ct-octane-js 0.1.33 → 0.1.34

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 (2) hide show
  1. package/README.md +46 -4
  2. package/package.json +2 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <div><a href="https://octanejs.dev/">Octane</a> framework definition and mount adapter for <a href="https://docs.cypress.io/app/component-testing/">component testing</a> with <a href="https://www.cypress.io/">Cypress</a></div>
1
+ <a href="https://octanejs.dev/">Octane</a> framework definition and mount adapter for <a href="https://docs.cypress.io/app/component-testing/">component testing</a> with <a href="https://www.cypress.io/">Cypress</a>
2
2
 
3
3
  ## Installation
4
4
 
@@ -20,13 +20,55 @@ pnpm add cypress-ct-octane-js
20
20
  npm cypress-ct-octane-js
21
21
  ```
22
22
 
23
+ ## Configuration
24
+
25
+ Add `cypress-ct-octane-js` framework to your `cypress.config.{ts,js}` file
26
+
27
+ ```ts
28
+ export default defineConfig({
29
+ component: {
30
+ devServer: {
31
+ framework: "cypress-ct-octane-js",
32
+ bundler: "vite",
33
+ //...more config if necessary
34
+ },
35
+ },
36
+ });
37
+ ```
38
+
39
+ If you use Typescript, you may get a type error when setting the framework property. To fix it, type cast the property to `any` like this:
40
+
41
+ ```ts
42
+ framework: 'cypress-ct-octane-js' as any,
43
+ ```
44
+
45
+ ## Adding mount command
46
+
47
+ Add the following lines to your `component.ts` in the `cypress` directory.
48
+
49
+ ```ts
50
+ import { mount } from "cypress-ct-octane-js";
51
+
52
+ declare global {
53
+ namespace Cypress {
54
+ interface Chainable {
55
+ mount: typeof mount;
56
+ }
57
+ }
58
+ }
59
+
60
+ Cypress.Commands.add("mount", mount);
61
+ ```
62
+
23
63
  ## Usage example
24
64
 
65
+ You can now use the `cy.mount` function to mount octane components in Cypress.
66
+
25
67
  ```javascript
26
- import { mount } from "cypress-ct-octane-js";
68
+ import { Greeting } from "my-octane-components";
27
69
 
28
- it("example test", () => {
29
- mount(<>Hello World!</>);
70
+ it("should display 'Hello World'", () => {
71
+ cy.mount(<Greeting text="Hello World!" />);
30
72
  cy.contains("Hello World!").should("be.visible");
31
73
  });
32
74
  ```
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "cypress-ct-octane-js",
3
- "version": "0.1.33",
3
+ "version": "0.1.34",
4
4
  "description": "Octane framework definition and mount adapter for Cypress component testing",
5
5
  "keywords": [
6
+ "component-testing",
6
7
  "cypress",
7
8
  "octane",
8
9
  "testing"