Merge pull request 'test: Order catalog tests' (!1008) from wbuezas/salix-front-mindshore-fork2:feature/CatalogTests into dev
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
Reviewed-on: #1008 Reviewed-by: Javier Segarra <jsegarra@verdnatura.es>
This commit is contained in:
commit
827f6032b6
|
@ -273,6 +273,7 @@ function sanitizer(params) {
|
||||||
:key="chip.label"
|
:key="chip.label"
|
||||||
:removable="!unremovableParams?.includes(chip.label)"
|
:removable="!unremovableParams?.includes(chip.label)"
|
||||||
@remove="remove(chip.label)"
|
@remove="remove(chip.label)"
|
||||||
|
data-cy="vnFilterPanelChip"
|
||||||
>
|
>
|
||||||
<slot name="tags" :tag="chip" :format-fn="formatValue">
|
<slot name="tags" :tag="chip" :format-fn="formatValue">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
|
|
|
@ -49,7 +49,7 @@ const getSelectedTagValues = async (tag) => {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QForm @submit="applyTags()" class="all-pointer-events">
|
<QForm @submit="applyTags()" class="all-pointer-events">
|
||||||
<QCard class="q-pa-sm column q-pa-lg">
|
<QCard class="q-pa-sm column q-pa-lg" data-cy="catalogFilterValueDialog">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('params.tag')"
|
:label="t('params.tag')"
|
||||||
v-model="selectedTag"
|
v-model="selectedTag"
|
||||||
|
@ -63,6 +63,7 @@ const getSelectedTagValues = async (tag) => {
|
||||||
:emit-value="false"
|
:emit-value="false"
|
||||||
use-input
|
use-input
|
||||||
@update:model-value="getSelectedTagValues"
|
@update:model-value="getSelectedTagValues"
|
||||||
|
data-cy="catalogFilterValueDialogTagSelect"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-for="(value, index) in tagValues"
|
v-for="(value, index) in tagValues"
|
||||||
|
@ -93,6 +94,7 @@ const getSelectedTagValues = async (tag) => {
|
||||||
:disable="!value"
|
:disable="!value"
|
||||||
is-outlined
|
is-outlined
|
||||||
class="col"
|
class="col"
|
||||||
|
data-cy="catalogFilterValueDialogValueInput"
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
icon="delete"
|
icon="delete"
|
||||||
|
|
|
@ -98,7 +98,7 @@ watch(
|
||||||
/>
|
/>
|
||||||
</QScrollArea>
|
</QScrollArea>
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md" data-cy="orderCatalogPage">
|
||||||
<div class="full-width">
|
<div class="full-width">
|
||||||
<VnPaginate
|
<VnPaginate
|
||||||
:data-key="dataKey"
|
:data-key="dataKey"
|
||||||
|
@ -118,6 +118,7 @@ watch(
|
||||||
:item="row"
|
:item="row"
|
||||||
is-catalog
|
is-catalog
|
||||||
class="fill-icon"
|
class="fill-icon"
|
||||||
|
data-cy="orderCatalogItem"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -178,6 +178,7 @@ function addOrder(value, field, params) {
|
||||||
? resetCategory(params, searchFn)
|
? resetCategory(params, searchFn)
|
||||||
: removeTagGroupParam(params, searchFn, valIndex)
|
: removeTagGroupParam(params, searchFn, valIndex)
|
||||||
"
|
"
|
||||||
|
data-cy="catalogFilterCustomTag"
|
||||||
>
|
>
|
||||||
<strong v-if="customTag.label === 'categoryFk' && categoryList">
|
<strong v-if="customTag.label === 'categoryFk' && categoryList">
|
||||||
{{
|
{{
|
||||||
|
@ -211,6 +212,7 @@ function addOrder(value, field, params) {
|
||||||
:name="category.icon"
|
:name="category.icon"
|
||||||
class="category-icon"
|
class="category-icon"
|
||||||
@click="selectCategory(params, category, searchFn)"
|
@click="selectCategory(params, category, searchFn)"
|
||||||
|
data-cy="catalogFilterCategory"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t(category.name) }}
|
{{ t(category.name) }}
|
||||||
|
@ -234,6 +236,7 @@ function addOrder(value, field, params) {
|
||||||
sort-by="name ASC"
|
sort-by="name ASC"
|
||||||
:disable="!params.categoryFk"
|
:disable="!params.categoryFk"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
|
data-cy="catalogFilterType"
|
||||||
>
|
>
|
||||||
<template #option="{ itemProps, opt }">
|
<template #option="{ itemProps, opt }">
|
||||||
<QItem v-bind="itemProps">
|
<QItem v-bind="itemProps">
|
||||||
|
@ -285,6 +288,7 @@ function addOrder(value, field, params) {
|
||||||
:is-clearable="false"
|
:is-clearable="false"
|
||||||
v-model="searchByTag"
|
v-model="searchByTag"
|
||||||
@keyup.enter="(val) => onSearchByTag(val, params)"
|
@keyup.enter="(val) => onSearchByTag(val, params)"
|
||||||
|
data-cy="catalogFilterValueInput"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<QIcon name="search" />
|
<QIcon name="search" />
|
||||||
|
@ -297,6 +301,7 @@ function addOrder(value, field, params) {
|
||||||
color="primary"
|
color="primary"
|
||||||
size="md"
|
size="md"
|
||||||
dense
|
dense
|
||||||
|
data-cy="catalogFilterValueDialogBtn"
|
||||||
/>
|
/>
|
||||||
<QPopupProxy>
|
<QPopupProxy>
|
||||||
<CatalogFilterValueDialog
|
<CatalogFilterValueDialog
|
||||||
|
|
|
@ -0,0 +1,112 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('OrderCatalog', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 720);
|
||||||
|
cy.visit('/#/order/8/catalog');
|
||||||
|
});
|
||||||
|
|
||||||
|
const checkCustomFilterTag = (filterName = 'Plant') => {
|
||||||
|
cy.dataCy('catalogFilterCustomTag').should('exist');
|
||||||
|
cy.dataCy('catalogFilterCustomTag').contains(filterName);
|
||||||
|
};
|
||||||
|
|
||||||
|
const checkFilterTag = (filterName = 'Plant') => {
|
||||||
|
cy.dataCy('vnFilterPanelChip').should('exist');
|
||||||
|
cy.dataCy('vnFilterPanelChip').contains(filterName);
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectCategory = (categoryIndex = 1, categoryName = 'Plant') => {
|
||||||
|
cy.get(
|
||||||
|
`div.q-page-container div:nth-of-type(${categoryIndex}) > [data-cy='catalogFilterCategory']`
|
||||||
|
).should('exist');
|
||||||
|
cy.get(
|
||||||
|
`div.q-page-container div:nth-of-type(${categoryIndex}) > [data-cy='catalogFilterCategory']`
|
||||||
|
).click();
|
||||||
|
checkCustomFilterTag(categoryName);
|
||||||
|
};
|
||||||
|
|
||||||
|
const searchByCustomTagInput = (option) => {
|
||||||
|
cy.dataCy('catalogFilterValueInput').find('input').last().focus();
|
||||||
|
cy.dataCy('catalogFilterValueInput').find('input').last().type(option);
|
||||||
|
cy.dataCy('catalogFilterValueInput').find('input').last().type('{enter}');
|
||||||
|
checkCustomFilterTag(option);
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectTypeFilter = (option) => {
|
||||||
|
cy.selectOption(
|
||||||
|
'div.q-page-container div.list > div:nth-of-type(2) div:nth-of-type(3)',
|
||||||
|
option
|
||||||
|
);
|
||||||
|
checkFilterTag(option);
|
||||||
|
};
|
||||||
|
|
||||||
|
it('Shows empty state', () => {
|
||||||
|
cy.dataCy('orderCatalogPage').should('exist');
|
||||||
|
cy.dataCy('orderCatalogPage').contains('No data to display');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('filter by category', () => {
|
||||||
|
selectCategory();
|
||||||
|
cy.dataCy('orderCatalogItem').should('exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('filters by type', () => {
|
||||||
|
selectCategory();
|
||||||
|
selectTypeFilter('Anthurium');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('filters by custom value select', () => {
|
||||||
|
selectCategory();
|
||||||
|
searchByCustomTagInput('Silver');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('filters by custom value dialog', () => {
|
||||||
|
Cypress.on('uncaught:exception', (err) => {
|
||||||
|
if (err.message.includes('canceled')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
selectCategory();
|
||||||
|
cy.dataCy('catalogFilterValueDialogBtn').should('exist');
|
||||||
|
cy.dataCy('catalogFilterValueDialogBtn').last().click();
|
||||||
|
cy.dataCy('catalogFilterValueDialogTagSelect').should('exist');
|
||||||
|
cy.selectOption("[data-cy='catalogFilterValueDialogTagSelect']", 'Tallos');
|
||||||
|
cy.dataCy('catalogFilterValueDialogValueInput').find('input').focus();
|
||||||
|
cy.dataCy('catalogFilterValueDialogValueInput').find('input').type('2');
|
||||||
|
cy.dataCy('catalogFilterValueDialogValueInput').find('input').type('{enter}');
|
||||||
|
checkCustomFilterTag('2');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('removes a secondary tag', () => {
|
||||||
|
selectCategory();
|
||||||
|
selectTypeFilter('Anthurium');
|
||||||
|
cy.dataCy('vnFilterPanelChip').should('exist');
|
||||||
|
cy.get(
|
||||||
|
"div.q-page-container [data-cy='vnFilterPanelChip'] > i.q-chip__icon--remove"
|
||||||
|
)
|
||||||
|
.contains('cancel')
|
||||||
|
.should('exist');
|
||||||
|
cy.get(
|
||||||
|
"div.q-page-container [data-cy='vnFilterPanelChip'] > i.q-chip__icon--remove"
|
||||||
|
)
|
||||||
|
.contains('cancel')
|
||||||
|
.click();
|
||||||
|
cy.dataCy('vnFilterPanelChip').should('not.exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Removes category tag', () => {
|
||||||
|
selectCategory();
|
||||||
|
cy.get(
|
||||||
|
"div.q-page-container [data-cy='catalogFilterCustomTag'] > i.q-chip__icon--remove"
|
||||||
|
)
|
||||||
|
.contains('cancel')
|
||||||
|
.should('exist');
|
||||||
|
cy.get(
|
||||||
|
"div.q-page-container [data-cy='catalogFilterCustomTag'] > i.q-chip__icon--remove"
|
||||||
|
)
|
||||||
|
.contains('cancel')
|
||||||
|
.click();
|
||||||
|
cy.dataCy('catalogFilterCustomTag').should('not.exist');
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue