#1334 E2E ticket.descriptor - Make invoice

This commit is contained in:
Carlos Jimenez Ruiz 2019-04-23 08:58:49 +02:00
parent 0176fbc2d5
commit 2b04eebe84
5 changed files with 51 additions and 12 deletions

View File

@ -301,7 +301,8 @@ export default {
firstSaleItemId: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span', firstSaleItemId: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span',
popoverDiaryButton: 'vn-ticket-summary vn-item-descriptor-popover vn-item-descriptor vn-icon[icon="icon-transaction"]', popoverDiaryButton: 'vn-ticket-summary vn-item-descriptor-popover vn-item-descriptor vn-icon[icon="icon-transaction"]',
firstSaleQuantity: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3)', firstSaleQuantity: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3)',
firstSaleDiscount: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6)' firstSaleDiscount: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6)',
invoiceOutRef: 'vn-ticket-summary > vn-card > div > vn-horizontal > vn-one:nth-child(1) > vn-label-value:nth-child(6) > section > span'
}, },
ticketsIndex: { ticketsIndex: {
newTicketButton: 'vn-ticket-index > a', newTicketButton: 'vn-ticket-index > a',
@ -326,10 +327,11 @@ export default {
}, },
ticketDescriptor: { ticketDescriptor: {
moreMenu: `vn-ticket-descriptor vn-icon-menu > div > vn-icon`, moreMenu: `vn-ticket-descriptor vn-icon-menu > div > vn-icon`,
moreMenuAddStowaway: `vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(1)`, moreMenuAddStowaway: `vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(1)`,
moreMenuDeleteStowawayButton: 'vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(5)', moreMenuDeleteStowawayButton: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(5)',
moreMenuAddToTurn: `vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(2)`, moreMenuAddToTurn: `vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(2)`,
moreMenuDeleteTicket: `vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(3)`, moreMenuDeleteTicket: `vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(3)`,
moreMenuMakeInvoice: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(5)',
addStowawayDialogSecondTicket: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog vn-table vn-tr:nth-child(2)', addStowawayDialogSecondTicket: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog vn-table vn-tr:nth-child(2)',
shipSelectButton: 'vn-ticket-descriptor > div > div.body > div.quicklinks > vn-button-menu[icon="icon-stowaway"]', shipSelectButton: 'vn-ticket-descriptor > div > div.body > div.quicklinks > vn-button-menu[icon="icon-stowaway"]',
shipButton: 'vn-ticket-descriptor > div > div.body > div.quicklinks vn-icon[icon="icon-stowaway"]', shipButton: 'vn-ticket-descriptor > div > div.body > div.quicklinks vn-icon[icon="icon-stowaway"]',
@ -338,6 +340,7 @@ export default {
saturdayButton: `vn-ticket-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-tool-bar > vn-button:nth-child(6)`, saturdayButton: `vn-ticket-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-tool-bar > vn-button:nth-child(6)`,
closeStowawayDialog: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog > div > button[class="close"]', closeStowawayDialog: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog > div > button[class="close"]',
acceptDeleteButton: 'vn-ticket-descriptor button[response="ACCEPT"]', acceptDeleteButton: 'vn-ticket-descriptor button[response="ACCEPT"]',
acceptInvoiceOutButton: 'vn-ticket-descriptor vn-confirm[vn-id="invoiceMakeConfirmation"] button[response="ACCEPT"]',
acceptDeleteStowawayButton: 'vn-ticket-descriptor > vn-remove-stowaway button[response="ACCEPT"]' acceptDeleteStowawayButton: 'vn-ticket-descriptor > vn-remove-stowaway button[response="ACCEPT"]'
}, },
ticketNotes: { ticketNotes: {

View File

@ -148,4 +148,43 @@ describe('Ticket descriptor path', () => {
expect(exists).toBeFalsy(); expect(exists).toBeFalsy();
}); });
}); });
describe('Make invoice', () => {
it('should login as Invoicing role then search for a ticket', async() => {
const invoiceableTicketId = 11;
const url = await nightmare
.loginAndModule('developer', 'ticket')
.accessToSearchResult(invoiceableTicketId)
.waitForURL('/summary')
.parsedUrl();
expect(url.hash).toContain(`ticket/${invoiceableTicketId}/summary`);
});
it(`should make sure the ticket doesn't have an invoiceOutFk yet`, async() => {
const result = await nightmare
.waitToGetProperty(selectors.ticketSummary.invoiceOutRef, 'innerText');
expect(result).toEqual('-');
});
it('should invoice the ticket using the descriptor more menu', async() => {
const result = await nightmare
.waitToClick(selectors.ticketDescriptor.moreMenu)
.waitToClick(selectors.ticketDescriptor.moreMenuMakeInvoice)
.waitToClick(selectors.ticketDescriptor.acceptInvoiceOutButton)
.waitForLastSnackbar();
expect(result).toEqual('Ticket invoiced');
});
it(`should make sure the ticket summary have an invoiceOutFk`, async() => {
const result = await nightmare
.waitForTextInElement(selectors.ticketSummary.invoiceOutRef, 'T4444445')
.waitToGetProperty(selectors.ticketSummary.invoiceOutRef, 'innerText');
expect(result).toEqual('T4444445');
});
});
}); });

View File

@ -41,5 +41,6 @@
"City cannot be empty": "City cannot be empty", "City cannot be empty": "City cannot be empty",
"EXTENSION_INVALID_FORMAT": "Invalid extension", "EXTENSION_INVALID_FORMAT": "Invalid extension",
"The secret can't be blank": "The secret can't be blank", "The secret can't be blank": "The secret can't be blank",
"Invalid TIN": "Invalid Tax number" "Invalid TIN": "Invalid Tax number",
"This ticket can't be invoiced": "This ticket can't be invoiced"
} }

View File

@ -160,7 +160,6 @@
on-response="$ctrl.returnDialog(response)" on-response="$ctrl.returnDialog(response)"
question="Pickup order" question="Pickup order"
message="Do you want to send it directly?"> message="Do you want to send it directly?">
<tpl-buttons>asd</tpl-buttons>
</vn-confirm> </vn-confirm>
<vn-dialog <vn-dialog
vn-id="changeShippedDialog" vn-id="changeShippedDialog"
@ -182,7 +181,7 @@
<!-- Make invoice dialog --> <!-- Make invoice dialog -->
<vn-confirm <vn-confirm
vn-id="invoiceMakeConfirmation" vn-id="invoiceMakeConfirmation"
on-response="$ctrl.invoiceMakeOut(response)" on-response="$ctrl.makeInvoiceOut(response)"
question="You are going to invoice this ticket" question="You are going to invoice this ticket"
message="Are you sure you want to invoice this ticket?"> message="Are you sure you want to invoice this ticket?">
</vn-confirm> </vn-confirm>

View File

@ -21,7 +21,6 @@ class Controller {
]; ];
} }
// Change shipped hour
showChangeShipped() { showChangeShipped() {
if (!this.isEditable) { if (!this.isEditable) {
this.vnApp.showError(this.$translate.instant('This ticket can\'t be modified')); this.vnApp.showError(this.$translate.instant('This ticket can\'t be modified'));
@ -84,7 +83,6 @@ class Controller {
return true; return true;
} }
// Add Turn
showAddTurnDialog() { showAddTurnDialog() {
this.$scope.addTurn.show(); this.$scope.addTurn.show();
} }
@ -97,7 +95,6 @@ class Controller {
}); });
} }
// Delete Ticket
showDeleteTicketDialog() { showDeleteTicketDialog() {
if (!this.isEditable) { if (!this.isEditable) {
this.vnApp.showError(this.$translate.instant('This ticket cant be deleted')); this.vnApp.showError(this.$translate.instant('This ticket cant be deleted'));
@ -202,7 +199,7 @@ class Controller {
* *
* @param {String} response - Response result * @param {String} response - Response result
*/ */
invoiceMakeOut(response) { makeInvoiceOut(response) {
if (response === 'ACCEPT') { if (response === 'ACCEPT') {
const query = `/ticket/api/Tickets/${this.ticket.id}/makeInvoice`; const query = `/ticket/api/Tickets/${this.ticket.id}/makeInvoice`;
this.$http.post(query).then(() => { this.$http.post(query).then(() => {