fix: #8349 fixed ItemFixedPrice crashing and it's e2e test not working #1289

Open
provira wants to merge 15 commits from 8349-e2eItemFixedPrice into dev
2 changed files with 31 additions and 30 deletions

View File

@ -23,6 +23,7 @@ import { isLower, isBigger } from 'src/filters/date.js';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import VnTable from 'src/components/VnTable/VnTable.vue'; import VnTable from 'src/components/VnTable/VnTable.vue';
import { QCheckbox } from 'quasar'; import { QCheckbox } from 'quasar';
import { debounce } from 'lodash';
const quasar = useQuasar(); const quasar = useQuasar();
const stateStore = useStateStore(); const stateStore = useStateStore();
@ -38,6 +39,9 @@ const warehousesOptions = ref([]);
const hasSelectedRows = computed(() => rowsSelected.value.length > 0); const hasSelectedRows = computed(() => rowsSelected.value.length > 0);
const rowsSelected = ref([]); const rowsSelected = ref([]);
const itemFixedPriceFilterRef = ref(); const itemFixedPriceFilterRef = ref();
const reloadTable = debounce(() => {
Review

No creo que un timeout (es parecido) sea la mejor opcion. Si el problema es que hace reload demasiado rapido. Habra algo que se pueda mirar para saber que ya debe recargar

No creo que un timeout (es parecido) sea la mejor opcion. Si el problema es que hace reload demasiado rapido. Habra algo que se pueda mirar para saber que ya debe recargar
tableRef.value.reload();
}, 500);
onMounted(async () => { onMounted(async () => {
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
@ -229,7 +233,7 @@ const validations = ({ row }) => {
'warehouseFk', 'warehouseFk',
]; ];
const isValid = requiredFields.every( const isValid = requiredFields.every(
(field) => row[field] !== null && row[field] !== undefined (field) => row[field] !== null && row[field] !== undefined,
); );
return isValid; return isValid;
}; };
@ -304,7 +308,7 @@ const openEditTableCellDialog = () => {
const onEditCellDataSaved = async () => { const onEditCellDataSaved = async () => {
rowsSelected.value = []; rowsSelected.value = [];
tableRef.value.reload(); reloadTable();
}; };
const removeFuturePrice = async () => { const removeFuturePrice = async () => {
@ -415,6 +419,9 @@ function handleOnDataSave({ CrudModelRef }) {
'row-key': 'id', 'row-key': 'id',
selection: 'multiple', selection: 'multiple',
}" }"
:crud-model="{
disableInfiniteScroll: true,
}"
:use-model="true" :use-model="true"
v-model:selected="rowsSelected" v-model:selected="rowsSelected"
:create-as-dialog="false" :create-as-dialog="false"
@ -548,7 +555,7 @@ function handleOnDataSave({ CrudModelRef }) {
openConfirmationModal( openConfirmationModal(
t('globals.rowWillBeRemoved'), t('globals.rowWillBeRemoved'),
t('Do you want to clone this item?'), t('Do you want to clone this item?'),
() => removePrice(row.id, rowIndex) () => removePrice(row.id, rowIndex),
) )
" "
> >

View File

@ -3,7 +3,9 @@ function goTo(n = 1) {
return `.q-virtual-scroll__content > :nth-child(${n})`; return `.q-virtual-scroll__content > :nth-child(${n})`;
} }
const firstRow = goTo(); const firstRow = goTo();
`.q-virtual-scroll__content > :nth-child(2)`; const secondRow = goTo(2);
`.q-virtual-scroll__content > :nth-child(1)`;
describe('Handle Items FixedPrice', () => { describe('Handle Items FixedPrice', () => {
beforeEach(() => { beforeEach(() => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
@ -14,45 +16,37 @@ describe('Handle Items FixedPrice', () => {
'.q-header > .q-toolbar > :nth-child(1) > .q-btn__content > .q-icon' '.q-header > .q-toolbar > :nth-child(1) > .q-btn__content > .q-icon'
).click(); ).click();
}); });
it.skip('filter', function () { it('filter', function () {
cy.get('.category-filter > :nth-child(1) > .q-btn__content > .q-icon').click(); cy.get('.category-filter > :nth-child(2) > .q-btn__content > .q-icon').click();
cy.selectOption('.list > :nth-child(2)', 'Alstroemeria'); cy.selectOption('.list > :nth-child(2)', 'Crisantemo');
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click(); 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 ==== */ /* ==== End Cypress Studio ==== */
}); });
it.skip('Create and delete ', function () {
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click(); it('Create and delete ', function () {
cy.addBtnClick(); cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content').click();
cy.selectOption(`${firstRow} > :nth-child(2)`, '#11'); cy.dataCy('vnTableCreateBtn').click();
cy.get(`${firstRow} > :nth-child(4)`).type('1'); cy.get(`${secondRow} > :nth-child(5) > .q-td`).type("2{enter}");
cy.get(`${firstRow} > :nth-child(5)`).type('2'); cy.get(`${secondRow} > :nth-child(2)`).type('11');
cy.selectOption(`${firstRow} > :nth-child(9)`, 'Warehouse One'); cy.get('.q-menu .q-item').contains('#11').click();
cy.get('.q-notification__message').should('have.text', 'Data saved'); cy.get(`${secondRow} > :nth-child(4) > .q-td`).type("1{enter}");
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click(); cy.get(`${secondRow} > :nth-child(9)`).type('Warehouse One');
cy.get(`${firstRow} > .text-right > .q-btn > .q-btn__content > .q-icon`).click(); cy.get('.q-menu .q-item').contains('Warehouse One').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-notification__message').should('have.text', 'Data saved');
cy.get(':nth-child(3) > .text-right > .q-btn').click();
cy.dataCy('VnConfirm_confirm').click();
}); });
it.skip('Massive edit', function () { it('Massive edit', function () {
provira marked this conversation as resolved Outdated
Outdated
Review

Se deja en skip??

Se deja en skip??
cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click(); cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click();
cy.get('#subToolbar > .q-btn--standard').click(); cy.get('#subToolbar > .q-btn--standard').click();
cy.selectOption("[data-cy='field-to-edit']", 'Min price'); cy.selectOption("[data-cy='field-to-edit']", 'Min price');
cy.dataCy('value-to-edit').find('input').type('1'); cy.dataCy('value-to-edit').find('input').type('1');
cy.get('.countLines').should('have.text', ' 1 '); cy.get('.countLines').invoke('text').then(parseFloat).should('be.gte', 1);
cy.get('.q-mt-lg > .q-btn--standard').click(); cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get('.q-notification__message').should('have.text', 'Data saved'); cy.get('.q-notification__message').should('have.text', 'Data saved');
}); });
it.skip('Massive remove', function () { it('Massive remove', function () {
cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click(); cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click();
cy.get('#subToolbar > .q-btn--flat').click(); cy.get('#subToolbar > .q-btn--flat').click();
cy.get( cy.get(