cypress-ct-octane-js 0.1.33 → 0.1.35

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 +47 -12
  2. package/package.json +2 -1
package/README.md CHANGED
@@ -1,32 +1,67 @@
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
 
5
- #### With bun
6
-
7
5
  ```sh
6
+ # bun
8
7
  bun i cypress-ct-octane-js
8
+
9
+ # pnpm
10
+ pnpm add cypress-ct-octane-js
11
+
12
+ # npm
13
+ npm i cypress-ct-octane-js
9
14
  ```
10
15
 
11
- #### With pnpm
16
+ ## Configuration
12
17
 
13
- ```sh
14
- pnpm add cypress-ct-octane-js
18
+ Add `cypress-ct-octane-js` framework to your `cypress.config.{ts,js}` file
19
+
20
+ ```ts
21
+ export default defineConfig({
22
+ component: {
23
+ devServer: {
24
+ framework: "cypress-ct-octane-js",
25
+ bundler: "vite",
26
+ //...more config if necessary
27
+ },
28
+ },
29
+ });
15
30
  ```
16
31
 
17
- #### With NPM
32
+ 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:
18
33
 
19
- ```sh
20
- npm cypress-ct-octane-js
34
+ ```ts
35
+ framework: "cypress-ct-octane-js" as any,
36
+ ```
37
+
38
+ ## Adding mount command
39
+
40
+ Add the following lines to your `component.ts` in the `cypress` directory.
41
+
42
+ ```ts
43
+ import { mount } from "cypress-ct-octane-js";
44
+
45
+ declare global {
46
+ namespace Cypress {
47
+ interface Chainable {
48
+ mount: typeof mount;
49
+ }
50
+ }
51
+ }
52
+
53
+ Cypress.Commands.add("mount", mount);
21
54
  ```
22
55
 
23
56
  ## Usage example
24
57
 
58
+ You can now use the `cy.mount` function to mount octane components in Cypress.
59
+
25
60
  ```javascript
26
- import { mount } from "cypress-ct-octane-js";
61
+ import { Greeting } from "my-octane-components";
27
62
 
28
- it("example test", () => {
29
- mount(<>Hello World!</>);
63
+ it("should display 'Hello World'", () => {
64
+ cy.mount(<Greeting text="Hello World!" />);
30
65
  cy.contains("Hello World!").should("be.visible");
31
66
  });
32
67
  ```
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.35",
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"