test: refs #8684 enable test isolation for item type tests and improve element selection
gitea/salix-front/pipeline/pr-dev Build queued... Details

This commit is contained in:
Pablo Natek 2025-05-12 08:38:50 +02:00
parent 8e02826b76
commit 8b04dbc7ec
1 changed files with 7 additions and 11 deletions

View File

@ -1,23 +1,21 @@
/// <reference types="cypress" />
describe('Item type', () => {
describe('Item type', { testIsolation: true }, () => {
const workerError = 'employeeNick';
const worker = 'buyerNick';
const category = 'Artificial';
const type = 'Flower';
beforeEach(() => {
cy.login('developer');
cy.login('buyer');
cy.visit(`/#/item/item-type`);
});
it('should throw an error if the code already exists', () => {
cy.dataCy('vnTableCreateBtn').click();
cy.dataCy('vnTableCreateBtn').should('exist').click();
cy.dataCy('codeInput').type('ALS');
cy.dataCy('nameInput').type('Alstroemeria');
cy.dataCy('vnWorkerSelect').type(workerError);
cy.get('.q-menu .q-item').contains(workerError).click();
cy.dataCy('itemCategorySelect').type(category);
cy.get('.q-menu .q-item').contains(category).click();
cy.selectOption('[data-cy="vnWorkerSelect"]', workerError);
cy.selectOption('[data-cy="itemCategorySelect"]', category);
cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('An item type with the same code already exists');
});
@ -26,10 +24,8 @@ describe('Item type', () => {
cy.dataCy('vnTableCreateBtn').click();
cy.dataCy('codeInput').type('LIL');
cy.dataCy('nameInput').type('Lilium');
cy.dataCy('vnWorkerSelect').type(worker);
cy.get('.q-menu .q-item').contains(worker).click();
cy.dataCy('itemCategorySelect').type(type);
cy.get('.q-menu .q-item').contains(type).click();
cy.selectOption('[data-cy="vnWorkerSelect"]', worker);
cy.selectOption('[data-cy="itemCategorySelect"]', type);
cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('Data created');
});