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 VnTable from 'src/components/VnTable/VnTable.vue';
import { QCheckbox } from 'quasar';
import { debounce } from 'lodash';
const quasar = useQuasar();
const stateStore = useStateStore();
@ -38,6 +39,9 @@ const warehousesOptions = ref([]);
const hasSelectedRows = computed(() => rowsSelected.value.length > 0);
const rowsSelected = 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 () => {
stateStore.rightDrawer = true;
@ -229,7 +233,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;
};
@ -304,7 +308,7 @@ const openEditTableCellDialog = () => {
const onEditCellDataSaved = async () => {
rowsSelected.value = [];
tableRef.value.reload();
reloadTable();
};
const removeFuturePrice = async () => {
@ -415,6 +419,9 @@ function handleOnDataSave({ CrudModelRef }) {
'row-key': 'id',
selection: 'multiple',
}"
:crud-model="{
disableInfiniteScroll: true,
}"
:use-model="true"
v-model:selected="rowsSelected"
:create-as-dialog="false"
@ -548,7 +555,7 @@ function handleOnDataSave({ CrudModelRef }) {
openConfirmationModal(
t('globals.rowWillBeRemoved'),
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})`;
}
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', () => {
beforeEach(() => {
cy.viewport(1280, 720);
@ -14,45 +16,37 @@ describe('Handle Items FixedPrice', () => {
'.q-header > .q-toolbar > :nth-child(1) > .q-btn__content > .q-icon'
).click();
});
it.skip('filter', function () {
cy.get('.category-filter > :nth-child(1) > .q-btn__content > .q-icon').click();
cy.selectOption('.list > :nth-child(2)', 'Alstroemeria');
it('filter', function () {
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();
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();
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('.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();
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('#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('.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');
});
it.skip('Massive remove', function () {
it('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(