From 6c682875a088ba62dd591374d29867cc55c2abc9 Mon Sep 17 00:00:00 2001 From: Joan Date: Mon, 3 Sep 2018 13:54:18 +0200 Subject: [PATCH 1/2] mailer css removed justify text. Fixed chrome image content-type. --- client/client/src/sample/create/index.html | 2 +- services/mailer/application/router.js | 21 ++++++++++++++++++++- services/mailer/static/css/component.css | 4 ---- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/client/client/src/sample/create/index.html b/client/client/src/sample/create/index.html index 8fdcce50c..744ef02f1 100644 --- a/client/client/src/sample/create/index.html +++ b/client/client/src/sample/create/index.html @@ -14,7 +14,7 @@ vn-id="sampleType" field="$ctrl.clientSample.typeFk" model="ClientSample.typeFk" - select-fields="['id','description','code','hasCompany']" + select-fields="['code','hasCompany']" url="/client/api/Samples" show-field="description" value-field="id" diff --git a/services/mailer/application/router.js b/services/mailer/application/router.js index 161271820..c8e32b564 100644 --- a/services/mailer/application/router.js +++ b/services/mailer/application/router.js @@ -20,11 +20,30 @@ router.use('/static/:template/:image', function(request, response) { return response.json({message: 'Image not found'}); let readStream = fs.createReadStream(imagePath); - + readStream.on('open', function() { + let contentType = getContentType(imagePath); + + if (contentType) + response.setHeader('Content-type', getContentType(imagePath)); + readStream.pipe(response); }); }); }); +function getContentType(path) { + let types = { + png: 'image/png', + svg: 'image/svg+xml', + gif: 'image/gif', + jpeg: 'image/jpeg', + jpg: 'image/jpeg' + }; + + let extension = path.split('.')[1]; + + return types[extension]; +} + module.exports = router; diff --git a/services/mailer/static/css/component.css b/services/mailer/static/css/component.css index b4c018d79..2621048c3 100644 --- a/services/mailer/static/css/component.css +++ b/services/mailer/static/css/component.css @@ -7,10 +7,6 @@ img { margin: 0 } -p { - text-align: justify -} - .wrapper { background-color: #EEE } From 267478321892ec793a4d2b41eedfe0d06f094b80 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Mon, 3 Sep 2018 13:54:35 +0200 Subject: [PATCH 2/2] #605 e2e ticket.basicData --- e2e/helpers/selectors.js | 14 +- .../06_edit_basic_data_steps.spec.js | 150 ++++++++++++++++++ 2 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index a11a23a88..8321a97f5 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -319,7 +319,19 @@ export default { secondSaleText: `vn-table div > vn-tbody > vn-tr:nth-child(2)` }, ticketBasicData: { - basicDataButton: `vn-menu-item a[ui-sref="ticket.card.data.stepOne"]` + basicDataButton: `vn-menu-item a[ui-sref="ticket.card.data.stepOne"]`, + clientSelect: `vn-autocomplete[field="$ctrl.clientFk"] input`, + clientSelectThirdOption: `vn-autocomplete[field="$ctrl.clientFk"] vn-drop-down ul > li:nth-child(3)`, + addressSelect: `vn-autocomplete[field="$ctrl.ticket.addressFk"] input`, + addressSelectSecondOption: `vn-autocomplete[field="$ctrl.ticket.addressFk"] vn-drop-down ul > li:nth-child(2)`, + agencySelect: `vn-autocomplete[field="$ctrl.ticket.agencyModeFk"] input`, + agencySelectFifthOption: `vn-autocomplete[field="$ctrl.ticket.agencyModeFk"] vn-drop-down ul > li:nth-child(5)`, + nextStepButton: `vn-step-control > section > section.buttons > section:nth-child(2) > vn-button`, + finalizeButton: `vn-step-control > section > section.buttons > section:nth-child(2) > vn-submit`, + stepTwoTotalPriceDif: `vn-ticket-data-step-two > form > vn-card > div > vn-horizontal > table > tfoot > tr > td:nth-child(4)`, + chargesReason: `vn-autocomplete[field="$ctrl.ticket.option"] input`, + chargesReasonFourthOption: `vn-autocomplete[field="$ctrl.ticket.option"] vn-drop-down ul > li:nth-child(4)`, + chargesReasonFirstOption: `vn-autocomplete[field="$ctrl.ticket.option"] vn-drop-down ul > li:nth-child(1)` }, createStateView: { stateInput: `vn-autocomplete[field="$ctrl.ticket.stateFk"] > div > div > input`, diff --git a/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js b/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js new file mode 100644 index 000000000..cbd36d107 --- /dev/null +++ b/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js @@ -0,0 +1,150 @@ +import selectors from '../../helpers/selectors.js'; +import createNightmare from '../../helpers/helpers'; + +describe('Ticket', () => { + describe('Edit basic data path', () => { + const nightmare = createNightmare(); + + beforeAll(() => { + return nightmare + .waitForLogin('developer'); + }); + + it('should click on the Tickets button of the top bar menu', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.ticketsButton) + .wait(selectors.ticketsIndex.createTicketButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/ticket/index'); + }); + }); + + it('should search for the ticket 11', () => { + return nightmare + .wait(selectors.ticketsIndex.searchResult) + .type(selectors.ticketsIndex.searchTicketInput, 'id:11') + .click(selectors.ticketsIndex.searchButton) + .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) + .countElement(selectors.ticketsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); + }); + + it(`should click on the search result to access to the ticket Basic Data`, () => { + return nightmare + .waitForTextInElement(selectors.ticketsIndex.searchResult, 'ticket 1') // should be Bruce Wayne + .waitToClick(selectors.ticketsIndex.searchResult) + .waitToClick(selectors.ticketBasicData.basicDataButton) + .waitForURL('data/step-one') + .url() + .then(url => { + expect(url).toContain('data/step-one'); + }); + }); + + it(`should edit the client and address of the ticket then click next`, () => { + return nightmare + .waitToClick(selectors.ticketBasicData.clientSelect) + .waitToClick(selectors.ticketBasicData.clientSelectThirdOption) + .wait(500) + .waitToClick(selectors.ticketBasicData.addressSelect) + .waitToClick(selectors.ticketBasicData.addressSelectSecondOption) + .waitForTextInInput(selectors.ticketBasicData.addressSelect, 'Charles') + .click(selectors.ticketBasicData.nextStepButton) + .waitForURL('data/step-two') + .url() + .then(url => { + expect(url).toContain('data/step-two'); + }); + }); + + it(`should have no price diference`, () => { + return nightmare + .getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif) + .then(result => { + expect(result).toContain('0'); + }); + }); + + it(`should click next to move on to step three`, () => { + return nightmare + .click(selectors.ticketBasicData.nextStepButton) + .waitForURL('data/step-three') + .url() + .then(url => { + expect(url).toContain('data/step-three'); + }); + }); + + it(`should select a reason for the changes made then click on finalize`, () => { + return nightmare + .waitToClick(selectors.ticketBasicData.chargesReason) + .waitToClick(selectors.ticketBasicData.chargesReasonFourthOption) + .waitForTextInInput(selectors.ticketBasicData.chargesReason, 'No realizar modificaciones en precios') + .click(selectors.ticketBasicData.finalizeButton) + .waitForURL('summary') + .url() + .then(url => { + expect(url).toContain('summary'); + }); + }); + + it(`should go back to ticket.basicData section`, () => { + return nightmare + .waitToClick(selectors.ticketBasicData.basicDataButton) + .waitForURL('data/step-one') + .url() + .then(url => { + expect(url).toContain('data/step-one'); + }); + }); + + it(`should edit the ticket agency then click next`, () => { + return nightmare + .waitToClick(selectors.ticketBasicData.agencySelect) + .waitToClick(selectors.ticketBasicData.agencySelectFifthOption) + .waitForTextInInput(selectors.ticketBasicData.agencySelect, 'Expensive') + .click(selectors.ticketBasicData.nextStepButton) + .waitForURL('data/step-two') + .url() + .then(url => { + expect(url).toContain('data/step-two'); + }); + }); + + it(`should have a price diference`, () => { + return nightmare + .getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif) + .then(result => { + expect(result).toContain('-€206.60'); + }); + }); + + it(`should then click next to move on to step three`, () => { + return nightmare + .click(selectors.ticketBasicData.nextStepButton) + .waitForURL('data/step-three') + .url() + .then(url => { + expect(url).toContain('data/step-three'); + }); + }); + + it(`should select a new reason for the changes made then click on finalize`, () => { + return nightmare + .waitToClick(selectors.ticketBasicData.chargesReason) + .waitToClick(selectors.ticketBasicData.chargesReasonFirstOption) + .waitForTextInInput(selectors.ticketBasicData.chargesReason, 'Cambiar los precios en el ticket') + .click(selectors.ticketBasicData.finalizeButton) + .waitForURL('summary') + .url() + .then(url => { + expect(url).toContain('summary'); + }); + }); + }); +});