You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`dataCy`|`cy.dataCy('my-data-id')`| Implements the [selection best practice](https://docs.cypress.io/guides/references/best-practices.html#Selecting-Elements) which avoids brittle tests, is equivalent to `cy.get('[data-cy=my-data-id]')`|
38
-
|`testRoute`|`cy.testRoute('home')` <br /> `cy.testRoute('books/*/pages/*')`| Tests if the current URL matches the provided string using [`minimatch`](https://docs.cypress.io/api/utilities/minimatch). Leading `#`, if using router hash mode, and `/` are automatically prepended. |
39
-
|`within[Portal\|Menu\|SelectMenu\|Dialog]`|`cy.withinSelectMenu(() => cy.get('.q-item').first().click())` <br /> `cy.withinDialog({ dataCy: 'add-action-dialog', fn() { /* business haha */ } });`| Auto-scope commands into the callback within the Portal-based component and perform assertions common to all of them. |
40
-
|`should('have.[color\|backgroundColor]')`|`cy.get('foo').should('have.color', 'white')` <br /> `cy.get('foo').should('have.backgroundColor', '#000')` <br /> `cy.get('foo').should('have.color', 'var(--q-primary)')`| Provide a couple color-related custom matchers, which accept any valid CSS color format. |
|`dataCy`|`cy.dataCy('my-data-id')`| Implement the [selection best practice](https://docs.cypress.io/guides/references/best-practices.html#Selecting-Elements) which avoids brittle tests, is equivalent to `cy.get('[data-cy=my-data-id]')`|
38
+
|`selectDate`|`cy.get('.q-date').selectDate('2023/02/23')`| Select a given date into a QDate component, it accept either a `Date` object or a string which `new Date(myDate)` can parse correctly |
39
+
|`testRoute`|`cy.testRoute('home')` <br /> `cy.testRoute('books/*/pages/*')`| Test if the current URL matches the provided string using [`minimatch`](https://docs.cypress.io/api/utilities/minimatch). Leading `#`, if using router hash mode, and `/` are automatically prepended. |
40
+
|`within[Portal\|Menu\|SelectMenu\|Dialog]`|`cy.withinSelectMenu(() => cy.get('.q-item').first().click())` <br /> `cy.withinDialog({ dataCy: 'add-action-dialog', fn() { /* business haha */ } });`| Auto-scope commands into the callback within the Portal-based component and perform assertions common to all of them. |
41
+
|`should('have.[color\|backgroundColor]')`|`cy.get('foo').should('have.color', 'white')` <br /> `cy.get('foo').should('have.backgroundColor', '#000')` <br /> `cy.get('foo').should('have.color', 'var(--q-primary)')`| Provide a couple color-related custom matchers, which accept any valid CSS color format. |
42
+
43
+
> Check out how to use these commands, and other recipes about testing Quasar UI components, into our [automated tests suite](./src/templates/typescript/src/components/___tests__).
41
44
42
45
You must have a running dev server in order to run integration tests. The scripts added by this AE automatically take care of this: `yarn test:e2e` and `yarn test:e2e:ci` will launch `quasar dev` when starting up the tests and kill it when cypress process ends.
43
46
@@ -178,6 +181,24 @@ The good news is that we don't actually need to, since official documentation fo
Vue Test Utils doesn't provide an helper to test your components vModel, so we created our own, which even allow you use refs into your tests, based on [this discussion](https://github.com/vuejs/test-utils/discussions/279).
187
+
188
+
```ts
189
+
const model =ref(null);
190
+
mount(QSelect, {
191
+
props: {
192
+
...vModelAdapter(model),
193
+
// or, if you're using a custom name for your vModel, use
194
+
// ...vModelAdapter(model, 'myModelName'),
195
+
options,
196
+
},
197
+
});
198
+
```
199
+
200
+
Check out more examples [here](./src/templates/typescript/src/components/___tests__/VModelComponent.cy.ts).
0 commit comments