From 11bd861224e8aaaef3d708046f91d5259376692a Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 6 Mar 2020 09:57:05 +0100 Subject: [PATCH 1/3] section bases --- modules/entry/front/buy/index.html | 68 +++++++++++++++++++++++++++ modules/entry/front/buy/index.js | 35 ++++++++++++++ modules/entry/front/buy/locale/es.yml | 1 + modules/entry/front/index.js | 1 + modules/entry/front/routes.json | 11 ++++- 5 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 modules/entry/front/buy/index.html create mode 100644 modules/entry/front/buy/index.js create mode 100644 modules/entry/front/buy/locale/es.yml diff --git a/modules/entry/front/buy/index.html b/modules/entry/front/buy/index.html new file mode 100644 index 000000000..af9eae30c --- /dev/null +++ b/modules/entry/front/buy/index.html @@ -0,0 +1,68 @@ + +
Entry #{{$ctrl.entryData.id}} - {{$ctrl.entryData.supplier.nickname}}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/modules/entry/front/buy/index.js b/modules/entry/front/buy/index.js new file mode 100644 index 000000000..36e353229 --- /dev/null +++ b/modules/entry/front/buy/index.js @@ -0,0 +1,35 @@ +import ngModule from '../module'; +import Component from 'core/lib/component'; + +class Controller extends Component { + constructor($element, $) { + super($element, $); + } + + get entry() { + return this._entry; + } + + set entry(value) { + this._entry = value; + + if (value && value.id) + this.getEntryData(); + } + + getEntryData() { + return this.$http.get(`/api/Entries/${this.entry.id}/getEntry`).then(response => { + this.entryData = response.data; + }); + } +} + +Controller.$inject = ['$element', '$scope']; + +ngModule.component('vnEntryBuy', { + template: require('./index.html'), + controller: Controller, + bindings: { + entry: '<' + } +}); diff --git a/modules/entry/front/buy/locale/es.yml b/modules/entry/front/buy/locale/es.yml new file mode 100644 index 000000000..8f2be1e44 --- /dev/null +++ b/modules/entry/front/buy/locale/es.yml @@ -0,0 +1 @@ +Buy: Lineas de entrada \ No newline at end of file diff --git a/modules/entry/front/index.js b/modules/entry/front/index.js index 0679b946b..f0c845b14 100644 --- a/modules/entry/front/index.js +++ b/modules/entry/front/index.js @@ -7,3 +7,4 @@ import './descriptor'; import './card'; import './summary'; import './log'; +import './buy'; diff --git a/modules/entry/front/routes.json b/modules/entry/front/routes.json index 92d893044..3dff61641 100644 --- a/modules/entry/front/routes.json +++ b/modules/entry/front/routes.json @@ -9,7 +9,8 @@ {"state": "entry.index", "icon": "icon-entry"} ], "card": [ - {"state": "entry.card.log", "icon": "history"} + {"state": "entry.card.log", "icon": "history"}, + {"state": "entry.card.buy", "icon": "icon-lines"} ] }, "routes": [ @@ -42,6 +43,14 @@ "state": "entry.card.log", "component": "vn-entry-log", "description": "Log" + }, { + "url" : "/buy", + "state": "entry.card.buy", + "component": "vn-entry-buy", + "description": "Buy", + "params": { + "entry": "$ctrl.entry" + } } ] } \ No newline at end of file From 5f0ace8f29a8565e86d6324aa4a8790ef394900f Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 6 Mar 2020 10:21:42 +0100 Subject: [PATCH 2/3] removed unused code --- modules/entry/front/buy/index.html | 69 +----------------------------- modules/entry/front/buy/index.js | 17 -------- modules/entry/front/routes.json | 4 +- 3 files changed, 3 insertions(+), 87 deletions(-) diff --git a/modules/entry/front/buy/index.html b/modules/entry/front/buy/index.html index af9eae30c..8b1378917 100644 --- a/modules/entry/front/buy/index.html +++ b/modules/entry/front/buy/index.html @@ -1,68 +1 @@ - -
Entry #{{$ctrl.entryData.id}} - {{$ctrl.entryData.supplier.nickname}}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ diff --git a/modules/entry/front/buy/index.js b/modules/entry/front/buy/index.js index 36e353229..bc8788239 100644 --- a/modules/entry/front/buy/index.js +++ b/modules/entry/front/buy/index.js @@ -5,23 +5,6 @@ class Controller extends Component { constructor($element, $) { super($element, $); } - - get entry() { - return this._entry; - } - - set entry(value) { - this._entry = value; - - if (value && value.id) - this.getEntryData(); - } - - getEntryData() { - return this.$http.get(`/api/Entries/${this.entry.id}/getEntry`).then(response => { - this.entryData = response.data; - }); - } } Controller.$inject = ['$element', '$scope']; diff --git a/modules/entry/front/routes.json b/modules/entry/front/routes.json index 3dff61641..084ff7bb2 100644 --- a/modules/entry/front/routes.json +++ b/modules/entry/front/routes.json @@ -9,8 +9,8 @@ {"state": "entry.index", "icon": "icon-entry"} ], "card": [ - {"state": "entry.card.log", "icon": "history"}, - {"state": "entry.card.buy", "icon": "icon-lines"} + {"state": "entry.card.buy", "icon": "icon-lines"}, + {"state": "entry.card.log", "icon": "history"} ] }, "routes": [ From ec97ab3e21a831eb97c0b1c638c1c997882bb43b Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Mon, 9 Mar 2020 16:47:02 +0100 Subject: [PATCH 3/3] log with narrow and wide widths --- e2e/helpers/selectors.js | 1 + e2e/paths/02-client/14_balance.spec.js | 3 +- e2e/paths/05-ticket/17_log.spec.js | 65 ++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 e2e/paths/05-ticket/17_log.spec.js diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 284945241..2131704ab 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -525,6 +525,7 @@ export default { }, ticketLog: { + firstTD: 'vn-ticket-log vn-table vn-td:nth-child(1)', logButton: 'vn-left-menu a[ui-sref="ticket.card.log"]', changedBy: 'vn-ticket-log > vn-log vn-tr:nth-child(1) > vn-td:nth-child(2) > span', actionTaken: 'vn-ticket-log > vn-log vn-td:nth-child(1) > div > div:nth-child(3) > span.value', diff --git a/e2e/paths/02-client/14_balance.spec.js b/e2e/paths/02-client/14_balance.spec.js index f45937deb..0d020831e 100644 --- a/e2e/paths/02-client/14_balance.spec.js +++ b/e2e/paths/02-client/14_balance.spec.js @@ -35,7 +35,7 @@ describe('Client balance path', () => { await page.clearInput(selectors.globalItems.userConfigThirdAutocomplete); let result = await page.waitForLastSnackbar(); - expect(result).toEqual('Data saved!'); + expect(result).toContain('Data saved!'); }); it('should click the new payment button', async() => { @@ -63,7 +63,6 @@ describe('Client balance path', () => { let firstBalanceLine = await page .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText'); - expect(company).toEqual('VNL'); expect(firstBalanceLine).toContain('0.00'); }); diff --git a/e2e/paths/05-ticket/17_log.spec.js b/e2e/paths/05-ticket/17_log.spec.js new file mode 100644 index 000000000..2008d022e --- /dev/null +++ b/e2e/paths/05-ticket/17_log.spec.js @@ -0,0 +1,65 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Ticket log path', () => { + let browser; + let page; + const ticketId = '5'; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should navigate to the target ticket notes section', async() => { + await page.loginAndModule('employee', 'ticket'); + await page.accessToSearchResult(ticketId); + await page.accessToSection('ticket.card.observation'); + let url = await page.expectURL('/observation'); + + expect(url).toBe(true); + }); + + it('should create a new note for the test', async() => { + await page.waitToClick(selectors.ticketNotes.addNoteButton); + await page.autocompleteSearch(selectors.ticketNotes.firstNoteType, 'observation one'); + await page.write(selectors.ticketNotes.firstDescription, 'description'); + await page.waitToClick(selectors.ticketNotes.submitNotesButton); + const result = await page.waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should navigate to the log section', async() => { + await page.accessToSection('ticket.card.log'); + let url = await page.expectURL('/log'); + + expect(url).toBe(true); + }); + + it('should set the viewport width to 1920 to see the table full width', async() => { + await page.setViewport({ + width: 1920, + height: 0, + }); + + const result = await page.waitToGetProperty(selectors.ticketLog.firstTD, 'innerText'); + + expect(result.length).not.toBeGreaterThan('20'); + }); + + it('should set the viewport width to 800 to see the table shrink and move data to the 1st column', async() => { + await page.setViewport({ + width: 800, + height: 0, + }); + + const result = await page.waitToGetProperty(selectors.ticketLog.firstTD, 'innerText'); + + expect(result.length).toBeGreaterThan('20'); + }); +});