refactor: refs #8220 added data-cy for e2e tests
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2024-12-10 07:03:13 +01:00
parent 859957cadc
commit 100ef4b7b9
10 changed files with 31 additions and 28 deletions

View File

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

View File

@ -37,6 +37,7 @@ onMounted(async () => {
:label="t('Latin genus name')"
v-model="data.name"
:required="true"
data-cy="AddGenusInput"
/>
</VnRow>
</template>

View File

@ -37,6 +37,7 @@ onMounted(async () => {
:label="t('Latin species name')"
v-model="data.name"
:required="true"
data-cy="AddSpeciesInput"
/>
</VnRow>
</template>

View File

@ -52,6 +52,7 @@ const entityId = computed(() => {
:fields="['id', 'name']"
sort-by="name ASC"
hide-selected
data-cy="AddGenusSelectDialog"
>
<template #form>
<CreateGenusForm
@ -68,6 +69,7 @@ const entityId = computed(() => {
:fields="['id', 'name']"
sort-by="name ASC"
hide-selected
data-cy="AddSpeciesSelectDialog"
>
<template #form>
<CreateSpecieForm

View File

@ -40,7 +40,6 @@ const columns = computed(() => [
align: 'left',
label: t('worker'),
name: 'workerFk',
name: 'workerFk',
create: true,
component: 'select',
attrs: {

View File

@ -9,9 +9,9 @@ describe('Item botanical', () => {
it('should modify the botanical', () => {
cy.get('[href="#/item/1/botanical"]').click();
cy.get('[data-cy="Genus_select"]').type('Abies');
cy.dataCy('AddGenusSelectDialog').type('Abies');
cy.get('.q-menu .q-item').contains('Abies').click();
cy.get('[data-cy="Species_select"]').type('dealbata');
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');
@ -19,17 +19,17 @@ describe('Item botanical', () => {
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.dataCy('Genus_icon').click();
cy.dataCy('AddGenusInput').type('Test');
cy.dataCy('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.dataCy('Species_icon').click();
cy.dataCy('AddSpeciesInput').type('Test specie');
cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('Data created');
});
});

View File

@ -8,18 +8,18 @@ describe('Item summary', () => {
});
it('should clone the item', () => {
cy.get('[data-cy="descriptor-more-opts"] > .q-btn__content').click();
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(2) > .q-item__section').click();
cy.get('[data-cy="VnConfirm_confirm"]').click();
cy.dataCy('VnConfirm_confirm').click();
cy.waitForElement('[data-cy="itemTags"]');
cy.get('[data-cy="itemTags"]').should('be.visible');
cy.dataCy('itemTags').should('be.visible');
});
it('should regularize stock', () => {
cy.get('[data-cy="descriptor-more-opts"] > .q-btn__content').click();
cy.dataCy('descriptor-more-opts').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.dataCy('regularizeStockInput').type('10');
cy.dataCy('Warehouse_select').type('Warehouse One{enter}');
cy.checkNotification('Data created');
});
});

View File

@ -7,6 +7,7 @@ describe('Item tag', () => {
cy.get('#searchbar input').type('1{enter}');
});
// falla la notificacion
it('should throw an error adding an existent tag', () => {
cy.get('[href="#/item/1/tags"]').click();
cy.get('.q-page-sticky > div').click();
@ -17,7 +18,7 @@ describe('Item tag', () => {
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.dataCy('crudModelDefaultSaveBtn').click();
cy.checkNotification("The tag or priority can't be repeated for an item");
});
@ -31,7 +32,7 @@ describe('Item tag', () => {
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.dataCy('crudModelDefaultSaveBtn').click();
cy.checkNotification('Data saved');
});
});

View File

@ -12,7 +12,7 @@ describe('Item tax', () => {
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.dataCy('crudModelDefaultSaveBtn').click();
cy.checkNotification('Data saved');
});
});

View File

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