salix/e2e/paths/05-ticket-module/01-sale/02_edit_sale.spec.js

518 lines
20 KiB
JavaScript
Raw Normal View History

2019-09-06 09:43:15 +00:00
import selectors from '../../../helpers/selectors.js';
import createNightmare from '../../../helpers/nightmare';
// #1632 [e2e] ticket.sale - Transferir líneas
xdescribe('Ticket Edit sale path', () => {
const nightmare = createNightmare();
beforeAll(() => {
2018-11-07 07:38:09 +00:00
nightmare
.loginAndModule('salesPerson', 'ticket')
2019-06-27 06:41:07 +00:00
.accessToSearchResult(16)
.accessToSection('ticket.card.sale');
2018-11-07 07:38:09 +00:00
});
2019-06-27 06:41:07 +00:00
it(`should click on the first sale claim icon to navigate over there`, async() => {
2018-11-07 07:38:09 +00:00
const url = await nightmare
2019-06-27 06:41:07 +00:00
.waitToClick(selectors.ticketSales.firstSaleClaimIcon)
2019-01-07 08:33:07 +00:00
.wait(selectors.claimBasicData.claimStateAutocomplete)
2018-11-07 07:38:09 +00:00
.parsedUrl();
expect(url.hash).toEqual('#!/claim/2/basic-data');
});
2019-06-27 06:41:07 +00:00
it('should navigate to the tickets index', async() => {
2018-11-07 07:38:09 +00:00
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchTicketInput)
2018-11-07 07:38:09 +00:00
.parsedUrl();
expect(url.hash).toEqual('#!/ticket/index');
});
2019-06-27 06:41:07 +00:00
it(`should search for a ticket and then navigate to it's sales`, async() => {
2018-11-07 07:38:09 +00:00
const url = await nightmare
2019-06-27 06:41:07 +00:00
.accessToSearchResult(16)
.accessToSection('ticket.card.sale')
2018-10-25 14:44:03 +00:00
.waitForURL('/sale')
.parsedUrl();
2018-11-07 07:38:09 +00:00
expect(url.hash).toContain('/sale');
2018-10-25 14:44:03 +00:00
});
2019-06-27 06:41:07 +00:00
it(`should check the zoomed image isn't present`, async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
.countElement(selectors.ticketSales.firstSaleZoomedImage);
expect(result).toEqual(0);
2018-10-25 14:44:03 +00:00
});
2019-01-07 08:33:07 +00:00
it(`should click on the thumbnail image of the 1st sale and see the zoomed image`, async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-02-04 13:47:55 +00:00
.clickIfVisible(selectors.ticketSales.firstSaleThumbnailImage)
2018-11-07 07:38:09 +00:00
.countElement(selectors.ticketSales.firstSaleZoomedImage);
expect(result).toEqual(1);
});
2019-01-07 08:33:07 +00:00
it(`should click on the zoomed image to close it`, async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-02-04 13:47:55 +00:00
.clickIfVisible(selectors.ticketSales.firstSaleZoomedImage)
2018-11-07 07:38:09 +00:00
.countElement(selectors.ticketSales.firstSaleZoomedImage);
expect(result).toEqual(0);
});
2019-01-07 08:33:07 +00:00
it(`should confirm the item descriptor insnt visible yet`, async() => {
2018-11-07 07:38:09 +00:00
const visible = await nightmare
.isVisible(selectors.ticketSales.saleDescriptorPopover);
expect(visible).toBeFalsy();
});
2019-01-07 08:33:07 +00:00
it(`should click on the first sale ID making the item descriptor visible`, async() => {
2018-11-07 07:38:09 +00:00
const visible = await nightmare
2019-09-06 09:43:15 +00:00
.waitToClick(selectors.ticketSales.firstSaleId)
2019-02-07 08:07:00 +00:00
.waitImgLoad(selectors.ticketSales.firstSaleDescriptorImage)
2018-11-07 07:38:09 +00:00
.isVisible(selectors.ticketSales.saleDescriptorPopover);
expect(visible).toBeTruthy();
});
2019-01-07 08:33:07 +00:00
it(`should click on the descriptor image of the 1st sale and see the zoomed image`, async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-02-04 13:47:55 +00:00
.clickIfVisible('vn-item-descriptor img')
2018-11-07 07:38:09 +00:00
.countElement(selectors.ticketSales.firstSaleZoomedImage);
expect(result).toEqual(1);
});
2019-02-04 14:40:57 +00:00
it(`should now click on the zoomed image to close it`, async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-02-04 13:47:55 +00:00
.clickIfVisible(selectors.ticketSales.firstSaleZoomedImage)
2018-11-07 07:38:09 +00:00
.countElement(selectors.ticketSales.firstSaleZoomedImage);
expect(result).toEqual(0);
});
2019-01-07 08:33:07 +00:00
it(`should click on the summary icon of the item-descriptor to access to the item summary`, async() => {
2018-11-07 07:38:09 +00:00
const url = await nightmare
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.ticketSales.saleDescriptorPopoverSummaryButton)
.waitForURL('/summary')
.parsedUrl();
2018-11-07 07:38:09 +00:00
expect(url.hash).toContain('/summary');
});
2019-01-07 08:33:07 +00:00
it('should return to ticket sales section', async() => {
2018-11-07 07:38:09 +00:00
const url = await nightmare
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
2019-06-27 06:41:07 +00:00
.accessToSearchResult(16)
.accessToSection('ticket.card.sale')
2018-10-25 14:44:03 +00:00
.waitForURL('/sale')
.parsedUrl();
2018-11-07 07:38:09 +00:00
expect(url.hash).toContain('/sale');
});
2019-01-07 08:33:07 +00:00
it('should try to add a higher quantity value and then receive an error', async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-06-27 06:41:07 +00:00
.focusElement(selectors.ticketSales.firstSaleQuantityCell)
.write(selectors.ticketSales.firstSaleQuantity, '11\u000d')
2018-11-07 07:38:09 +00:00
.waitForLastSnackbar();
expect(result).toEqual('The new quantity should be smaller than the old one');
});
2019-06-27 06:41:07 +00:00
it('should remove 1 from the first sale quantity', async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-06-27 06:41:07 +00:00
.focusElement(selectors.ticketSales.firstSaleQuantityCell)
.write(selectors.ticketSales.firstSaleQuantity, '9\u000d')
2018-11-07 07:38:09 +00:00
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
2019-01-07 08:33:07 +00:00
it('should update the price', async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-06-27 06:41:07 +00:00
.waitToClick(`${selectors.ticketSales.firstSalePrice} > span`)
2019-02-19 11:28:39 +00:00
.write(selectors.ticketSales.firstSalePriceInput, '5\u000d')
2018-11-07 07:38:09 +00:00
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
2019-01-07 08:33:07 +00:00
it('should confirm the price have been updated', async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-06-27 06:41:07 +00:00
.waitToGetProperty(`${selectors.ticketSales.firstSalePrice} span`, 'innerText');
2018-11-07 07:38:09 +00:00
expect(result).toContain('5.00');
});
2019-01-07 08:33:07 +00:00
it('should confirm the total price for that item have been updated', async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
2018-11-07 07:38:09 +00:00
2019-06-27 06:41:07 +00:00
expect(result).toContain('45.00');
});
2019-01-07 08:33:07 +00:00
it('should update the discount', async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-06-27 06:41:07 +00:00
.waitToClick(`${selectors.ticketSales.firstSaleDiscount} > span`)
2019-02-19 11:28:39 +00:00
.write(selectors.ticketSales.firstSaleDiscountInput, '50\u000d')
2018-11-07 07:38:09 +00:00
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
2019-01-07 08:33:07 +00:00
it('should confirm the discount have been updated', async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-06-27 06:41:07 +00:00
.waitForTextInElement(`${selectors.ticketSales.firstSaleDiscount} > span`, '50 %')
.waitToGetProperty(`${selectors.ticketSales.firstSaleDiscount} > span`, 'innerText');
2018-11-07 07:38:09 +00:00
expect(result).toContain('50 %');
2018-10-25 14:44:03 +00:00
});
2019-01-07 08:33:07 +00:00
it('should confirm the total import for that item have been updated', async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-06-27 06:41:07 +00:00
.waitForTextInElement(selectors.ticketSales.firstSaleImport, '22.50')
.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
2018-11-07 07:38:09 +00:00
2019-06-27 06:41:07 +00:00
expect(result).toContain('22.50');
2018-10-25 14:44:03 +00:00
});
2019-01-07 08:33:07 +00:00
it('should select the third sale and create a claim of it', async() => {
2018-11-07 07:38:09 +00:00
const url = await nightmare
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.ticketSales.thirdSaleCheckbox)
2019-06-27 06:41:07 +00:00
.waitToClick(selectors.ticketSales.moreMenu)
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.ticketSales.moreMenuCreateClaim)
2019-01-07 08:33:07 +00:00
.wait(selectors.claimBasicData.claimStateAutocomplete)
2018-11-07 07:38:09 +00:00
.parsedUrl();
2019-06-27 06:41:07 +00:00
expect(url.hash).toContain('basic-data');
});
2019-01-07 08:33:07 +00:00
it('should click on the Claims button of the top bar menu', async() => {
2018-11-07 07:38:09 +00:00
const url = await nightmare
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.claimsButton)
.wait(selectors.claimsIndex.searchClaimInput)
2018-11-07 07:38:09 +00:00
.parsedUrl();
expect(url.hash).toEqual('#!/claim/index');
2018-10-25 14:44:03 +00:00
});
2019-01-07 08:33:07 +00:00
it('should search for the claim with id 4', async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-01-23 14:33:25 +00:00
.write(selectors.claimsIndex.searchClaimInput, 4)
2019-01-23 15:00:56 +00:00
.waitToClick(selectors.claimsIndex.searchButton)
2018-10-25 14:44:03 +00:00
.waitForNumberOfElements(selectors.claimsIndex.searchResult, 1)
2018-11-07 07:38:09 +00:00
.countElement(selectors.claimsIndex.searchResult);
expect(result).toEqual(1);
});
2019-01-07 08:33:07 +00:00
it('should click the Tickets button of the top bar menu', async() => {
2018-11-07 07:38:09 +00:00
const url = await nightmare
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchTicketInput)
2018-11-07 07:38:09 +00:00
.parsedUrl();
expect(url.hash).toEqual('#!/ticket/index');
2018-10-25 14:44:03 +00:00
});
2019-06-27 06:41:07 +00:00
it('should search for a ticket then access to the sales section', async() => {
2018-11-07 07:38:09 +00:00
const url = await nightmare
2019-06-27 06:41:07 +00:00
.accessToSearchResult(16)
.accessToSection('ticket.card.sale')
2018-10-25 14:44:03 +00:00
.waitForURL('/sale')
.parsedUrl();
2018-11-07 07:38:09 +00:00
expect(url.hash).toContain('/sale');
2018-10-22 15:12:41 +00:00
});
2019-01-07 08:33:07 +00:00
it('should select the third sale and delete it', async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.ticketSales.thirdSaleCheckbox)
.waitToClick(selectors.ticketSales.deleteSaleButton)
.waitToClick(selectors.ticketSales.acceptDeleteLineButton)
.waitForSpinnerLoad()
2018-11-07 07:38:09 +00:00
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
2018-10-25 14:44:03 +00:00
});
2018-10-22 15:12:41 +00:00
2019-01-07 08:33:07 +00:00
it(`should confirm the third sale was deleted`, async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
.countElement(selectors.ticketSales.saleLine);
expect(result).toEqual(3);
});
it('should select the second sale and transfer it to a valid ticket', async() => {
2019-06-27 06:41:07 +00:00
const targetTicketId = 12;
2018-11-07 07:38:09 +00:00
const result = await nightmare
.waitToClick(selectors.ticketSales.secondSaleCheckbox)
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.ticketSales.transferSaleButton)
.focusElement(selectors.ticketSales.transferQuantityCell)
.write(selectors.ticketSales.transferQuantityInput, '10\u000d')
2019-06-27 06:41:07 +00:00
.write(selectors.ticketSales.moveToTicketInput, targetTicketId)
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.ticketSales.moveToTicketButton)
2019-06-27 06:41:07 +00:00
.waitForURL(`ticket/${targetTicketId}/sale`)
.parsedUrl();
2018-11-07 07:38:09 +00:00
2019-06-27 06:41:07 +00:00
expect(result.hash).toContain(`ticket/${targetTicketId}/sale`);
2018-10-25 14:44:03 +00:00
});
2019-01-07 08:33:07 +00:00
it('should confirm the transfered line is the correct one', async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-06-27 06:41:07 +00:00
.wait(selectors.ticketSales.secondSaleText)
.waitToGetProperty(selectors.ticketSales.secondSaleText, 'innerText');
2018-11-07 07:38:09 +00:00
expect(result).toContain(`Melee weapon heavy shield`);
});
it('should confirm the transfered quantity is the correct one', async() => {
const result = await nightmare
.waitToGetProperty(selectors.ticketSales.secondSaleQuantityCell, 'innerText');
expect(result).toContain('10');
2018-10-25 14:44:03 +00:00
});
2019-01-07 08:33:07 +00:00
it('should go back to the original ticket sales section', async() => {
2018-11-07 07:38:09 +00:00
const url = await nightmare
2019-06-27 06:41:07 +00:00
.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton)
.accessToSearchResult(16)
.accessToSection('ticket.card.sale')
2018-10-25 14:44:03 +00:00
.waitForURL('/sale')
.parsedUrl();
2018-11-07 07:38:09 +00:00
expect(url.hash).toContain('/sale');
2018-10-25 14:44:03 +00:00
});
it(`should confirm the original ticket has still three lines`, async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2018-10-25 14:44:03 +00:00
.wait(selectors.ticketSales.saleLine)
2018-11-07 07:38:09 +00:00
.countElement(selectors.ticketSales.saleLine);
expect(result).toEqual(3);
});
it(`should confirm the second sale quantity is now half of it's original value after the transfer`, async() => {
const result = await nightmare
.waitToGetProperty(selectors.ticketSales.secondSaleQuantityCell, 'innerText');
expect(result).toContain('10');
2018-10-25 14:44:03 +00:00
});
2019-01-07 08:33:07 +00:00
it('should go back to the receiver ticket sales section', async() => {
2018-11-07 07:38:09 +00:00
const url = await nightmare
2019-06-27 06:41:07 +00:00
.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton)
.accessToSearchResult(12)
.accessToSection('ticket.card.sale')
2018-10-25 14:44:03 +00:00
.waitForURL('/sale')
.parsedUrl();
2018-11-07 07:38:09 +00:00
expect(url.hash).toContain('/sale');
2018-10-25 14:44:03 +00:00
});
2019-01-07 08:33:07 +00:00
it('should transfer the sale back to the original ticket', async() => {
2019-06-27 06:41:07 +00:00
const targetTicketId = 16;
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-06-27 06:41:07 +00:00
.waitToClick(selectors.ticketSales.secondSaleCheckbox)
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.ticketSales.transferSaleButton)
2019-06-27 06:41:07 +00:00
.write(selectors.ticketSales.moveToTicketInput, targetTicketId)
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.ticketSales.moveToTicketButton)
2019-06-27 06:41:07 +00:00
.waitForURL(`ticket/${targetTicketId}/sale`)
.parsedUrl();
2018-11-07 07:38:09 +00:00
2019-06-27 06:41:07 +00:00
expect(result.hash).toContain(`ticket/${targetTicketId}/sale`);
2018-10-25 14:44:03 +00:00
});
2019-01-07 08:33:07 +00:00
it('should confirm the original ticket received the line', async() => {
const expectedLines = 4;
2018-11-07 07:38:09 +00:00
const result = await nightmare
.waitForNumberOfElements(selectors.ticketSales.saleLine, expectedLines)
2018-11-07 07:38:09 +00:00
.countElement(selectors.ticketSales.saleLine);
expect(result).toEqual(expectedLines);
2018-10-25 14:44:03 +00:00
});
2019-06-27 06:41:07 +00:00
it(`should throw an error when attempting to create a ticket for an inactive client`, async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.firstSaleCheckbox)
.waitToClick(selectors.ticketSales.transferSaleButton)
.waitToClick(selectors.ticketSales.moveToNewTicketButton)
.waitToClick(selectors.ticketSales.acceptDeleteTicketButton)
.waitForLastSnackbar();
expect(result).toEqual(`You can't create a ticket for a inactive client`);
});
it('should go now to the ticket sales section of an active, not frozen client', async() => {
2018-11-29 13:24:57 +00:00
const url = await nightmare
2019-06-27 06:41:07 +00:00
.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton)
.accessToSearchResult(13)
.accessToSection('ticket.card.sale')
2018-11-29 13:24:57 +00:00
.waitForURL('/sale')
.parsedUrl();
expect(url.hash).toContain('/sale');
});
2019-06-27 06:41:07 +00:00
it(`should select all sales, tranfer them to a new ticket and delete the sender ticket as it would've been left empty`, async() => {
const senderTicketId = 13;
2018-11-07 07:38:09 +00:00
const url = await nightmare
.waitToClick(selectors.ticketSales.selectAllSalesCheckbox)
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.ticketSales.transferSaleButton)
.waitToClick(selectors.ticketSales.moveToNewTicketButton)
2019-06-27 06:41:07 +00:00
.waitToClick(selectors.ticketSales.acceptDeleteTicketButton)
.wait((selector, ticketId) => {
return document.querySelector(selector).innerText.toLowerCase().indexOf(`${ticketId}`) == -1;
}, selectors.ticketDescriptor.idLabelValue, senderTicketId)
.parsedUrl();
2018-11-07 07:38:09 +00:00
expect(url.hash).toContain('/sale');
});
2019-06-27 06:41:07 +00:00
it('should confirm the new ticket received the line', async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
.countElement(selectors.ticketSales.saleLine);
2018-11-29 13:24:57 +00:00
expect(result).toEqual(1);
2018-10-25 14:44:03 +00:00
});
2019-01-07 08:33:07 +00:00
it('should check the first sale reserved icon isnt visible', async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
.isVisible(selectors.ticketSales.firstSaleReservedIcon);
expect(result).toBeFalsy();
2018-10-25 14:44:03 +00:00
});
2019-01-07 08:33:07 +00:00
it('should mark the first sale as reserved', async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.ticketSales.firstSaleCheckbox)
2019-06-27 06:41:07 +00:00
.waitToClick(selectors.ticketSales.moreMenu)
.waitToClick(selectors.ticketSales.moreMenuReserve)
2018-10-25 14:44:03 +00:00
.waitForClassNotPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide')
2018-11-07 07:38:09 +00:00
.isVisible(selectors.ticketSales.firstSaleReservedIcon);
expect(result).toBeTruthy();
2018-10-25 14:44:03 +00:00
});
2019-01-07 08:33:07 +00:00
it('should unmark the first sale as reserved', async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-06-27 06:41:07 +00:00
.waitToClick(selectors.ticketSales.moreMenu)
.waitToClick(selectors.ticketSales.moreMenuUnmarkReseved)
2018-10-25 14:44:03 +00:00
.waitForClassPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide')
2018-11-07 07:38:09 +00:00
.isVisible(selectors.ticketSales.firstSaleReservedIcon);
expect(result).toBeFalsy();
});
2019-01-07 08:33:07 +00:00
it('should update all sales discount', async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-06-27 06:41:07 +00:00
.waitToClick(selectors.ticketSales.moreMenu)
2018-11-07 07:38:09 +00:00
.waitToClick(selectors.ticketSales.moreMenuUpdateDiscount)
// .write(selectors.ticketSales.moreMenuUpdateDiscountInput, 100) can't find the selector on app (deleted the selector), menu option was removed?
.write('body', '\u000d')
2018-11-07 07:38:09 +00:00
.waitForTextInElement(selectors.ticketSales.totalImport, '0.00')
.waitToGetProperty(selectors.ticketSales.totalImport, 'innerText');
2018-11-07 07:38:09 +00:00
expect(result).toContain('0.00');
});
2019-06-27 06:41:07 +00:00
it('should log in as Production role and go to a target ticket summary', async() => {
2018-11-07 07:38:09 +00:00
const url = await nightmare
2019-06-27 06:41:07 +00:00
.loginAndModule('production', 'ticket')
.accessToSearchResult(13)
.waitForURL('/summary')
2018-11-07 07:38:09 +00:00
.parsedUrl();
2019-06-27 06:41:07 +00:00
expect(url.hash).toContain('/summary');
2018-10-25 14:44:03 +00:00
});
2019-06-27 06:41:07 +00:00
it(`should check it's state is deleted`, async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-06-27 06:41:07 +00:00
.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
2018-11-07 07:38:09 +00:00
2019-06-27 06:41:07 +00:00
expect(result).toEqual('State Eliminado');
2018-10-25 14:44:03 +00:00
});
describe('when state is preparation and loged as Production', () => {
2019-01-07 08:33:07 +00:00
it(`should not be able to edit the sale price`, async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-06-27 06:41:07 +00:00
.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton)
.accessToSearchResult(8)
.accessToSection('ticket.card.sale')
.waitToClick(selectors.ticketSales.firstSalePrice)
.exists(selectors.ticketSales.firstSalePriceInput);
2018-11-07 07:38:09 +00:00
expect(result).toBeFalsy();
});
2019-01-07 08:33:07 +00:00
it(`should not be able to edit the sale discount`, async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-06-27 06:41:07 +00:00
.waitToClick(selectors.ticketSales.firstSaleDiscount)
.exists(selectors.ticketSales.firstSaleDiscountInput);
2018-11-07 07:38:09 +00:00
expect(result).toBeFalsy();
});
2019-01-07 08:33:07 +00:00
it(`should not be able to edit the sale state`, async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.ticketSales.stateMenuButton)
2018-11-07 07:38:09 +00:00
.exists(selectors.ticketSales.stateMenuOptions);
expect(result).toBeFalsy();
});
2019-06-27 06:41:07 +00:00
it('should log in as salesPerson then go to the sales of a target ticket', async() => {
2018-11-07 07:38:09 +00:00
const url = await nightmare
2019-06-27 06:41:07 +00:00
.loginAndModule('salesPerson', 'ticket')
.accessToSearchResult(8)
.accessToSection('ticket.card.sale')
2018-11-14 14:12:09 +00:00
.waitForURL('/sale')
.parsedUrl();
2018-11-14 14:12:09 +00:00
expect(url.hash).toContain('/sale');
2018-11-14 14:12:09 +00:00
});
2018-10-25 14:44:03 +00:00
});
describe('when state is preparation and loged as salesPerson', () => {
2019-06-27 06:41:07 +00:00
it(`shouldn't be able to edit the sale price`, async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-06-27 06:41:07 +00:00
.waitToClick(selectors.ticketSales.firstSalePrice)
.exists(selectors.ticketSales.firstSalePriceInput);
2018-11-07 07:38:09 +00:00
expect(result).toBeFalsy();
2018-10-25 14:44:03 +00:00
});
2019-06-27 06:41:07 +00:00
it(`should be able to edit the sale discount`, async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2019-06-27 06:41:07 +00:00
.waitToClick(selectors.ticketSales.firstSaleDiscount)
.exists(selectors.ticketSales.firstSaleDiscountInput);
2018-11-07 07:38:09 +00:00
expect(result).toBeFalsy();
2018-10-25 14:44:03 +00:00
});
2019-06-27 06:41:07 +00:00
it(`should not be able to edit the sale state`, async() => {
2018-11-07 07:38:09 +00:00
const result = await nightmare
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.ticketSales.stateMenuButton)
2018-11-07 07:38:09 +00:00
.exists(selectors.ticketSales.stateMenuOptions);
expect(result).toBeFalsy();
2018-10-25 14:44:03 +00:00
});
2018-11-08 14:20:42 +00:00
});
});