diff --git a/db/changes/10240-allSaints/00-supplierLog.sql b/db/changes/10240-allSaints/00-supplierLog.sql new file mode 100644 index 000000000..5ab76ac37 --- /dev/null +++ b/db/changes/10240-allSaints/00-supplierLog.sql @@ -0,0 +1,20 @@ +CREATE TABLE `vn`.`supplierLog` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `originFk` int(11) NOT NULL, + `userFk` int(10) unsigned NOT NULL, + `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, + `creationDate` timestamp NULL DEFAULT current_timestamp(), + `description` text CHARACTER SET utf8 DEFAULT NULL, + `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `changedModelId` int(11) DEFAULT NULL, + `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `logSupplier_ibfk_1` (`originFk`), + KEY `supplierLog_ibfk_2` (`userFk`), + CONSTRAINT `supplierLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `supplierLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + + diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index ed194e3a8..907219511 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1208,11 +1208,11 @@ INSERT INTO `vn`.`annualAverageInvoiced`(`clientFk`, `invoiced`) (104, 500), (105, 5000); -INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`,`isFarmer`,`retAccount`,`commission`, `created`, `postcodeFk`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`) +INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`,`isFarmer`,`commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`) VALUES - (1, 'Plants SL', 'Plants nick', 4000000001, 1, '06089160W', 0, NULL, 0, CURDATE(), 1111, 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1), - (2, 'Flower King', 'The king', 4000000002, 1, 'B22222222', 0, NULL, 0, CURDATE(), 2222, 1, 'supplier address 2', 'LONDON', 2, 45671, 1, 2, 10, 5, 2, 2), - (442, 'Verdnatura Levante SL', 'Verdnatura', 4000000442, 1, 'C33333333', 0, NULL, 0, CURDATE(), 3333, 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2, 15, 6, 9, 3); + (1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, 0, CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1), + (2, 'Farmer King', 'The farmer', 4000020002, 1, 'B22222222', 1, 0, CURDATE(), 1, 'supplier address 2', 'SILLA', 2, 43022, 1, 2, 10, 93, 2, 8), + (442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, 'C33333333', 0, 0, CURDATE(), 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2, 15, 6, 9, 3); INSERT INTO `cache`.`cache_calc`(`id`, `cache_id`, `cacheName`, `params`, `last_refresh`, `expires`, `created`, `connection_id`) VALUES diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 5413733ee..9cecbd7e5 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -316,10 +316,23 @@ let actions = { }, waitForTextInElement: async function(selector, text) { - await this.waitForSelector(selector); - return await this.waitForFunction((selector, text) => { - return document.querySelector(selector).innerText.toLowerCase().includes(text.toLowerCase()); - }, {}, selector, text); + const expectedText = text.toLowerCase(); + return new Promise((resolve, reject) => { + let attempts = 0; + const interval = setInterval(async() => { + const currentText = await this.evaluate(selector => { + return document.querySelector(selector).innerText.toLowerCase(); + }, selector); + + if (currentText === expectedText || attempts === 40) { + clearInterval(interval); + resolve(currentText); + } + attempts += 1; + }, 100); + }).then(result => { + return expect(result).toContain(expectedText); + }); }, selectorFormater: function(selector) { diff --git a/e2e/paths/01-login/01_login.spec.js b/e2e/paths/01-login/01_login.spec.js index ed507df4e..f3919edef 100644 --- a/e2e/paths/01-login/01_login.spec.js +++ b/e2e/paths/01-login/01_login.spec.js @@ -19,7 +19,7 @@ describe('Login path', async() => { const message = await page.waitForSnackbar(); const state = await page.getState(); - expect(message.type).toBe('error'); + expect(message.text).toBe('Invalid login, remember that distinction is made between uppercase and lowercase'); expect(state).toBe('login'); }); @@ -28,7 +28,7 @@ describe('Login path', async() => { const message = await page.waitForSnackbar(); const state = await page.getState(); - expect(message.type).toBe('error'); + expect(message.text).toBe('Invalid login, remember that distinction is made between uppercase and lowercase'); expect(state).toBe('login'); }); @@ -37,7 +37,7 @@ describe('Login path', async() => { const message = await page.waitForSnackbar(); const state = await page.getState(); - expect(message.type).toBe('error'); + expect(message.text).toBe('Please enter your username'); expect(state).toBe('login'); }); }); diff --git a/e2e/paths/02-client/01_create_client.spec.js b/e2e/paths/02-client/01_create_client.spec.js index 202f27064..a03576406 100644 --- a/e2e/paths/02-client/01_create_client.spec.js +++ b/e2e/paths/02-client/01_create_client.spec.js @@ -119,7 +119,7 @@ describe('Client create path', () => { await page.waitToClick(selectors.createClientView.createButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should click on the Clients button of the top bar menu', async() => { diff --git a/e2e/paths/02-client/02_edit_basic_data.spec.js b/e2e/paths/02-client/02_edit_basic_data.spec.js index 2e53a6ef8..17eaf3403 100644 --- a/e2e/paths/02-client/02_edit_basic_data.spec.js +++ b/e2e/paths/02-client/02_edit_basic_data.spec.js @@ -37,7 +37,7 @@ describe('Client Edit basicData path', () => { await page.waitToClick(selectors.clientBasicData.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the name have been edited', async() => { @@ -101,7 +101,7 @@ describe('Client Edit basicData path', () => { await page.waitToClick(selectors.clientBasicData.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should now confirm the name have been edited', async() => { diff --git a/e2e/paths/02-client/03_edit_fiscal_data.spec.js b/e2e/paths/02-client/03_edit_fiscal_data.spec.js index 774f56b21..b55fb8aa1 100644 --- a/e2e/paths/02-client/03_edit_fiscal_data.spec.js +++ b/e2e/paths/02-client/03_edit_fiscal_data.spec.js @@ -93,7 +93,7 @@ describe('Client Edit fiscalData path', () => { await page.waitToClick(selectors.globalItems.acceptButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should propagate the Equalization tax', async() => { @@ -119,7 +119,7 @@ describe('Client Edit fiscalData path', () => { await page.waitToClick(selectors.clientFiscalData.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); // confirm all addresses have now EQtax checked step 1 @@ -155,7 +155,7 @@ describe('Client Edit fiscalData path', () => { await page.waitToClick(selectors.clientFiscalData.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should propagate the Equalization tax changes', async() => { @@ -289,7 +289,7 @@ describe('Client Edit fiscalData path', () => { await page.waitToClick(selectors.clientAddresses.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); // confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 3 diff --git a/e2e/paths/02-client/05_add_address.spec.js b/e2e/paths/02-client/05_add_address.spec.js index c946bc774..d7fa9a8d7 100644 --- a/e2e/paths/02-client/05_add_address.spec.js +++ b/e2e/paths/02-client/05_add_address.spec.js @@ -91,7 +91,7 @@ describe('Client Add address path', () => { await page.waitToClick(selectors.clientAddresses.secondMakeDefaultStar); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should confirm the default address is the expected one`, async() => { diff --git a/e2e/paths/02-client/06_add_address_notes.spec.js b/e2e/paths/02-client/06_add_address_notes.spec.js index bf367f5ae..f8fbf15e9 100644 --- a/e2e/paths/02-client/06_add_address_notes.spec.js +++ b/e2e/paths/02-client/06_add_address_notes.spec.js @@ -48,6 +48,6 @@ describe('Client add address notes path', () => { await page.waitToClick(selectors.clientAddresses.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); }); diff --git a/e2e/paths/02-client/07_edit_web_access.spec.js b/e2e/paths/02-client/07_edit_web_access.spec.js index 10aff6101..52fd09134 100644 --- a/e2e/paths/02-client/07_edit_web_access.spec.js +++ b/e2e/paths/02-client/07_edit_web_access.spec.js @@ -23,7 +23,7 @@ describe('Client Edit web access path', () => { await page.waitToClick(selectors.clientWebAccess.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm web access is now unchecked', async() => { diff --git a/e2e/paths/02-client/08_add_notes.spec.js b/e2e/paths/02-client/08_add_notes.spec.js index d0b117ac9..6d4f72ab8 100644 --- a/e2e/paths/02-client/08_add_notes.spec.js +++ b/e2e/paths/02-client/08_add_notes.spec.js @@ -31,7 +31,7 @@ describe('Client Add notes path', () => { await page.waitToClick(selectors.clientNotes.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the note was created', async() => { diff --git a/e2e/paths/02-client/09_add_credit.spec.js b/e2e/paths/02-client/09_add_credit.spec.js index 8d1c9be1c..325c248dc 100644 --- a/e2e/paths/02-client/09_add_credit.spec.js +++ b/e2e/paths/02-client/09_add_credit.spec.js @@ -27,7 +27,7 @@ describe('Client Add credit path', () => { await page.waitToClick(selectors.clientCredit.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the credit was updated', async() => { diff --git a/e2e/paths/02-client/10_add_greuge.spec.js b/e2e/paths/02-client/10_add_greuge.spec.js index b7e130683..f592f04cc 100644 --- a/e2e/paths/02-client/10_add_greuge.spec.js +++ b/e2e/paths/02-client/10_add_greuge.spec.js @@ -36,7 +36,7 @@ describe('Client Add greuge path', () => { await page.waitToClick(selectors.clientGreuge.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the greuge was added to the list', async() => { diff --git a/e2e/paths/02-client/12_lock_of_verified_data.spec.js b/e2e/paths/02-client/12_lock_of_verified_data.spec.js index b90ab7dfc..95818abbf 100644 --- a/e2e/paths/02-client/12_lock_of_verified_data.spec.js +++ b/e2e/paths/02-client/12_lock_of_verified_data.spec.js @@ -32,7 +32,7 @@ describe('Client lock verified data path', () => { await page.waitToClick(selectors.clientFiscalData.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the social name have been edited', async() => { @@ -62,7 +62,7 @@ describe('Client lock verified data path', () => { await page.waitToClick(selectors.globalItems.acceptButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm Verified data checkbox is checked', async() => { @@ -79,7 +79,7 @@ describe('Client lock verified data path', () => { await page.waitToClick(selectors.clientFiscalData.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should again confirm the social name have been edited', async() => { @@ -133,7 +133,7 @@ describe('Client lock verified data path', () => { await page.waitToClick(selectors.clientFiscalData.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should now confirm the social name have been edited once and for all', async() => { diff --git a/e2e/paths/02-client/13_log.spec.js b/e2e/paths/02-client/13_log.spec.js index 93397d301..8998c598d 100644 --- a/e2e/paths/02-client/13_log.spec.js +++ b/e2e/paths/02-client/13_log.spec.js @@ -22,7 +22,7 @@ describe('Client log path', () => { await page.waitToClick(selectors.clientBasicData.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should navigate to the log section', async() => { diff --git a/e2e/paths/02-client/14_balance.spec.js b/e2e/paths/02-client/14_balance.spec.js index 8fb2eb40c..d1da04d79 100644 --- a/e2e/paths/02-client/14_balance.spec.js +++ b/e2e/paths/02-client/14_balance.spec.js @@ -20,7 +20,7 @@ describe('Client balance path', () => { await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs'); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should access to the balance section to check the data shown matches the local settings', async() => { @@ -35,7 +35,7 @@ describe('Client balance path', () => { await page.clearInput(selectors.globalItems.userConfigThirdAutocomplete); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should click the new payment button', async() => { @@ -51,7 +51,7 @@ describe('Client balance path', () => { await page.waitToClick(selectors.clientBalance.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should edit the 1st line reference', async() => { @@ -60,7 +60,7 @@ describe('Client balance path', () => { await page.keyboard.press('Enter'); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should check balance is now 0, the reference was saved and the company is now VNL becouse the user local settings were removed', async() => { @@ -85,7 +85,7 @@ describe('Client balance path', () => { await page.waitToClick(selectors.clientBalance.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should check balance is now -100', async() => { @@ -101,7 +101,7 @@ describe('Client balance path', () => { await page.waitToClick(selectors.clientBalance.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should check balance is now 50', async() => { diff --git a/e2e/paths/02-client/17_dms.spec.js b/e2e/paths/02-client/17_dms.spec.js index 32cca05f3..8768dc4ae 100644 --- a/e2e/paths/02-client/17_dms.spec.js +++ b/e2e/paths/02-client/17_dms.spec.js @@ -22,7 +22,7 @@ describe('Client DMS', () => { await page.respondToDialog('accept'); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should click on the first document line worker name making the descriptor visible`, async() => { diff --git a/e2e/paths/02-client/18_contacts.spec.js b/e2e/paths/02-client/18_contacts.spec.js index 87e75a975..f19537491 100644 --- a/e2e/paths/02-client/18_contacts.spec.js +++ b/e2e/paths/02-client/18_contacts.spec.js @@ -24,7 +24,7 @@ describe('Client contacts', () => { await page.waitToClick(selectors.clientContacts.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should delete de contact', async() => { @@ -33,6 +33,6 @@ describe('Client contacts', () => { await page.waitToClick(selectors.clientContacts.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); }); diff --git a/e2e/paths/03-worker/02_basicData.spec.js b/e2e/paths/03-worker/02_basicData.spec.js index a24ffd033..c6286ccfc 100644 --- a/e2e/paths/03-worker/02_basicData.spec.js +++ b/e2e/paths/03-worker/02_basicData.spec.js @@ -26,7 +26,7 @@ describe('Worker basic data path', () => { await page.waitToClick(selectors.workerBasicData.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should reload the section then check the name was edited', async() => { diff --git a/e2e/paths/03-worker/04_time_control.spec.js b/e2e/paths/03-worker/04_time_control.spec.js index c94137e2f..d468b9153 100644 --- a/e2e/paths/03-worker/04_time_control.spec.js +++ b/e2e/paths/03-worker/04_time_control.spec.js @@ -93,12 +93,8 @@ describe('Worker time control path', () => { expect(result).toEqual(scanTime); }); - it(`should check Hank Pym worked 8 hours`, async() => { + it(`should check Hank Pym worked 7 hours`, async() => { await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '07:00 h.'); - const result = await page - .waitToGetProperty(selectors.workerTimeControl.mondayWorkedHours, 'innerText'); - - expect(result).toEqual('07:00 h.'); }); }); @@ -149,9 +145,6 @@ describe('Worker time control path', () => { it(`should check Hank Pym worked 8 happy hours`, async() => { await page.waitForTextInElement(selectors.workerTimeControl.tuesdayWorkedHours, '08:00 h.'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.tuesdayWorkedHours, 'innerText'); - - expect(result).toEqual('08:00 h.'); }); }); @@ -202,9 +195,6 @@ describe('Worker time control path', () => { it(`should check Hank Pym worked 8 cheerfull hours`, async() => { await page.waitForTextInElement(selectors.workerTimeControl.wednesdayWorkedHours, '08:00 h.'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.wednesdayWorkedHours, 'innerText'); - - expect(result).toEqual('08:00 h.'); }); }); @@ -252,9 +242,6 @@ describe('Worker time control path', () => { it(`should check Hank Pym worked 8 joyfull hours`, async() => { await page.waitForTextInElement(selectors.workerTimeControl.thursdayWorkedHours, '08:00 h.'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.thursdayWorkedHours, 'innerText'); - - expect(result).toEqual('08:00 h.'); }); }); @@ -301,9 +288,6 @@ describe('Worker time control path', () => { it(`should check Hank Pym worked 8 hours with a smile on his face`, async() => { await page.waitForTextInElement(selectors.workerTimeControl.fridayWorkedHours, '08:00 h.'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.fridayWorkedHours, 'innerText'); - - expect(result).toEqual('08:00 h.'); }); }); }); @@ -346,9 +330,6 @@ describe('Worker time control path', () => { it(`should check Hank Pym worked 8 hours with all his will`, async() => { await page.waitForTextInElement(selectors.workerTimeControl.saturdayWorkedHours, '08:00 h.'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.saturdayWorkedHours, 'innerText'); - - expect(result).toEqual('08:00 h.'); }); }); @@ -375,19 +356,12 @@ describe('Worker time control path', () => { it(`should check Hank Pym worked 8 glad hours`, async() => { await page.waitForTextInElement(selectors.workerTimeControl.sundayWorkedHours, '08:00 h.'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.sundayWorkedHours, 'innerText'); - - expect(result).toEqual('08:00 h.'); }); it(`should check Hank Pym doesn't have hours set on the next months first week`, async() => { await page.waitToClick(selectors.workerTimeControl.nextMonthButton); await page.waitToClick(selectors.workerTimeControl.secondWeekDay); await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '00:00 h.'); - const wholeWeekHours = await page - .waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText'); - - expect(wholeWeekHours).toEqual('00:00 h.'); }); it(`should check he didn't scan in this week yet`, async() => { @@ -410,11 +384,8 @@ describe('Worker time control path', () => { await page.accessToSection('worker.card.timeControl'); }); - it('should check his hours are alright', async() => { + it('should check his weekly hours are alright', async() => { await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '55:00 h.'); - const wholeWeekHours = await page.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText'); - - expect(wholeWeekHours).toEqual('55:00 h.'); }); }); }); diff --git a/e2e/paths/04-item/02_basic_data.spec.js b/e2e/paths/04-item/02_basic_data.spec.js index f04031480..0ab2341d3 100644 --- a/e2e/paths/04-item/02_basic_data.spec.js +++ b/e2e/paths/04-item/02_basic_data.spec.js @@ -38,7 +38,7 @@ describe('Item Edit basic data path', () => { await page.waitToClick(selectors.itemBasicData.submitBasicDataButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should create a new intrastat`, async() => { @@ -57,7 +57,7 @@ describe('Item Edit basic data path', () => { await page.waitToClick(selectors.itemBasicData.submitBasicDataButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should confirm the item name was edited`, async() => { diff --git a/e2e/paths/04-item/03_tax.spec.js b/e2e/paths/04-item/03_tax.spec.js index b05dcb286..f10082a07 100644 --- a/e2e/paths/04-item/03_tax.spec.js +++ b/e2e/paths/04-item/03_tax.spec.js @@ -23,7 +23,7 @@ describe('Item edit tax path', () => { await page.waitToClick(selectors.itemTax.submitTaxButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should confirm the first item tax class was edited`, async() => { diff --git a/e2e/paths/04-item/04_tags.spec.js b/e2e/paths/04-item/04_tags.spec.js index f53ff3582..863313285 100644 --- a/e2e/paths/04-item/04_tags.spec.js +++ b/e2e/paths/04-item/04_tags.spec.js @@ -26,7 +26,7 @@ describe('Item create tags path', () => { await page.waitToClick(selectors.itemTags.submitItemTagsButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should confirm the fourth row data is the expected one`, async() => { diff --git a/e2e/paths/04-item/05_niche.spec.js b/e2e/paths/04-item/05_niche.spec.js index 355dd2b0f..6ec4d874e 100644 --- a/e2e/paths/04-item/05_niche.spec.js +++ b/e2e/paths/04-item/05_niche.spec.js @@ -25,7 +25,7 @@ describe('Item create niche path', () => { await page.waitToClick(selectors.itemNiches.submitNichesButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should confirm the first niche is the expected one`, async() => { diff --git a/e2e/paths/04-item/06_botanical.spec.js b/e2e/paths/04-item/06_botanical.spec.js index 84a144f1d..9e88b7338 100644 --- a/e2e/paths/04-item/06_botanical.spec.js +++ b/e2e/paths/04-item/06_botanical.spec.js @@ -23,7 +23,7 @@ describe('Item Create botanical path', () => { await page.waitToClick(selectors.itemBotanical.submitBotanicalButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should confirm the botanical for the item was created`, async() => { @@ -58,7 +58,7 @@ describe('Item Create botanical path', () => { await page.waitToClick(selectors.itemBotanical.submitBotanicalButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should confirm the botanical for the item was edited`, async() => { diff --git a/e2e/paths/04-item/07_barcode.spec.js b/e2e/paths/04-item/07_barcode.spec.js index 0220b3a9d..661aa1030 100644 --- a/e2e/paths/04-item/07_barcode.spec.js +++ b/e2e/paths/04-item/07_barcode.spec.js @@ -23,7 +23,7 @@ describe('Item Create barcodes path', () => { await page.waitToClick(selectors.itemBarcodes.submitBarcodesButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should confirm the barcode 5 is created and it is now the third barcode as the first was deleted`, async() => { diff --git a/e2e/paths/04-item/08_create_and_clone.spec.js b/e2e/paths/04-item/08_create_and_clone.spec.js index 4d035a4c3..4158a649a 100644 --- a/e2e/paths/04-item/08_create_and_clone.spec.js +++ b/e2e/paths/04-item/08_create_and_clone.spec.js @@ -45,7 +45,7 @@ describe('Item Create/Clone path', () => { await page.waitToClick(selectors.itemCreateView.createButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm Infinity Gauntlet item was created', async() => { diff --git a/e2e/paths/04-item/09_regularize.spec.js b/e2e/paths/04-item/09_regularize.spec.js index 5825243a0..3728d3bfe 100644 --- a/e2e/paths/04-item/09_regularize.spec.js +++ b/e2e/paths/04-item/09_regularize.spec.js @@ -20,7 +20,7 @@ describe('Item regularize path', () => { await page.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four'); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should check the local settings were saved', async() => { @@ -51,7 +51,7 @@ describe('Item regularize path', () => { await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should click on the Tickets button of the top bar menu', async() => { @@ -70,7 +70,7 @@ describe('Item regularize path', () => { await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should search for the ticket with alias missing', async() => { @@ -114,7 +114,7 @@ describe('Item regularize path', () => { await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should again click on the Tickets button of the top bar menu', async() => { diff --git a/e2e/paths/04-item/10_index.spec.js b/e2e/paths/04-item/10_index.spec.js index 655b72b2a..c329b8898 100644 --- a/e2e/paths/04-item/10_index.spec.js +++ b/e2e/paths/04-item/10_index.spec.js @@ -36,7 +36,7 @@ describe('Item index path', () => { await page.waitToClick(selectors.itemsIndex.saveFieldsButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should navigate forth and back to see the images column is still visible', async() => { @@ -70,7 +70,7 @@ describe('Item index path', () => { await page.waitToClick(selectors.itemsIndex.saveFieldsButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should now navigate forth and back to see the ids column is now visible', async() => { diff --git a/e2e/paths/04-item/11_item_log.spec.js b/e2e/paths/04-item/11_item_log.spec.js index ebd5d4c70..f3a08e365 100644 --- a/e2e/paths/04-item/11_item_log.spec.js +++ b/e2e/paths/04-item/11_item_log.spec.js @@ -34,7 +34,7 @@ describe('Item log path', () => { await page.waitToClick(selectors.itemCreateView.createButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should return to the items index by clicking the return to items button', async() => { diff --git a/e2e/paths/04-item/12_descriptor.spec.js b/e2e/paths/04-item/12_descriptor.spec.js index 35be1135e..cfcbef083 100644 --- a/e2e/paths/04-item/12_descriptor.spec.js +++ b/e2e/paths/04-item/12_descriptor.spec.js @@ -29,7 +29,7 @@ describe('Item descriptor path', () => { await page.waitToClick(selectors.itemBasicData.submitBasicDataButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should reload the section and check the inactive icon is bright', async() => { @@ -45,6 +45,6 @@ describe('Item descriptor path', () => { await page.waitToClick(selectors.itemBasicData.submitBasicDataButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); }); diff --git a/e2e/paths/05-ticket/01-sale/01_list_sales.spec.js b/e2e/paths/05-ticket/01-sale/01_list_sales.spec.js index 4f5f9b76c..29f415e9d 100644 --- a/e2e/paths/05-ticket/01-sale/01_list_sales.spec.js +++ b/e2e/paths/05-ticket/01-sale/01_list_sales.spec.js @@ -77,7 +77,7 @@ describe('Ticket List sale path', () => { await page.keyboard.press('Enter'); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should update the description of the new sale', async() => { @@ -86,7 +86,7 @@ describe('Ticket List sale path', () => { await page.keyboard.press('Enter'); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should add a third empty item to the sale list', async() => { @@ -104,7 +104,7 @@ describe('Ticket List sale path', () => { await page.waitToClick(selectors.globalItems.acceptButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should verify there's only 1 single line remaining`, async() => { diff --git a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js index e530f1cb5..70a1447ff 100644 --- a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js +++ b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js @@ -41,7 +41,7 @@ describe('Ticket Edit sale path', () => { await page.keyboard.press('Enter'); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should check it's state is libre now`, async() => { @@ -55,7 +55,7 @@ describe('Ticket Edit sale path', () => { await page.waitToClick(selectors.ticketSales.setOk); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should check it's state is OK now`, async() => { @@ -135,7 +135,7 @@ describe('Ticket Edit sale path', () => { await page.type(selectors.ticketSales.firstSaleQuantity, '9\u000d'); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should update the price', async() => { @@ -144,7 +144,7 @@ describe('Ticket Edit sale path', () => { await page.type(selectors.ticketSales.firstSalePriceInput, '5\u000d'); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the price have been updated', async() => { @@ -165,7 +165,7 @@ describe('Ticket Edit sale path', () => { await page.type(selectors.ticketSales.firstSaleDiscountInput, '50\u000d'); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the discount have been updated', async() => { @@ -224,7 +224,7 @@ describe('Ticket Edit sale path', () => { await page.waitForSpinnerLoad(); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should confirm the third sale was deleted`, async() => { diff --git a/e2e/paths/05-ticket/01_observations.spec.js b/e2e/paths/05-ticket/01_observations.spec.js index d919b8ed3..6640708dc 100644 --- a/e2e/paths/05-ticket/01_observations.spec.js +++ b/e2e/paths/05-ticket/01_observations.spec.js @@ -24,7 +24,7 @@ describe('Ticket Create notes path', () => { await page.waitToClick(selectors.ticketNotes.submitNotesButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the note is the expected one', async() => { @@ -45,6 +45,6 @@ describe('Ticket Create notes path', () => { await page.waitToClick(selectors.ticketNotes.submitNotesButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); }); diff --git a/e2e/paths/05-ticket/04_packages.spec.js b/e2e/paths/05-ticket/04_packages.spec.js index 3db53587c..33ee5c40c 100644 --- a/e2e/paths/05-ticket/04_packages.spec.js +++ b/e2e/paths/05-ticket/04_packages.spec.js @@ -51,7 +51,7 @@ describe('Ticket Create packages path', () => { await page.waitToClick(selectors.ticketPackages.savePackagesButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should confirm the first select is the expected one`, async() => { diff --git a/e2e/paths/05-ticket/05_tracking_state.spec.js b/e2e/paths/05-ticket/05_tracking_state.spec.js index 53f082007..d66067da8 100644 --- a/e2e/paths/05-ticket/05_tracking_state.spec.js +++ b/e2e/paths/05-ticket/05_tracking_state.spec.js @@ -36,7 +36,7 @@ describe('Ticket Create new tracking state path', () => { await page.waitToClick(selectors.createStateView.saveStateButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); }); @@ -74,7 +74,7 @@ describe('Ticket Create new tracking state path', () => { await page.waitToClick(selectors.createStateView.saveStateButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); }); }); diff --git a/e2e/paths/05-ticket/09_weekly.spec.js b/e2e/paths/05-ticket/09_weekly.spec.js index 79722d2f7..d8fa758e0 100644 --- a/e2e/paths/05-ticket/09_weekly.spec.js +++ b/e2e/paths/05-ticket/09_weekly.spec.js @@ -33,7 +33,7 @@ describe('Ticket descriptor path', () => { await page.waitToClick(selectors.ticketDescriptor.thursdayButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should again click on the Tickets button of the top bar menu', async() => { @@ -68,7 +68,7 @@ describe('Ticket descriptor path', () => { await page.waitToClick(selectors.ticketDescriptor.saturdayButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should click on the Tickets button of the top bar menu once again', async() => { @@ -97,7 +97,7 @@ describe('Ticket descriptor path', () => { await page.waitToClick(selectors.ticketsIndex.acceptDeleteTurn); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the sixth weekly ticket was deleted', async() => { @@ -111,11 +111,11 @@ describe('Ticket descriptor path', () => { await page.autocompleteSearch(selectors.ticketsIndex.firstWeeklyTicketAgency, 'Silla247'); let message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); await page.clearInput(selectors.ticketsIndex.firstWeeklyTicketAgency); message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); }); diff --git a/e2e/paths/05-ticket/10_request.spec.js b/e2e/paths/05-ticket/10_request.spec.js index c01964d2b..857bf6ac1 100644 --- a/e2e/paths/05-ticket/10_request.spec.js +++ b/e2e/paths/05-ticket/10_request.spec.js @@ -27,7 +27,7 @@ describe('Ticket purchase request path', () => { await page.waitToClick(selectors.ticketRequests.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should have been redirected to the request index', async() => { @@ -39,24 +39,24 @@ describe('Ticket purchase request path', () => { await page.keyboard.press('Enter'); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); - it('should confirm the new request was added', async() => { + it('should check the new request was added', async() => { await page.reloadSection('ticket.card.request.index'); const result = await page.waitToGetProperty(selectors.ticketRequests.thirdRequestQuantity, 'value'); expect(result).toEqual('99'); }); - it(`should confirm first request can't be edited as its state is different to new`, async() => { + it(`should check the first request can't be edited as its state is different to new`, async() => { await page.waitForClassPresent(selectors.ticketRequests.firstRequestQuantity, 'disabled'); const result = await page.isDisabled(selectors.ticketRequests.firstRequestQuantity); expect(result).toBe(true); }); - it(`should confirm second request can't be edited as its state is different to new`, async() => { + it(`should check the second request can't be edited as its state is different to new`, async() => { await page.waitForClassPresent(selectors.ticketRequests.secondRequestQuantity, 'disabled'); const result = await page.isDisabled(selectors.ticketRequests.secondRequestQuantity); @@ -67,10 +67,10 @@ describe('Ticket purchase request path', () => { await page.waitToClick(selectors.ticketRequests.thirdRemoveRequestButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); - it('should confirm the request was deleted', async() => { + it('should check the request was deleted', async() => { await page.reloadSection('ticket.card.request.index'); await page.wait(selectors.ticketRequests.addRequestButton); await page.waitForSelector(selectors.ticketRequests.thirdDescription, {hidden: true}); diff --git a/e2e/paths/05-ticket/12_descriptor.spec.js b/e2e/paths/05-ticket/12_descriptor.spec.js index dab9a7558..8e99ec060 100644 --- a/e2e/paths/05-ticket/12_descriptor.spec.js +++ b/e2e/paths/05-ticket/12_descriptor.spec.js @@ -100,7 +100,7 @@ describe('Ticket descriptor path', () => { await page.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); xit(`should check the state of the stowaway ticket is embarked`, async() => { @@ -122,7 +122,7 @@ describe('Ticket descriptor path', () => { await page.waitToClick(selectors.ticketDescriptor.acceptDeleteStowawayButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should confirm the ship buton doesn't exisist any more`, async() => { diff --git a/e2e/paths/05-ticket/13_services.spec.js b/e2e/paths/05-ticket/13_services.spec.js index 8102d9479..7fa736168 100644 --- a/e2e/paths/05-ticket/13_services.spec.js +++ b/e2e/paths/05-ticket/13_services.spec.js @@ -83,7 +83,7 @@ describe('Ticket services path', () => { await page.waitToClick(selectors.ticketService.saveServiceButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the service description was created correctly', async() => { @@ -114,7 +114,7 @@ describe('Ticket services path', () => { await page.waitToClick(selectors.ticketService.saveServiceButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should confirm the service was removed`, async() => { diff --git a/e2e/paths/05-ticket/14_create_ticket.spec.js b/e2e/paths/05-ticket/14_create_ticket.spec.js index da97d7584..f7ac4375d 100644 --- a/e2e/paths/05-ticket/14_create_ticket.spec.js +++ b/e2e/paths/05-ticket/14_create_ticket.spec.js @@ -31,7 +31,7 @@ describe('Ticket create path', () => { await page.waitToClick(selectors.createTicketView.createButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should check the url is now the summary of the ticket', async() => { @@ -55,7 +55,7 @@ describe('Ticket create path', () => { await page.waitToClick(selectors.createTicketView.createButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should check the url is now the summary of the created ticket', async() => { @@ -68,7 +68,7 @@ describe('Ticket create path', () => { await page.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should delete the current ticket', async() => { @@ -77,7 +77,7 @@ describe('Ticket create path', () => { await page.waitToClick(selectors.ticketDescriptor.acceptDialog); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Ticket deleted. You can undo this action within the first hour'); }); it('should search for the stowaway ticket of the previously deleted ticket', async() => { diff --git a/e2e/paths/05-ticket/16_summary.spec.js b/e2e/paths/05-ticket/16_summary.spec.js index 70d7592d7..2934c15c6 100644 --- a/e2e/paths/05-ticket/16_summary.spec.js +++ b/e2e/paths/05-ticket/16_summary.spec.js @@ -80,7 +80,7 @@ describe('Ticket Summary path', () => { await page.waitToClick(selectors.ticketSummary.setOk); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the ticket state was updated', async() => { diff --git a/e2e/paths/05-ticket/17_log.spec.js b/e2e/paths/05-ticket/17_log.spec.js index 97e121460..96767bc3d 100644 --- a/e2e/paths/05-ticket/17_log.spec.js +++ b/e2e/paths/05-ticket/17_log.spec.js @@ -29,7 +29,7 @@ describe('Ticket log path', () => { await page.waitToClick(selectors.ticketNotes.submitNotesButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should navigate to the log section', async() => { diff --git a/e2e/paths/05-ticket/18_index_payout.spec.js b/e2e/paths/05-ticket/18_index_payout.spec.js index 24214228b..9b5358eb3 100644 --- a/e2e/paths/05-ticket/18_index_payout.spec.js +++ b/e2e/paths/05-ticket/18_index_payout.spec.js @@ -42,7 +42,7 @@ describe('Ticket index payout path', () => { await page.waitToClick(selectors.ticketsIndex.submitPayout); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should navigate to the client balance section and check a new balance line was entered', async() => { diff --git a/e2e/paths/06-claim/01_basic_data.spec.js b/e2e/paths/06-claim/01_basic_data.spec.js index 4b60b2689..934d481ea 100644 --- a/e2e/paths/06-claim/01_basic_data.spec.js +++ b/e2e/paths/06-claim/01_basic_data.spec.js @@ -27,7 +27,7 @@ describe('Claim edit basic data path', () => { await page.waitToClick(selectors.claimBasicData.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should have been redirected to the next section of claims as the role is claimManager`, async() => { @@ -40,7 +40,7 @@ describe('Claim edit basic data path', () => { await page.waitToClick(selectors.claimBasicData.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the claim state was edited', async() => { @@ -71,6 +71,6 @@ describe('Claim edit basic data path', () => { await page.waitToClick(selectors.claimBasicData.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); }); diff --git a/e2e/paths/06-claim/02_development.spec.js b/e2e/paths/06-claim/02_development.spec.js index 545ec340b..f262e8e65 100644 --- a/e2e/paths/06-claim/02_development.spec.js +++ b/e2e/paths/06-claim/02_development.spec.js @@ -28,7 +28,7 @@ describe('Claim development', () => { await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should redirect to the next section of claims as the role is claimManager`, async() => { @@ -45,7 +45,7 @@ describe('Claim development', () => { await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the first development is the expected one', async() => { diff --git a/e2e/paths/06-claim/03_detail.spec.js b/e2e/paths/06-claim/03_detail.spec.js index 9d1f6eee1..e5fa94fc2 100644 --- a/e2e/paths/06-claim/03_detail.spec.js +++ b/e2e/paths/06-claim/03_detail.spec.js @@ -23,7 +23,7 @@ xdescribe('Claim detail', () => { await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the claim contains now two items', async() => { @@ -38,7 +38,7 @@ xdescribe('Claim detail', () => { await page.keyboard.press('Enter'); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the first item quantity, and the claimed total were correctly edited', async() => { @@ -67,7 +67,7 @@ xdescribe('Claim detail', () => { await page.keyboard.press('Enter'); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should check the mana is the expected one', async() => { @@ -81,7 +81,7 @@ xdescribe('Claim detail', () => { await page.waitToClick(selectors.claimDetail.secondItemDeleteButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the claim contains now one item', async() => { @@ -95,7 +95,7 @@ xdescribe('Claim detail', () => { await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should have been redirected to the next section in claims`, async() => { diff --git a/e2e/paths/06-claim/04_claim_action.spec.js b/e2e/paths/06-claim/04_claim_action.spec.js index 710dc1809..e4fd086eb 100644 --- a/e2e/paths/06-claim/04_claim_action.spec.js +++ b/e2e/paths/06-claim/04_claim_action.spec.js @@ -21,7 +21,7 @@ describe('Claim action path', () => { await page.waitToClick(selectors.claimAction.importClaimButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should import the second importable ticket', async() => { @@ -33,7 +33,7 @@ describe('Claim action path', () => { await page.waitToClick(selectors.claimAction.secondImportableTicket); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should edit the second line destination field', async() => { @@ -41,14 +41,14 @@ describe('Claim action path', () => { await page.autocompleteSearch(selectors.claimAction.secondLineDestination, 'Bueno'); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should delete the first line', async() => { await page.waitToClick(selectors.claimAction.firstDeleteLine); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should refresh the view to check the remaining line is the expected one', async() => { @@ -62,14 +62,14 @@ describe('Claim action path', () => { await page.waitToClick(selectors.claimAction.firstDeleteLine); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should check the "is paid with mana" checkbox', async() => { await page.waitToClick(selectors.claimAction.isPaidWithManaCheckbox); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the "is paid with mana" is checked', async() => { diff --git a/e2e/paths/07-order/02_basic_data.spec.js b/e2e/paths/07-order/02_basic_data.spec.js index a76f7dbcc..2fd039940 100644 --- a/e2e/paths/07-order/02_basic_data.spec.js +++ b/e2e/paths/07-order/02_basic_data.spec.js @@ -81,7 +81,7 @@ describe('Order edit basic data path', () => { await page.waitToClick(selectors.orderBasicData.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should now confirm the client have been edited', async() => { diff --git a/e2e/paths/07-order/03_lines.spec.js b/e2e/paths/07-order/03_lines.spec.js index e74eaae23..a632aacc7 100644 --- a/e2e/paths/07-order/03_lines.spec.js +++ b/e2e/paths/07-order/03_lines.spec.js @@ -28,7 +28,7 @@ describe('Order lines', () => { await page.waitToClick(selectors.orderLine.confirmButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the order subtotal has changed', async() => { diff --git a/e2e/paths/08-route/02_basic_data.spec.js b/e2e/paths/08-route/02_basic_data.spec.js index 10edbcd8a..4ea478ee6 100644 --- a/e2e/paths/08-route/02_basic_data.spec.js +++ b/e2e/paths/08-route/02_basic_data.spec.js @@ -33,7 +33,7 @@ describe('Route basic Data path', () => { await page.waitToClick(selectors.routeBasicData.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the worker was edited', async() => { diff --git a/e2e/paths/08-route/03_create.spec.js b/e2e/paths/08-route/03_create.spec.js index 7c6c3f75d..8a022a86f 100644 --- a/e2e/paths/08-route/03_create.spec.js +++ b/e2e/paths/08-route/03_create.spec.js @@ -51,7 +51,7 @@ describe('Route create path', () => { await page.waitToClick(selectors.createRouteView.submitButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it(`should confirm the redirection to the created route summary`, async() => { diff --git a/e2e/paths/08-route/04_tickets.spec.js b/e2e/paths/08-route/04_tickets.spec.js index 938c98574..8f7e3d609 100644 --- a/e2e/paths/08-route/04_tickets.spec.js +++ b/e2e/paths/08-route/04_tickets.spec.js @@ -23,7 +23,7 @@ xdescribe('Route basic Data path', () => { await page.keyboard.press('Enter'); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should confirm the buscamanButton is disabled', async() => { diff --git a/e2e/paths/10-travel/01_thermograph.spec.js b/e2e/paths/10-travel/01_thermograph.spec.js index e7f1e234d..569fbbb8a 100644 --- a/e2e/paths/10-travel/01_thermograph.spec.js +++ b/e2e/paths/10-travel/01_thermograph.spec.js @@ -51,7 +51,7 @@ describe('Travel thermograph path', () => { const message = await page.waitForSnackbar(); const state = await page.getState(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); expect(state).toBe('travel.card.thermograph.index'); }); diff --git a/e2e/paths/10-travel/02_basic_data_and_log.spec.js b/e2e/paths/10-travel/02_basic_data_and_log.spec.js index c631e7131..991757d82 100644 --- a/e2e/paths/10-travel/02_basic_data_and_log.spec.js +++ b/e2e/paths/10-travel/02_basic_data_and_log.spec.js @@ -52,7 +52,7 @@ describe('Travel basic data path', () => { await page.waitToClick(selectors.travelBasicDada.save); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should reload the section and check the reference was saved', async() => { diff --git a/e2e/paths/11-zone/01_basic-data.spec.js b/e2e/paths/11-zone/01_basic-data.spec.js index f28be5194..c6f1152a7 100644 --- a/e2e/paths/11-zone/01_basic-data.spec.js +++ b/e2e/paths/11-zone/01_basic-data.spec.js @@ -40,7 +40,7 @@ describe('Zone basic data path', () => { await page.waitToClick(selectors.zoneBasicData.saveButton); const message = await page.waitForSnackbar(); - expect(message.type).toBe('success'); + expect(message.text).toBe('Data saved!'); }); it('should now reload the section', async() => { diff --git a/e2e/paths/12-entry/01_summary.spec.js b/e2e/paths/12-entry/01_summary.spec.js index a6ac8dab1..b846bc4c8 100644 --- a/e2e/paths/12-entry/01_summary.spec.js +++ b/e2e/paths/12-entry/01_summary.spec.js @@ -21,10 +21,10 @@ describe('Entry summary path', () => { }); it(`should display details from the entry on the header`, async() => { - await page.waitForTextInElement(selectors.entrySummary.header, 'The king'); + await page.waitForTextInElement(selectors.entrySummary.header, 'The farmer'); const result = await page.waitToGetProperty(selectors.entrySummary.header, 'innerText'); - expect(result).toContain('The king'); + expect(result).toContain('The farmer'); }); it('should display some entry details like the reference', async() => { diff --git a/modules/supplier/back/model-config.json b/modules/supplier/back/model-config.json index 9c2f8f391..c1963a8cf 100644 --- a/modules/supplier/back/model-config.json +++ b/modules/supplier/back/model-config.json @@ -4,5 +4,8 @@ }, "PayDem": { "dataSource": "vn" + }, + "SupplierLog": { + "dataSource": "vn" } } diff --git a/modules/supplier/back/models/supplier-log.json b/modules/supplier/back/models/supplier-log.json new file mode 100644 index 000000000..9b66bdf74 --- /dev/null +++ b/modules/supplier/back/models/supplier-log.json @@ -0,0 +1,58 @@ +{ + "name": "SupplierLog", + "base": "VnModel", + "options": { + "mysql": { + "table": "supplierLog" + } + }, + "properties": { + "id": { + "id": true, + "type": "Number", + "forceId": false + }, + "originFk": { + "type": "Number", + "required": true + }, + "userFk": { + "type": "Number" + }, + "action": { + "type": "String", + "required": true + }, + "changedModel": { + "type": "String" + }, + "oldInstance": { + "type": "Object" + }, + "newInstance": { + "type": "Object" + }, + "creationDate": { + "type": "Date" + }, + "changedModelId": { + "type": "String" + }, + "changedModelValue": { + "type": "String" + }, + "description": { + "type": "String" + } + }, + "relations": { + "user": { + "type": "belongsTo", + "model": "Account", + "foreignKey": "userFk" + } + }, + "scope": { + "order": ["creationDate DESC", "id DESC"] + } +} \ No newline at end of file diff --git a/modules/supplier/back/models/supplier.json b/modules/supplier/back/models/supplier.json index f0bcd7df8..596aad745 100644 --- a/modules/supplier/back/models/supplier.json +++ b/modules/supplier/back/models/supplier.json @@ -1,6 +1,9 @@ { "name": "Supplier", - "base": "VnModel", + "base": "Loggable", + "log": { + "model":"SupplierLog" + }, "options": { "mysql": { "table": "supplier" diff --git a/modules/supplier/front/index.js b/modules/supplier/front/index.js index 46db8774d..a4017bbd9 100644 --- a/modules/supplier/front/index.js +++ b/modules/supplier/front/index.js @@ -1,10 +1,9 @@ export * from './module'; import './main'; -import './index/'; -import './search-panel'; -import './summary'; import './card'; import './descriptor'; -import './fiscal-data'; - +import './index/'; +import './search-panel'; +import './log'; +import './summary'; diff --git a/modules/supplier/front/log/index.html b/modules/supplier/front/log/index.html new file mode 100644 index 000000000..7895b585e --- /dev/null +++ b/modules/supplier/front/log/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/modules/supplier/front/log/index.js b/modules/supplier/front/log/index.js new file mode 100644 index 000000000..52a491c70 --- /dev/null +++ b/modules/supplier/front/log/index.js @@ -0,0 +1,7 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +ngModule.vnComponent('vnSupplierLog', { + template: require('./index.html'), + controller: Section, +}); diff --git a/modules/supplier/front/routes.json b/modules/supplier/front/routes.json index 2e32ad985..d1f0701a1 100644 --- a/modules/supplier/front/routes.json +++ b/modules/supplier/front/routes.json @@ -10,7 +10,8 @@ ], "card": [ {"state": "supplier.card.basicData", "icon": "settings"}, - {"state": "supplier.card.fiscalData", "icon": "account_balance"} + {"state": "supplier.card.fiscalData", "icon": "account_balance"}, + {"state": "supplier.card.log", "icon": "history"} ] }, "routes": [ @@ -54,6 +55,11 @@ "params": { "supplier": "$ctrl.supplier" } + }, { + "url" : "/log", + "state": "supplier.card.log", + "component": "vn-supplier-log", + "description": "Log" } ] } \ No newline at end of file diff --git a/modules/ticket/back/methods/ticket-request/confirm.js b/modules/ticket/back/methods/ticket-request/confirm.js index 67781c6c2..b80971183 100644 --- a/modules/ticket/back/methods/ticket-request/confirm.js +++ b/modules/ticket/back/methods/ticket-request/confirm.js @@ -83,7 +83,7 @@ module.exports = Self => { }); await models.Chat.sendCheckingPresence(ctx, requesterId, message); - // loguejar + // log let logRecord = { originFk: sale.ticketFk, userFk: userId, diff --git a/modules/ticket/back/methods/ticket-request/specs/confirm.spec.js b/modules/ticket/back/methods/ticket-request/specs/confirm.spec.js index bef6ad706..2068fdfdd 100644 --- a/modules/ticket/back/methods/ticket-request/specs/confirm.spec.js +++ b/modules/ticket/back/methods/ticket-request/specs/confirm.spec.js @@ -1,7 +1,6 @@ const app = require('vn-loopback/server/server'); -// #2512 confirm.spec pollutes other tests -xdescribe('ticket-request confirm()', () => { +describe('ticket-request confirm()', () => { let ctx = { req: { accessToken: {userId: 9}, @@ -83,37 +82,4 @@ xdescribe('ticket-request confirm()', () => { // restores await request.updateAttributes({saleFk: null}); }); - - it(`should create a new sale for the the request if there's no sale id`, async() => { - const requestId = 4; - const itemId = 1; - const quantity = 10; - - const originalRequest = await app.models.TicketRequest.findById(requestId); - - ctx.args = { - itemFk: itemId, - id: requestId, - quantity: quantity - }; - - const request = await app.models.TicketRequest.findById(requestId); - await request.updateAttributes({saleFk: null}); - await app.models.TicketRequest.confirm(ctx); - - const updatedRequest = await app.models.TicketRequest.findById(requestId); - const createdSaleId = updatedRequest.saleFk; - - expect(updatedRequest.saleFk).toEqual(createdSaleId); - expect(updatedRequest.isOk).toEqual(true); - expect(updatedRequest.itemFk).toEqual(itemId); - - // restores - await originalRequest.updateAttributes(originalRequest); - await app.models.Sale.destroyById(createdSaleId); - - await app.models.Item.rawSql(` - TRUNCATE TABLE cache.last_buy - `); - }); }); diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js index 6b1db9e6d..ab9bd0033 100644 --- a/modules/worker/front/time-control/index.js +++ b/modules/worker/front/time-control/index.js @@ -203,8 +203,6 @@ class Controller extends Section { } set weekTotalHours(totalHours) { - if (!totalHours) return this._weekTotalHours = this.formatHours(0); - this._weekTotalHours = this.formatHours(totalHours); } @@ -212,9 +210,7 @@ class Controller extends Section { return this._weekTotalHours; } - formatHours(timestamp) { - timestamp = timestamp || 0; - + formatHours(timestamp = 0) { let hour = Math.floor(timestamp / 3600); let min = Math.floor(timestamp / 60 - 60 * hour);