diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue index 8c4f70f3b..92244886c 100644 --- a/src/components/CrudModel.vue +++ b/src/components/CrudModel.vue @@ -333,6 +333,7 @@ watch(formUrl, async () => { :disable="!selected?.length" :title="t('globals.remove')" v-if="$props.defaultRemove" + data-cy="crudModelDefaultRemoveBtn" /> { hide-selected option-label="label" v-model="selectedField" - data-cy="field-to-edit" + data-cy="EditFixedPriceSelectOption" /> diff --git a/src/pages/Item/ItemFixedPrice.vue b/src/pages/Item/ItemFixedPrice.vue index fdfa1d3d1..8e647a228 100644 --- a/src/pages/Item/ItemFixedPrice.vue +++ b/src/pages/Item/ItemFixedPrice.vue @@ -1,150 +1,171 @@ - (warehousesOptions = data)" - auto-load - url="Warehouses" - :filter="{ fields: ['id', 'name'], order: 'name ASC' }" - /> - + - - + + + {{ t('Edit fixed price(s)') }} @@ -387,74 +355,50 @@ function handleOnDataSave({ CrudModelRef }) { confirmRemove(row, true)" - :title="t('globals.remove')" - /> - - + :label="t('globals.clone')" + data-cy="FixedPriceToolbarCloneBtn" + > + + {{ t('Clone fixed price(s)') }} + + + + - - + + + + - - {{ scope }} - - - - - - - - - #{{ scope.opt?.id }} - {{ scope.opt?.name }} - - - - + + @@ -462,111 +406,78 @@ function handleOnDataSave({ CrudModelRef }) { {{ row.subName }} - + - - - - € - - + + + + {{ toDate(row?.started) }} + + - - - - € - - + + + + {{ toDate(row?.ended) }} + + - - - - - - € - - - - - - - - - - - - - - - - - removePrice(row.id, rowIndex) - ) - " + + - - {{ t('globals.delete') }} - - + + + + + {{ scope.opt.name }} + + #{{ scope.opt.id }} + + + + + + + + + + + + {{ scope.opt.name }} + + #{{ scope.opt.id }} + + + + diff --git a/src/pages/Item/ItemFixedPriceFilter.vue b/src/pages/Item/ItemFixedPriceFilter.vue index 8d92e245d..7e1adb8bb 100644 --- a/src/pages/Item/ItemFixedPriceFilter.vue +++ b/src/pages/Item/ItemFixedPriceFilter.vue @@ -13,11 +13,14 @@ const props = defineProps({ required: true, }, }); - - + @@ -53,23 +56,19 @@ const props = defineProps({ /> - + - - diff --git a/test/cypress/integration/item/ItemFixedPrice.spec.js b/test/cypress/integration/item/ItemFixedPrice.spec.js index 2cf9c2caf..2fad87eac 100644 --- a/test/cypress/integration/item/ItemFixedPrice.spec.js +++ b/test/cypress/integration/item/ItemFixedPrice.spec.js @@ -1,10 +1,14 @@ /// -function goTo(n = 1) { - return `.q-virtual-scroll__content > :nth-child(${n})`; -} -const firstRow = goTo(); -`.q-virtual-scroll__content > :nth-child(2)`; describe('Handle Items FixedPrice', () => { + const grouping = 'Grouping price'; + const saveEditBtn = '.q-mt-lg > .q-btn--standard'; + const createForm = { + 'Grouping price': { val: '5' }, + 'Packing price': { val: '5' }, + Started: { val: '01-01-2001', type: 'date' }, + Ended: { val: '15-01-2001', type: 'date' }, + }; + beforeEach(() => { cy.viewport(1280, 720); cy.login('developer'); @@ -14,50 +18,55 @@ describe('Handle Items FixedPrice', () => { '.q-header > .q-toolbar > :nth-child(1) > .q-btn__content > .q-icon', ).click(); }); - it.skip('filter', function () { + + it('filter by category', () => { cy.get('.category-filter > :nth-child(1) > .q-btn__content > .q-icon').click(); - cy.selectOption('.list > :nth-child(2)', 'Alstroemeria'); - cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click(); - - cy.addBtnClick(); - cy.selectOption(`${firstRow} > :nth-child(2)`, '#13'); - cy.get(`${firstRow} > :nth-child(4)`).find('input').type(1); - cy.get(`${firstRow} > :nth-child(5)`).find('input').type('2'); - cy.selectOption(`${firstRow} > :nth-child(9)`, 'Warehouse One'); - cy.get('.q-notification__message').should('have.text', 'Data saved'); - /* ==== End Cypress Studio ==== */ - }); - it.skip('Create and delete ', function () { - cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click(); - cy.addBtnClick(); - cy.selectOption(`${firstRow} > :nth-child(2)`, '#11'); - cy.get(`${firstRow} > :nth-child(4)`).type('1'); - cy.get(`${firstRow} > :nth-child(5)`).type('2'); - cy.selectOption(`${firstRow} > :nth-child(9)`, 'Warehouse One'); - cy.get('.q-notification__message').should('have.text', 'Data saved'); - cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click(); - cy.get(`${firstRow} > .text-right > .q-btn > .q-btn__content > .q-icon`).click(); - cy.get( - '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block', - ).click(); - cy.get('.q-notification__message').should('have.text', 'Data saved'); + cy.get('.q-table__middle').should('be.visible').should('have.length', 1); }); - it.skip('Massive edit', function () { - cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click(); - cy.get('#subToolbar > .q-btn--standard').click(); - cy.selectOption("[data-cy='field-to-edit']", 'Min price'); - cy.dataCy('value-to-edit').find('input').type('1'); - cy.get('.countLines').should('have.text', ' 1 '); - cy.get('.q-mt-lg > .q-btn--standard').click(); - cy.get('.q-notification__message').should('have.text', 'Data saved'); + it('should create a new fixed price, then delete it', () => { + cy.dataCy('vnTableCreateBtn').click(); + cy.dataCy('FixedPriceCreateNameSelect').type('Melee weapon combat fist 15cm'); + cy.get('.q-menu .q-item').contains('Melee weapon combat fist 15cm').click(); + cy.dataCy('FixedPriceCreateWarehouseSelect').type('Warehouse One'); + cy.get('.q-menu .q-item').contains('Warehouse One').click(); + cy.get('.q-menu').then(($menu) => { + if ($menu.is(':visible')) { + cy.dataCy('FixedPriceCreateWarehouseSelect').as('focusedElement').focus(); + cy.dataCy('FixedPriceCreateWarehouseSelect').blur(); + } + }); + cy.fillInForm(createForm); + cy.dataCy('FormModelPopup_save').click(); + cy.checkNotification('Data created'); + cy.get('[data-col-field="name"]').each(($el) => { + cy.wrap($el) + .invoke('text') + .then((text) => { + if (text.includes('Melee weapon combat fist 15cm')) { + cy.wrap($el).parent().find('.sticky').click(); + + cy.dataCy('VnConfirm_confirm').click(); + cy.checkNotification('Data saved'); + } + }); + }); }); - it.skip('Massive remove', function () { - cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click(); - cy.get('#subToolbar > .q-btn--flat').click(); - cy.get( - '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block', - ).click(); - cy.get('.q-notification__message').should('have.text', 'Data saved'); + + it('should edit all items', () => { + cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click(); + cy.dataCy('FixedPriceToolbarEditBtn').click(); + cy.dataCy('EditFixedPriceSelectOption').type(grouping); + cy.get('.q-menu .q-item').contains(grouping).click(); + cy.dataCy('EditFixedPriceValueOption').type('5'); + cy.get(saveEditBtn).click(); + cy.checkNotification('Data saved'); + }); + + it('should remove all items', () => { + cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click(); + cy.dataCy('crudModelDefaultRemoveBtn').click(); + cy.dataCy('VnConfirm_confirm').click(); + cy.checkNotification('Data saved'); }); });