feat: refs #8220 created items e2e
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jon Elias 2024-12-03 13:00:16 +01:00
parent 4480b58551
commit 8b3a9db781
11 changed files with 162 additions and 5 deletions

View File

@ -55,6 +55,7 @@ const onDataSaved = (data) => {
v-model.number="data.quantity"
type="number"
autofocus
data-cy="regularizeStockInput"
/>
</VnRow>
<VnRow>

View File

@ -50,6 +50,7 @@ const isAllowedToCreate = computed(() => {
:style="{
'font-variation-settings': `'FILL' ${1}`,
}"
:data-cy="`SelectDialogAddIcon-${$attrs.label || 'default'}`"
>
<QTooltip v-if="tooltip">{{ tooltip }}</QTooltip>
</QIcon>

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, reactive, computed } from 'vue';
import { ref, reactive, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';

View File

@ -105,7 +105,7 @@ const insertTag = (rows) => {
@on-fetch="onItemTagsFetched"
>
<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
v-for="(row, index) in rows"
:key="index"

View File

@ -199,6 +199,7 @@ onMounted(async () => {
dense
outlined
rounded
data-cy="ItemFilterCategorySelect"
/>
</QItemSection>
</QItem>
@ -215,6 +216,7 @@ onMounted(async () => {
dense
outlined
rounded
data-cy="ItemFilterTypeSelect"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">

View File

@ -38,6 +38,7 @@ const columns = computed(() => [
{
align: 'left',
label: t('worker'),
name: 'workerFk',
create: true,
component: 'select',
attrs: {
@ -57,9 +58,6 @@ const columns = computed(() => [
};
},
},
columnFilter: {
name: 'workerFk',
},
},
{
align: 'left',

View File

@ -0,0 +1,35 @@
/// <reference types="cypress" />
describe('Item botanical', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/list`);
cy.get('#searchbar input').type('1{enter}');
});
it('should modify the botanical', () => {
cy.get('[href="#/item/1/botanical"]').click();
cy.get('[data-cy="Genus_select"]').type('Abies');
cy.get('.q-menu .q-item').contains('Abies').click();
cy.get('[data-cy="Species_select"]').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.get('[href="#/item/1/botanical"]').click();
cy.get('[data-cy="SelectDialogAddIcon-Genus"]').click();
cy.get('[data-cy="Latin genus name_input"]').type('Test');
cy.get('[data-cy="FormModelPopup_save"]').click();
cy.checkNotification('Data created');
});
it('should create a new specie', () => {
cy.get('[href="#/item/1/botanical"]').click();
cy.get('[data-cy="SelectDialogAddIcon-Species"]').click();
cy.get('[data-cy="Latin species name_input"]').type('Test specie');
cy.get('[data-cy="FormModelPopup_save"]').click();
cy.checkNotification('Data created');
});
});

View File

@ -0,0 +1,25 @@
/// <reference types="cypress" />
describe('Item summary', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/list`);
cy.get('#searchbar input').type('1{enter}');
});
it('should clone the item', () => {
cy.get('[data-cy="descriptor-more-opts"] > .q-btn__content').click();
cy.get('.q-menu > .q-list > :nth-child(2) > .q-item__section').click();
cy.get('[data-cy="VnConfirm_confirm"]').click();
cy.waitForElement('[data-cy="itemTags"]');
cy.get('[data-cy="itemTags"]').should('be.visible');
});
it('should regularize stock', () => {
cy.get('[data-cy="descriptor-more-opts"] > .q-btn__content').click();
cy.get('.q-menu > .q-list > :nth-child(1) > .q-item__section').click();
cy.get('[data-cy="regularizeStockInput"]').type('10');
cy.get('[data-cy="Warehouse_select"]').type('Warehouse One{enter}');
cy.checkNotification('Data created');
});
});

View File

@ -0,0 +1,37 @@
/// <reference types="cypress" />
describe('Item tag', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/list`);
cy.get('#searchbar input').type('1{enter}');
});
it('should throw an error adding an existent tag', () => {
cy.get('[href="#/item/1/tags"]').click();
cy.get('.q-page-sticky > div').click();
cy.get(
':nth-child(8) > .q-select > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native'
).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.get('[data-cy="crudModelDefaultSaveBtn"]').click();
cy.checkNotification("The tag or priority can't be repeated for an item");
});
it('should add a new tag', () => {
cy.get('[href="#/item/1/tags"]').click();
cy.get('.q-page-sticky > div').click();
cy.get(
':nth-child(8) > .q-select > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native'
).type('Ancho de la base');
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.get('[data-cy="crudModelDefaultSaveBtn"]').click();
cy.checkNotification('Data saved');
});
});

View File

@ -0,0 +1,18 @@
/// <reference types="cypress" />
describe('Item tax', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/list`);
cy.get('#searchbar input').type('1{enter}');
});
it('should modify the tax for Spain', () => {
cy.get('[href="#/item/1/tax"]').click();
cy.get(
':nth-child(1) > .q-select > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > [data-cy="Class_select"]'
).type('General VAT{enter}');
cy.get('[data-cy="crudModelDefaultSaveBtn"]').click();
cy.checkNotification('Data saved');
});
});

View File

@ -0,0 +1,40 @@
/// <reference types="cypress" />
describe('Item shelving', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/item-type`);
});
it('should throw an error if the code already exists', () => {
cy.get('[data-cy="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.get('[data-cy="Worker_select"]').type('employeeNick');
cy.get('.q-menu .q-item').contains('employeeNick').click();
cy.get('[data-cy="ItemCategory_select"]').type('Artificial');
cy.get('.q-menu .q-item').contains('Artificial').click();
cy.get('[data-cy="FormModelPopup_save"]').click();
cy.checkNotification('An item type with the same code already exists');
});
it('should create a new type', () => {
cy.get('[data-cy="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.get('[data-cy="Worker_select"]').type('buyerNick');
cy.get('.q-menu .q-item').contains('buyerNick').click();
cy.get('[data-cy="ItemCategory_select"]').type('Flower');
cy.get('.q-menu .q-item').contains('Flower').click();
cy.get('[data-cy="FormModelPopup_save"]').click();
cy.checkNotification('Data created');
});
});