forked from verdnatura/hedera-web
Items view tests
This commit is contained in:
parent
879e3cbb44
commit
12ff0b5845
|
@ -71,6 +71,7 @@ onMounted(() => {
|
||||||
is-outlined
|
is-outlined
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
class="searchbar"
|
class="searchbar"
|
||||||
|
data-testid="searchBar"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<QIcon name="search" class="cursor-pointer" @click="search()" />
|
<QIcon name="search" class="cursor-pointer" @click="search()" />
|
||||||
|
|
|
@ -44,11 +44,13 @@ const onSearch = data => (items.value = data || []);
|
||||||
empty-icon="refresh"
|
empty-icon="refresh"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:rows="items"
|
:rows="items"
|
||||||
|
data-testid="itemsViewList"
|
||||||
>
|
>
|
||||||
<CardList
|
<CardList
|
||||||
v-for="(item, index) in items"
|
v-for="(item, index) in items"
|
||||||
:key="index"
|
:key="index"
|
||||||
:clickable="false"
|
:clickable="false"
|
||||||
|
data-testid="itemsViewCard"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<VnImg
|
<VnImg
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
describe('NewsView', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('/#/admin/items');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('shows empty state', () => {
|
||||||
|
cy.dataCy('itemsViewList').should('exist');
|
||||||
|
cy.dataCy('itemsViewList').should(
|
||||||
|
'contain',
|
||||||
|
'Introduce un término de búsqueda'
|
||||||
|
);
|
||||||
|
cy.dataCy('itemsViewCard').should('not.exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('search for an item', () => {
|
||||||
|
cy.dataCy('searchBar').should('exist');
|
||||||
|
cy.get('input[data-testid="searchBar"]').type('Bolas de madera{enter}');
|
||||||
|
cy.dataCy('itemsViewList').should(
|
||||||
|
'not.contain',
|
||||||
|
'Introduce un término de búsqueda'
|
||||||
|
);
|
||||||
|
cy.dataCy('itemsViewCard').should('exist');
|
||||||
|
cy.dataCy('itemsViewCard').should('contain', 'Bolas de madera');
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue