diff --git a/src/pages/Entry/EntryStockBought.vue b/src/pages/Entry/EntryStockBought.vue index a85522b5f..da8557828 100644 --- a/src/pages/Entry/EntryStockBought.vue +++ b/src/pages/Entry/EntryStockBought.vue @@ -184,7 +184,7 @@ function round(value) { @click="openDialog()" :title="t('entryStockBought.editTravel')" color="primary" - data-cy="editTravelBtn" + data-cy="edit-travel" /> diff --git a/test/cypress/integration/entry/stockBought.spec.js b/test/cypress/integration/entry/stockBought.spec.js index d87b6bdf7..b282a19a5 100644 --- a/test/cypress/integration/entry/stockBought.spec.js +++ b/test/cypress/integration/entry/stockBought.spec.js @@ -15,10 +15,26 @@ describe('EntryStockBought', () => { cy.addBtnClick(); 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-2001'); - cy.selectOption('input[aria-label="Buyer"]', 'buyerboss'); - cy.get('#formModel button[title="Save"]').click(); - cy.checkNotification('Data created'); + cy.get('input[aria-label="Date"]').eq(1).type('01-01'); + cy.get('input[aria-label="Buyer"]').type('buyerBossNick'); + cy.get('div[role="listbox"] > div > div[role="option"]') + .eq(0) + .should('be.visible') + .click(); + + cy.get('[data-cy="FormModelPopup_save"]').click(); + cy.get('.q-notification__message').should('have.text', 'Data created'); + + cy.get('[data-col-field="reserve"][data-row-index="1"]').click().clear(); + cy.get('[data-cy="searchBtn"]').eq(1).click(); + cy.get('.q-table__bottom.row.items-center.q-table__bottom--nodata') + .should('have.text', 'warningNo data available') + .type('{esc}'); + cy.get('[data-col-field="reserve"][data-row-index="1"]') + .click() + .type('{backspace}{enter}'); + cy.get('[data-cy="crudModelDefaultSaveBtn"]').should('be.enabled').click(); + cy.get('.q-notification__message').eq(1).should('have.text', 'Data saved'); }); it('Should check detail for the buyer', () => { cy.get('[data-cy="searchBtn"]').eq(0).click(); @@ -26,11 +42,9 @@ describe('EntryStockBought', () => { }); it('Should edit travel m3 and refresh', () => { - cy.waitForElement('[data-cy="editTravelBtn"]'); - cy.get('[data-cy="editTravelBtn"]').click(); - cy.get('input[aria-label="m3"]').clear(); - cy.get('input[aria-label="m3"]').type('60'); - cy.get('.q-mt-lg > .q-btn--standard > .q-btn__content > .block').click(); + cy.get('[data-cy="edit-travel"]').should('be.visible').click(); + cy.get('input[aria-label="m3"]').clear().type('60'); + cy.get('[data-cy="FormModelPopup_save"]').click(); cy.get('.vn-row > div > :nth-child(2)').should('have.text', '60'); }); });