Merge pull request '#8220 created items e2e' (!1039) from 8220-ItemsE2E into dev
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
Reviewed-on: #1039 Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
c9c0a25ff9
|
@ -55,6 +55,7 @@ const onDataSaved = (data) => {
|
||||||
v-model.number="data.quantity"
|
v-model.number="data.quantity"
|
||||||
type="number"
|
type="number"
|
||||||
autofocus
|
autofocus
|
||||||
|
data-cy="regularizeStockInput"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
|
|
|
@ -52,6 +52,7 @@ const entityId = computed(() => {
|
||||||
:fields="['id', 'name']"
|
:fields="['id', 'name']"
|
||||||
sort-by="name ASC"
|
sort-by="name ASC"
|
||||||
hide-selected
|
hide-selected
|
||||||
|
data-cy="AddGenusSelectDialog"
|
||||||
>
|
>
|
||||||
<template #form>
|
<template #form>
|
||||||
<CreateGenusForm
|
<CreateGenusForm
|
||||||
|
@ -68,6 +69,7 @@ const entityId = computed(() => {
|
||||||
:fields="['id', 'name']"
|
:fields="['id', 'name']"
|
||||||
sort-by="name ASC"
|
sort-by="name ASC"
|
||||||
hide-selected
|
hide-selected
|
||||||
|
data-cy="AddSpeciesSelectDialog"
|
||||||
>
|
>
|
||||||
<template #form>
|
<template #form>
|
||||||
<CreateSpecieForm
|
<CreateSpecieForm
|
||||||
|
|
|
@ -107,7 +107,7 @@ const submitTags = async (data) => {
|
||||||
@on-fetch="onItemTagsFetched"
|
@on-fetch="onItemTagsFetched"
|
||||||
>
|
>
|
||||||
<template #body="{ rows, validate }">
|
<template #body="{ rows, validate }">
|
||||||
<QCard class="q-px-lg q-pt-md q-pb-sm">
|
<QCard class="q-px-lg q-pt-md q-pb-sm" data-cy="itemTags">
|
||||||
<VnRow
|
<VnRow
|
||||||
v-for="(row, index) in rows"
|
v-for="(row, index) in rows"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed, onBeforeMount } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import VnImg from 'src/components/ui/VnImg.vue';
|
import VnImg from 'src/components/ui/VnImg.vue';
|
||||||
|
@ -15,6 +15,9 @@ import ItemTypeDescriptorProxy from './ItemType/Card/ItemTypeDescriptorProxy.vue
|
||||||
import { cloneItem } from 'src/pages/Item/composables/cloneItem';
|
import { cloneItem } from 'src/pages/Item/composables/cloneItem';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import ItemListFilter from './ItemListFilter.vue';
|
import ItemListFilter from './ItemListFilter.vue';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
const entityId = computed(() => route.params.id);
|
const entityId = computed(() => route.params.id);
|
||||||
const { openCloneDialog } = cloneItem();
|
const { openCloneDialog } = cloneItem();
|
||||||
|
@ -22,7 +25,9 @@ const { viewSummary } = useSummaryDialog();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const validPriorities = ref([]);
|
||||||
|
const defaultTag = ref();
|
||||||
|
const defaultPriority = ref();
|
||||||
const itemFilter = {
|
const itemFilter = {
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
|
@ -90,7 +95,6 @@ const columns = computed(() => [
|
||||||
label: t('globals.description'),
|
label: t('globals.description'),
|
||||||
name: 'description',
|
name: 'description',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
create: true,
|
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
name: 'search',
|
name: 'search',
|
||||||
},
|
},
|
||||||
|
@ -132,7 +136,6 @@ const columns = computed(() => [
|
||||||
fields: ['id', 'name'],
|
fields: ['id', 'name'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
create: true,
|
|
||||||
visible: false,
|
visible: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -161,6 +164,11 @@ const columns = computed(() => [
|
||||||
name: 'intrastat',
|
name: 'intrastat',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
component: 'select',
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
|
url: 'Intrastats',
|
||||||
|
optionValue: 'description',
|
||||||
|
optionLabel: 'description',
|
||||||
|
},
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
name: 'intrastat',
|
name: 'intrastat',
|
||||||
attrs: {
|
attrs: {
|
||||||
|
@ -172,7 +180,6 @@ const columns = computed(() => [
|
||||||
columnField: {
|
columnField: {
|
||||||
component: null,
|
component: null,
|
||||||
},
|
},
|
||||||
create: true,
|
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -198,7 +205,6 @@ const columns = computed(() => [
|
||||||
columnField: {
|
columnField: {
|
||||||
component: null,
|
component: null,
|
||||||
},
|
},
|
||||||
create: true,
|
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -297,12 +303,21 @@ const columns = computed(() => [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
const { data } = await axios.get('ItemConfigs');
|
||||||
|
defaultTag.value = data[0].defaultTag;
|
||||||
|
defaultPriority.value = data[0].defaultPriority;
|
||||||
|
data.forEach((priority) => {
|
||||||
|
validPriorities.value = priority.validPriorities;
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
data-key="ItemList"
|
data-key="ItemList"
|
||||||
:label="t('item.searchbar.label')"
|
:label="t('item.searchbar.label')"
|
||||||
:info="t('You can search by id')"
|
:info="t('item.searchbar.info')"
|
||||||
/>
|
/>
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel>
|
<template #right-panel>
|
||||||
|
@ -310,15 +325,18 @@ const columns = computed(() => [
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
</RightMenu>
|
||||||
<VnTable
|
<VnTable
|
||||||
|
v-if="defaultTag"
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="ItemList"
|
data-key="ItemList"
|
||||||
url="Items/filter"
|
url="Items/filter"
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'Items',
|
urlCreate: 'Items/new',
|
||||||
title: t('Create Item'),
|
title: t('item.list.newItem'),
|
||||||
onDataSaved: () => tableRef.redirect(),
|
onDataSaved: ({ id }) => tableRef.redirect(`${id}/basic-data`),
|
||||||
formInitialData: {
|
formInitialData: {
|
||||||
editorFk: entityId,
|
editorFk: entityId,
|
||||||
|
tag: defaultTag,
|
||||||
|
priority: defaultPriority,
|
||||||
},
|
},
|
||||||
}"
|
}"
|
||||||
:order="['isActive DESC', 'name', 'id']"
|
:order="['isActive DESC', 'name', 'id']"
|
||||||
|
@ -364,6 +382,96 @@ const columns = computed(() => [
|
||||||
</div>
|
</div>
|
||||||
<FetchedTags :item="row" :columns="3" />
|
<FetchedTags :item="row" :columns="3" />
|
||||||
</template>
|
</template>
|
||||||
|
<template #more-create-dialog="{ data }">
|
||||||
|
<VnInput
|
||||||
|
v-model="data.provisionalName"
|
||||||
|
:label="t('globals.description')"
|
||||||
|
:is-required="true"
|
||||||
|
/>
|
||||||
|
<VnSelect
|
||||||
|
url="Tags"
|
||||||
|
v-model="data.tag"
|
||||||
|
:label="t('globals.tag')"
|
||||||
|
:fields="['id', 'name']"
|
||||||
|
option-label="name"
|
||||||
|
option-value="id"
|
||||||
|
:is-required="true"
|
||||||
|
:sort-by="['name ASC']"
|
||||||
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||||
|
<QItemLabel caption> #{{ scope.opt?.id }} </QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
|
<VnSelect
|
||||||
|
:options="validPriorities"
|
||||||
|
v-model="data.priority"
|
||||||
|
:label="t('item.create.priority')"
|
||||||
|
:is-required="true"
|
||||||
|
/>
|
||||||
|
<VnSelect
|
||||||
|
url="ItemTypes"
|
||||||
|
v-model="data.typeFk"
|
||||||
|
:label="t('item.list.typeName')"
|
||||||
|
:fields="['id', 'code', 'name']"
|
||||||
|
option-label="name"
|
||||||
|
option-value="id"
|
||||||
|
:is-required="true"
|
||||||
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||||
|
<QItemLabel caption>
|
||||||
|
{{ scope.opt?.code }} #{{ scope.opt?.id }}
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
|
<VnSelect
|
||||||
|
url="Intrastats"
|
||||||
|
v-model="data.intrastatFk"
|
||||||
|
:label="t('globals.intrastat')"
|
||||||
|
:fields="['id', 'description']"
|
||||||
|
option-label="description"
|
||||||
|
option-value="id"
|
||||||
|
:is-required="true"
|
||||||
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>{{ scope.opt?.description }}</QItemLabel>
|
||||||
|
<QItemLabel caption> #{{ scope.opt?.id }} </QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
|
<VnSelect
|
||||||
|
url="Origins"
|
||||||
|
v-model="data.originFk"
|
||||||
|
:label="t('globals.origin')"
|
||||||
|
:fields="['id', 'code', 'name']"
|
||||||
|
option-label="code"
|
||||||
|
option-value="id"
|
||||||
|
:is-required="true"
|
||||||
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||||
|
<QItemLabel caption>
|
||||||
|
{{ scope.opt?.code }} #{{ scope.opt?.id }}
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
</template>
|
</template>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -107,6 +107,7 @@ item:
|
||||||
scopeDays: Scope days
|
scopeDays: Scope days
|
||||||
searchbar:
|
searchbar:
|
||||||
label: Search item
|
label: Search item
|
||||||
|
info: You can search by id
|
||||||
descriptor:
|
descriptor:
|
||||||
item: Item
|
item: Item
|
||||||
buyer: Buyer
|
buyer: Buyer
|
||||||
|
@ -139,6 +140,7 @@ item:
|
||||||
stemMultiplier: Multiplier
|
stemMultiplier: Multiplier
|
||||||
producer: Producer
|
producer: Producer
|
||||||
landed: Landed
|
landed: Landed
|
||||||
|
newItem: New item
|
||||||
basicData:
|
basicData:
|
||||||
type: Type
|
type: Type
|
||||||
reference: Reference
|
reference: Reference
|
||||||
|
|
|
@ -109,6 +109,7 @@ item:
|
||||||
scopeDays: Días en adelante
|
scopeDays: Días en adelante
|
||||||
searchbar:
|
searchbar:
|
||||||
label: Buscar artículo
|
label: Buscar artículo
|
||||||
|
info: Puedes buscar por id
|
||||||
descriptor:
|
descriptor:
|
||||||
item: Artículo
|
item: Artículo
|
||||||
buyer: Comprador
|
buyer: Comprador
|
||||||
|
@ -141,6 +142,7 @@ item:
|
||||||
stemMultiplier: Multiplicador
|
stemMultiplier: Multiplicador
|
||||||
producer: Productor
|
producer: Productor
|
||||||
landed: F. entrega
|
landed: F. entrega
|
||||||
|
newItem: Nuevo artículo
|
||||||
basicData:
|
basicData:
|
||||||
type: Tipo
|
type: Tipo
|
||||||
reference: Referencia
|
reference: Referencia
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Item shelving', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit(`/#/item/list`);
|
||||||
|
cy.typeSearchbar('1{enter}');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should throw an error if the barcode exists', () => {
|
||||||
|
cy.get('[href="#/item/1/barcode"]').click();
|
||||||
|
cy.get('.q-card > .q-btn > .q-btn__content > .q-icon').click();
|
||||||
|
cy.dataCy('Code_input').eq(3).type('1111111111');
|
||||||
|
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||||
|
cy.checkNotification('Codes can not be repeated');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create a new barcode', () => {
|
||||||
|
cy.get('[href="#/item/1/barcode"]').click();
|
||||||
|
cy.get('.q-card > .q-btn > .q-btn__content > .q-icon').click();
|
||||||
|
cy.dataCy('Code_input').eq(3).type('1231231231');
|
||||||
|
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,31 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Item botanical', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit(`/#/item/1/botanical`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should modify the botanical', () => {
|
||||||
|
cy.dataCy('AddGenusSelectDialog').type('Abies');
|
||||||
|
cy.get('.q-menu .q-item').contains('Abies').click();
|
||||||
|
cy.dataCy('AddSpeciesSelectDialog').type('dealbata');
|
||||||
|
cy.get('.q-menu .q-item').contains('dealbata').click();
|
||||||
|
cy.get('.q-btn-group > .q-btn--standard').click();
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create a new Genus', () => {
|
||||||
|
cy.dataCy('Genus_icon').click();
|
||||||
|
cy.dataCy('Latin genus name_input').type('Test');
|
||||||
|
cy.dataCy('FormModelPopup_save').click();
|
||||||
|
cy.checkNotification('Data created');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create a new specie', () => {
|
||||||
|
cy.dataCy('Species_icon').click();
|
||||||
|
cy.dataCy('Latin species name_input').type('Test specie');
|
||||||
|
cy.dataCy('FormModelPopup_save').click();
|
||||||
|
cy.checkNotification('Data created');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,34 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
|
describe('Item list', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit(`/#/item/list`);
|
||||||
|
cy.typeSearchbar('{enter}');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should filter the items and redirect to the summary', () => {
|
||||||
|
cy.dataCy('Category_select').type('Plant');
|
||||||
|
cy.get('.q-menu .q-item').contains('Plant').click();
|
||||||
|
cy.dataCy('Type_select').type('Anthurium');
|
||||||
|
cy.get('.q-menu .q-item').contains('Anthurium').click();
|
||||||
|
cy.get('.q-virtual-scroll__content > :nth-child(4) > :nth-child(4)').click();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create an item', () => {
|
||||||
|
const data = {
|
||||||
|
Description: { val: `Test item` },
|
||||||
|
Type: { val: `Crisantemo`, type: 'select' },
|
||||||
|
Intrastat: { val: `Coral y materiales similares`, type: 'select' },
|
||||||
|
Origin: { val: `SPA`, type: 'select' },
|
||||||
|
};
|
||||||
|
cy.dataCy('vnTableCreateBtn').click();
|
||||||
|
cy.fillInForm(data);
|
||||||
|
cy.dataCy('FormModelPopup_save').click();
|
||||||
|
cy.checkNotification('Data created');
|
||||||
|
cy.get(
|
||||||
|
':nth-child(2) > .q-drawer > .q-drawer__content > .q-scrollarea > .q-scrollarea__container > .q-scrollarea__content'
|
||||||
|
).should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,24 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Item summary', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit(`/#/item/1/summary`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should clone the item', () => {
|
||||||
|
cy.dataCy('descriptor-more-opts').click();
|
||||||
|
cy.get('.q-menu > .q-list > :nth-child(2) > .q-item__section').click();
|
||||||
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
|
cy.waitForElement('[data-cy="itemTags"]');
|
||||||
|
cy.dataCy('itemTags').should('be.visible');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should regularize stock', () => {
|
||||||
|
cy.dataCy('descriptor-more-opts').click();
|
||||||
|
cy.get('.q-menu > .q-list > :nth-child(1) > .q-item__section').click();
|
||||||
|
cy.dataCy('regularizeStockInput').type('10');
|
||||||
|
cy.dataCy('Warehouse_select').type('Warehouse One{enter}');
|
||||||
|
cy.checkNotification('Data created');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,39 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Item tag', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit(`/#/item/1/tags`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should throw an error adding an existent tag', () => {
|
||||||
|
cy.get('.q-page').should('be.visible');
|
||||||
|
cy.get('.q-page-sticky > div').click();
|
||||||
|
cy.get('.q-page-sticky > div').click();
|
||||||
|
cy.dataCy('Tag_select').eq(7).type('Tallos');
|
||||||
|
cy.get('.q-menu .q-item').contains('Tallos').click();
|
||||||
|
cy.get(
|
||||||
|
':nth-child(8) > [label="Value"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Value_input"]'
|
||||||
|
).type('1');
|
||||||
|
+cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||||
|
cy.checkNotification("The tag or priority can't be repeated for an item");
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add a new tag', () => {
|
||||||
|
cy.get('.q-page').should('be.visible');
|
||||||
|
cy.get('.q-page-sticky > div').click();
|
||||||
|
cy.get('.q-page-sticky > div').click();
|
||||||
|
cy.dataCy('Tag_select').eq(7).click();
|
||||||
|
cy.get('.q-menu .q-item').contains('Ancho de la base').click();
|
||||||
|
cy.get(
|
||||||
|
':nth-child(8) > [label="Value"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Value_input"]'
|
||||||
|
).type('50');
|
||||||
|
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
cy.get(
|
||||||
|
'[data-cy="itemTags"] > :nth-child(7) > .justify-center > .q-icon'
|
||||||
|
).click();
|
||||||
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,14 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Item tax', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit(`/#/item/1/tax`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should modify the tax for Spain', () => {
|
||||||
|
cy.dataCy('Class_select').eq(1).type('General VAT{enter}');
|
||||||
|
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,40 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Item type', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit(`/#/item/item-type`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should throw an error if the code already exists', () => {
|
||||||
|
cy.dataCy('vnTableCreateBtn').click();
|
||||||
|
cy.get(
|
||||||
|
'div.fit > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Code_input"]'
|
||||||
|
).type('ALS');
|
||||||
|
cy.get(
|
||||||
|
'div.fit > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Name_input"]'
|
||||||
|
).type('Alstroemeria');
|
||||||
|
cy.dataCy('Worker_select').type('employeeNick');
|
||||||
|
cy.get('.q-menu .q-item').contains('employeeNick').click();
|
||||||
|
cy.dataCy('ItemCategory_select').type('Artificial');
|
||||||
|
cy.get('.q-menu .q-item').contains('Artificial').click();
|
||||||
|
cy.dataCy('FormModelPopup_save').click();
|
||||||
|
cy.checkNotification('An item type with the same code already exists');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create a new type', () => {
|
||||||
|
cy.dataCy('vnTableCreateBtn').click();
|
||||||
|
cy.get(
|
||||||
|
'div.fit > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Code_input"]'
|
||||||
|
).type('LIL');
|
||||||
|
cy.get(
|
||||||
|
'div.fit > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Name_input"]'
|
||||||
|
).type('Lilium');
|
||||||
|
cy.dataCy('Worker_select').type('buyerNick');
|
||||||
|
cy.get('.q-menu .q-item').contains('buyerNick').click();
|
||||||
|
cy.dataCy('ItemCategory_select').type('Flower');
|
||||||
|
cy.get('.q-menu .q-item').contains('Flower').click();
|
||||||
|
cy.dataCy('FormModelPopup_save').click();
|
||||||
|
cy.checkNotification('Data created');
|
||||||
|
});
|
||||||
|
});
|
|
@ -16,17 +16,17 @@ describe('VnSearchBar', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should stay on the list page if there are several results or none', () => {
|
it('should stay on the list page if there are several results or none', () => {
|
||||||
cy.writeSearchbar('salesA{enter}');
|
cy.typeSearchbar('salesA{enter}');
|
||||||
checkTableLength(2);
|
checkTableLength(2);
|
||||||
|
|
||||||
cy.clearSearchbar();
|
cy.clearSearchbar();
|
||||||
cy.writeSearchbar('0{enter}');
|
cy.typeSearchbar('0{enter}');
|
||||||
checkTableLength(0);
|
checkTableLength(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
const searchAndCheck = (searchTerm, expectedText) => {
|
const searchAndCheck = (searchTerm, expectedText) => {
|
||||||
cy.clearSearchbar();
|
cy.clearSearchbar();
|
||||||
cy.writeSearchbar(`${searchTerm}{enter}`);
|
cy.typeSearchbar(`${searchTerm}{enter}`);
|
||||||
cy.get(idGap).should('have.text', expectedText);
|
cy.get(idGap).should('have.text', expectedText);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -279,7 +279,7 @@ Cypress.Commands.add('clearSearchbar', (element) => {
|
||||||
).clear();
|
).clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('writeSearchbar', (value) => {
|
Cypress.Commands.add('typeSearchbar', (value) => {
|
||||||
cy.get('#searchbar > form > div:nth-child(1) > label > div:nth-child(1) input').type(
|
cy.get('#searchbar > form > div:nth-child(1) > label > div:nth-child(1) input').type(
|
||||||
value
|
value
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue