salix-front/test/cypress/integration/entry/stockBought.spec.js

37 lines
1.7 KiB
JavaScript
Raw Normal View History

describe('EntryStockBought', () => {
const reserveField = 'input[name="reserve"]';
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('buyer');
cy.visit(
`/#/entry/stock-Bought?table={"filter":"{}","dated":"2000-12-31T23:00:00.000Z"}`
);
});
it('Should edit the reserved space', () => {
2024-09-04 12:40:36 +00:00
cy.get('tBody > tr').its('length').should('eq', 2);
cy.get(reserveField).type('10{enter}');
cy.get('button[title="Save"]').click();
cy.get('.q-notification__message').should('have.text', 'Data saved');
});
it('Should add a new reserved space for buyerBoss', () => {
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
cy.get('input[aria-label="Reserve"]').type('1');
cy.get('input[aria-label="Date"]').eq(1).clear();
cy.get('input[aria-label="Date"]').eq(1).type('01-01');
cy.get('input[aria-label="Buyer"]').type('buyerboss{downarrow}{enter}');
cy.get('.q-notification__message').should('have.text', 'Data created');
cy.get('tBody > tr').its('length').should('eq', 3);
});
it('Should check detail for the buyer', () => {
cy.get(':nth-child(1) > .sticky > .q-btn > .q-btn__content > .q-icon').click();
cy.get('tBody > tr').eq(1).its('length').should('eq', 1);
});
it('Should check detail for the buyerBoss and had no content', () => {
cy.get(':nth-child(2) > .sticky > .q-btn > .q-btn__content > .q-icon').click();
cy.get('.q-table__bottom.row.items-center.q-table__bottom--nodata').should(
'have.text',
'warningNo data available'
);
});
});