File tree Expand file tree Collapse file tree 1 file changed +20
-16
lines changed Expand file tree Collapse file tree 1 file changed +20
-16
lines changed Original file line number Diff line number Diff line change @@ -43,42 +43,46 @@ npm install -D cypress-ct-qwik
4343
4444## Configuring Cypress
4545
46+ 1 . Run cypress (in watch mode) after installation
47+ 2 . Follow the configuration wizard
48+ 3 . Add ` addQwikLoader ` to the ` component.ts ` file -
49+
4650``` ts
47- // cypress.config .ts
51+ // component .ts
4852
49- import { defineConfig } from ' cypress' ;
53+ import { addQwikLoader } from ' cypress-ct-qwik ' ;
5054
51- export default defineConfig ({
52- component: {
53- devServer: {
54- mode: ' test' ,
55- bundler: ' vite' ,
56- } as any ,
57- },
58- });
55+ addQwikLoader ();
5956```
6057
61- Add ` addQwikLoader ` to the ` component .ts` file -
58+ 4 . Add the ` mount ` command to ` support/commands .ts` -
6259
6360``` ts
64- // component .ts
61+ // commands .ts
6562
66- import { addQwikLoader } from ' cypress-ct-qwik' ;
63+ import { mount } from ' cypress-ct-qwik' ;
6764
68- addQwikLoader ();
65+ declare namespace Cypress {
66+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
67+ interface Chainable <Subject > {
68+ mount: typeof mount ;
69+ }
70+ }
71+ //
72+
73+ Cypress .Commands .add (' mount' , mount );
6974```
7075
7176## Usage
7277
7378``` ts
7479// some-test.cy.ts
7580
76- import { mount } from ' cypress-ct-qwik' ;
7781import MyComp from ' ./my-comp' ;
7882
7983describe (` Qwik Component Test ` , () => {
8084 it (' should find my link' , () => {
81- mount (<MyComp />);
85+ cy . mount (<MyComp />);
8286
8387 cy .contains (' myLink' ).should (' exist' );
8488 });
You can’t perform that action at this time.
0 commit comments