This commit is contained in:
Alex Moreno 2024-04-11 12:32:51 +02:00
commit 3f8d97e2a3
7 changed files with 30 additions and 26 deletions

View File

@ -78,6 +78,7 @@ defineExpose({
<div class="q-mt-lg row justify-end"> <div class="q-mt-lg row justify-end">
<QBtn <QBtn
:label="t('globals.save')" :label="t('globals.save')"
:title="t('globals.save')"
type="submit" type="submit"
color="primary" color="primary"
:disabled="isLoading" :disabled="isLoading"
@ -85,6 +86,7 @@ defineExpose({
/> />
<QBtn <QBtn
:label="t('globals.cancel')" :label="t('globals.cancel')"
:title="t('globals.cancel')"
type="reset" type="reset"
color="primary" color="primary"
flat flat

View File

@ -77,6 +77,7 @@ const arrayData = useArrayData(props.dataKey, {
userParams: props.userParams, userParams: props.userParams,
exprBuilder: props.exprBuilder, exprBuilder: props.exprBuilder,
}); });
const hasMoreData = ref();
const store = arrayData.store; const store = arrayData.store;
onMounted(() => { onMounted(() => {
@ -109,7 +110,6 @@ async function paginate() {
isLoading.value = true; isLoading.value = true;
await arrayData.loadMore(); await arrayData.loadMore();
if (!arrayData.hasMoreData.value) { if (!arrayData.hasMoreData.value) {
if (store.userParamsChanged) arrayData.hasMoreData.value = true; if (store.userParamsChanged) arrayData.hasMoreData.value = true;
store.userParamsChanged = false; store.userParamsChanged = false;
@ -127,6 +127,7 @@ async function paginate() {
} }
function endPagination() { function endPagination() {
hasMoreData.value = arrayData.hasMoreData.value;
isLoading.value = false; isLoading.value = false;
emit('onFetch', store.data); emit('onFetch', store.data);
emit('onPaginate'); emit('onPaginate');
@ -195,10 +196,7 @@ defineExpose({ fetch, addFilter });
<QSpinner color="orange" size="md" /> <QSpinner color="orange" size="md" />
</div> </div>
</QInfiniteScroll> </QInfiniteScroll>
<div <div v-if="!isLoading && hasMoreData" class="w-full flex justify-center q-mt-md">
v-if="!isLoading && arrayData.hasMoreData"
class="w-full flex justify-center q-mt-md"
>
<QBtn color="primary" :label="t('Load more data')" @click="paginate()" /> <QBtn color="primary" :label="t('Load more data')" @click="paginate()" />
</div> </div>
</template> </template>

View File

@ -5,37 +5,40 @@ describe('WagonTypeCreate', () => {
cy.viewport(1920, 1080); cy.viewport(1920, 1080);
cy.login('developer'); cy.login('developer');
cy.visit(`/#/entry/${entryId}/dms`); cy.visit(`/#/entry/${entryId}/dms`);
}); });
it('should create edit and remove new dms', () => { it('should create edit and remove new dms', () => {
cy.addRow(); cy.addRow();
cy.get('.icon-attach').click() cy.get('.icon-attach').click();
cy.get('.q-file').selectFile('test/cypress/fixtures/image.jpg', { cy.get('.q-file').selectFile('test/cypress/fixtures/image.jpg', {
force: true, force: true,
}); });
cy.get("tbody > tr").then((value) => { cy.get('tbody > tr').then((value) => {
const u = undefined;
//Create and check if exist new row //Create and check if exist new row
let newFileTd = Cypress.$(value).length; let newFileTd = Cypress.$(value).length;
cy.get('.q-btn--standard > .q-btn__content > .block').click(); cy.get('.q-btn--standard > .q-btn__content > .block').click();
expect(value).to.have.length(newFileTd++); expect(value).to.have.length(newFileTd++);
const newRowSelector = `tbody > :nth-child(${newFileTd})` const newRowSelector = `tbody > :nth-child(${newFileTd})`;
cy.waitForElement(newRowSelector); cy.waitForElement(newRowSelector);
cy.validateRow(newRowSelector, [u, u, u, u, 'ENTRADA ID 1']);
//Edit new dms //Edit new dms
const u = undefined; const newDescription = 'entry id 1 modified';
cy.validateRow(newRowSelector, [u,u,u,u,'ENTRADA ID 1']) const textAreaSelector =
cy.get(`tbody :nth-child(${newFileTd}) > .text-right > .flex > :nth-child(2) > .q-btn > .q-btn__content > .q-icon`).click(); '.q-textarea > .q-field__inner > .q-field__control > .q-field__control-container';
}) cy.get(
// cy.log('newFileTd', newFileTd) `tbody :nth-child(${newFileTd}) > .text-right > .no-wrap > :nth-child(2) > .q-btn > .q-btn__content > .q-icon`
).click();
// //Create and check if exist new row cy.get(textAreaSelector).clear();
// cy.log('newFileTd:', newFileTd); cy.get(textAreaSelector).type(newDescription);
// cy.get(`tbody :nth-child(${newFileTd}) > .text-right > .flex > :nth-child(2) > .q-btn > .q-btn__content > .q-icon`).click() cy.saveCard();
cy.reload();
// cy.get(`tbody :nth-child(${newFileTd}) > :nth-child(5) > .q-tr > :nth-child(1) > span`).then((value) => { cy.validateRow(newRowSelector, [u, u, u, u, newDescription]);
// cy.log(value) });
// });
}); });
}); });

View File

@ -37,6 +37,7 @@ describe('InvoiceInVat', () => {
it('should throw an error if there are fields undefined', () => { it('should throw an error if there are fields undefined', () => {
cy.get(inputBtns).eq(0).click(); cy.get(inputBtns).eq(0).click();
cy.get(':nth-child(1) > .q-td.q-table--col-auto-width > .q-field > .q-field__inner > .q-field__control > :nth-child(2) > .default-icon').click();
cy.get(dialogBtns).eq(2).click(); cy.get(dialogBtns).eq(2).click();
cy.get('.q-notification__message').should('have.text', "The code can't be empty"); cy.get('.q-notification__message').should('have.text', "The code can't be empty");
}); });
@ -44,7 +45,7 @@ describe('InvoiceInVat', () => {
it('should correctly handle expense addition', () => { it('should correctly handle expense addition', () => {
cy.get(inputBtns).eq(0).click(); cy.get(inputBtns).eq(0).click();
cy.get(dialogInputs).eq(0).click(); cy.get(':nth-child(1) > .q-td.q-table--col-auto-width > .q-field > .q-field__inner > .q-field__control > :nth-child(2) > .default-icon').click();
cy.get(dialogInputs).eq(0).type(randomInt); cy.get(dialogInputs).eq(0).type(randomInt);
cy.get(dialogInputs).eq(1).click(); cy.get(dialogInputs).eq(1).click();
cy.get(dialogInputs).eq(1).type('This is a dummy expense'); cy.get(dialogInputs).eq(1).type('This is a dummy expense');

View File

@ -8,9 +8,9 @@ describe('WorkerList', () => {
}); });
it('should load workers', () => { it('should load workers', () => {
cy.get(workerFieldNames).eq(0).should('have.text', 'JessicaJones'); cy.get(workerFieldNames).eq(0).should('have.text', 'jessicajones');
cy.get(workerFieldNames).eq(1).should('have.text', 'BruceBanner'); cy.get(workerFieldNames).eq(1).should('have.text', 'brucebanner');
cy.get(workerFieldNames).eq(2).should('have.text', 'CharlesXavier'); cy.get(workerFieldNames).eq(2).should('have.text', 'charlesxavier');
}); });
it('should open the worker summary', () => { it('should open the worker summary', () => {

View File

@ -60,7 +60,6 @@ describe('WorkerNotificationsManager', () => {
it('should active a notification if you are their boss', () => { it('should active a notification if you are their boss', () => {
cy.login('salesBoss'); cy.login('salesBoss');
cy.visit(`/#/worker/${salesPersonId}/notifications`); cy.visit(`/#/worker/${salesPersonId}/notifications`);
cy.waitForElement(activeList);
cy.waitForElement(availableList); cy.waitForElement(availableList);
cy.get(activeList) cy.get(activeList)

View File

@ -6,7 +6,8 @@ describe('WorkerSummary', () => {
}); });
it('should load worker summary', () => { it('should load worker summary', () => {
cy.get('.summaryHeader > div').should('have.text', '19 - salesBoss salesBoss'); cy.waitForElement('.summaryHeader');
cy.get('.summaryHeader > div').should('have.text', '19 - salesboss salesboss');
cy.get(':nth-child(1) > :nth-child(2) > .value > span').should( cy.get(':nth-child(1) > :nth-child(2) > .value > span').should(
'have.text', 'have.text',
'salesBossNick' 'salesBossNick'