Skip to content

Commit fb0bfe8

Browse files
committed
docs: updated config and usage
1 parent 75029a4 commit fb0bfe8

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

README.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff 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';
7781
import MyComp from './my-comp';
7882

7983
describe(`Qwik Component Test`, () => {
8084
it('should find my link', () => {
81-
mount(<MyComp />);
85+
cy.mount(<MyComp />);
8286

8387
cy.contains('myLink').should('exist');
8488
});

0 commit comments

Comments
 (0)