diff --git a/src/pages/Item/ItemFixedPrice.vue b/src/pages/Item/ItemFixedPrice.vue index ad998f35f..5b75f7924 100644 --- a/src/pages/Item/ItemFixedPrice.vue +++ b/src/pages/Item/ItemFixedPrice.vue @@ -23,7 +23,6 @@ import { isLower, isBigger } from 'src/filters/date.js'; import RightMenu from 'src/components/common/RightMenu.vue'; import VnTable from 'src/components/VnTable/VnTable.vue'; import { QCheckbox } from 'quasar'; -import { debounce } from 'lodash'; const quasar = useQuasar(); const stateStore = useStateStore(); @@ -39,9 +38,6 @@ const warehousesOptions = ref([]); const hasSelectedRows = computed(() => rowsSelected.value.length > 0); const rowsSelected = ref([]); const itemFixedPriceFilterRef = ref(); -const reloadTable = debounce(() => { - tableRef.value.reload(); -}, 500); onMounted(async () => { stateStore.rightDrawer = true; @@ -238,7 +234,7 @@ const validations = ({ row }) => { 'warehouseFk', ]; const isValid = requiredFields.every( - (field) => row[field] !== null && row[field] !== undefined, + (field) => row[field] !== null && row[field] !== undefined ); return isValid; }; @@ -313,7 +309,7 @@ const openEditTableCellDialog = () => { const onEditCellDataSaved = async () => { rowsSelected.value = []; - reloadTable(); + tableRef.value.reload(); }; const removeFuturePrice = async () => { @@ -560,7 +556,7 @@ function handleOnDataSave({ CrudModelRef }) { openConfirmationModal( t('globals.rowWillBeRemoved'), t('Do you want to clone this item?'), - () => removePrice(row.id, rowIndex), + () => removePrice(row.id, rowIndex) ) " > diff --git a/test/cypress/integration/item/ItemFixedPrice.spec.js b/test/cypress/integration/item/ItemFixedPrice.spec.js index 364c7fe28..92cb90287 100644 --- a/test/cypress/integration/item/ItemFixedPrice.spec.js +++ b/test/cypress/integration/item/ItemFixedPrice.spec.js @@ -1,13 +1,14 @@ /// -function goTo(n = 1) { - return `.q-virtual-scroll__content > :nth-child(${n})`; -} -const firstRow = goTo(); -const secondRow = goTo(2); -`.q-virtual-scroll__content > :nth-child(1)`; describe('Handle Items FixedPrice', () => { - beforeEach(() => { + beforeEach(() => { + Cypress.on('uncaught:exception', (err, runnable) => { + if (err.message.includes('canceled')) { + return false; + } + return true; + }); + cy.viewport(1280, 720); cy.login('developer'); cy.visit('/#/item/fixed-price', { timeout: 5000 }); @@ -20,17 +21,15 @@ describe('Handle Items FixedPrice', () => { cy.get('.category-filter > :nth-child(2) > .q-btn__content > .q-icon').click(); cy.selectOption('.list > :nth-child(2)', 'Crisantemo'); cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click(); - /* ==== End Cypress Studio ==== */ }); it('Create and delete ', function () { cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content').click(); cy.dataCy('vnTableCreateBtn').click(); - cy.get(`${secondRow} > :nth-child(5) > .q-td`).type("2{enter}"); - cy.get(`${secondRow} > :nth-child(2)`).type('11'); - cy.get('.q-menu .q-item').contains('#11').click(); - cy.get(`${secondRow} > :nth-child(4) > .q-td`).type("1{enter}"); - cy.get(`${secondRow} > :nth-child(9)`).type('Warehouse One'); + cy.get(':nth-child(2) > [data-col-field="rate2"] > .no-padding > .q-td').type("1{enter}"); + cy.get('.highlight > [data-col-field="rate3"] > .no-padding > .q-td').type("2{enter}"); + cy.selectOption('.highlight > [data-col-field="itemFk"]', '#11'); + cy.get('.highlight > [data-col-field="warehouseFk"]').type('Warehouse One'); cy.get('.q-menu .q-item').contains('Warehouse One').click(); cy.get('.q-notification__message').should('have.text', 'Data saved'); cy.get(':nth-child(3) > .text-right > .q-btn').click(); @@ -44,7 +43,7 @@ describe('Handle Items FixedPrice', () => { cy.dataCy('value-to-edit').find('input').type('1'); cy.get('.countLines').invoke('text').then(parseFloat).should('be.gte', 1); cy.get('.q-mt-lg > .q-btn--standard').click(); - cy.get('.q-notification__message').should('have.text', 'Data saved'); + cy.checkNotification('Data saved'); }); it('Massive remove', function () { cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click(); @@ -52,6 +51,6 @@ describe('Handle Items FixedPrice', () => { cy.get( '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block' ).click(); - cy.get('.q-notification__message').should('have.text', 'Data saved'); + cy.checkNotification('Data saved'); }); });