salix-front/test/cypress/integration/item/itemRequest.spec.js

29 lines
1.2 KiB
JavaScript

describe('Item Request', () => {
const rowIndex = 0;
const itemFkField = `td[data-row-index="${rowIndex}"][data-col-field="itemFk"]`;
const saleQuantityField = `td[data-row-index="${rowIndex}"][data-col-field="saleQuantity"]`;
const ticketInputFilter = '[data-cy="Ticket id_input"]';
before(() => {
cy.login('buyer');
cy.visit(`/#/item/request`);
});
it('should fill the id and quantity then check the concept was updated', () => {
cy.waitForElement('tbody');
cy.get(ticketInputFilter).should('exist').type('38{enter}');
cy.get(itemFkField).should('exist').click();
cy.get(`${itemFkField} input`).should('exist').type('4');
cy.get(saleQuantityField).should('exist').click();
cy.get(`${saleQuantityField} input`).should('exist').type('10{esc}');
cy.checkNotification('Data saved');
});
it('should now click on the second deny request icon then type the reason', () => {
cy.selectOption('[data-cy="State_select"]', 'Pending');
cy.get('button[title="Discard"]').eq(0).click();
cy.dataCy('discardTextArea').should('exist').type('test{enter}');
cy.checkNotification('Data saved');
});
});