2019-03-12 07:38:17 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
|
2019-03-20 11:23:38 +00:00
|
|
|
describe('Ticket descriptor path', () => {
|
2019-03-12 07:38:17 +00:00
|
|
|
const nightmare = createNightmare();
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
nightmare
|
|
|
|
.loginAndModule('employee', 'ticket');
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Delete ticket', () => {
|
|
|
|
it('should search for an specific ticket', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.write(selectors.ticketsIndex.searchTicketInput, '17')
|
|
|
|
.waitToClick(selectors.ticketsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.ticketsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(result).toEqual(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should click on the search result to access to the ticket summary`, async() => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 26')
|
|
|
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
|
|
|
.waitForURL('/summary')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('/summary');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should delete the ticket using the descriptor more menu', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
|
|
|
.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket)
|
2019-03-20 14:33:33 +00:00
|
|
|
.waitToClick(selectors.ticketDescriptor.acceptDeleteButton)
|
2019-03-12 07:38:17 +00:00
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Ticket deleted');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have been relocated to the ticket index', async() => {
|
|
|
|
const url = await nightmare
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/ticket/index');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should search for the deleted ticket and check it's date`, async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.write(selectors.ticketsIndex.searchTicketInput, 17)
|
|
|
|
.waitToClick(selectors.ticketsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
|
|
|
.wait(selectors.ticketsIndex.searchResultDate)
|
|
|
|
.waitToGetProperty(selectors.ticketsIndex.searchResultDate, 'innerText');
|
|
|
|
|
|
|
|
expect(result).toContain(2000);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('add stowaway', () => {
|
|
|
|
it('should search for a ticket', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.clearInput(selectors.ticketsIndex.searchTicketInput)
|
|
|
|
.write(selectors.ticketsIndex.searchTicketInput, 20)
|
|
|
|
.waitToClick(selectors.ticketsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.ticketsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(result).toEqual(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should click on the search result to access to the ticket summary`, async() => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 28')
|
|
|
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
|
|
|
.waitForURL('/summary')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('/summary');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should open the add stowaway dialog', async() => {
|
|
|
|
const isVisible = await nightmare
|
|
|
|
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
|
|
|
.waitToClick(selectors.ticketDescriptor.moreMenuAddStowaway)
|
|
|
|
.wait(selectors.ticketDescriptor.addStowawayDialogSecondTicket)
|
|
|
|
.isVisible(selectors.ticketDescriptor.addStowawayDialogSecondTicket);
|
|
|
|
|
|
|
|
|
|
|
|
expect(isVisible).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should add the second ticket as stowaway', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.ticketDescriptor.addStowawayDialogSecondTicket)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should navigate to the added ticket using the descriptors ship button`, async() => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.ticketDescriptor.closeStowawayDialog)
|
2019-03-20 11:23:38 +00:00
|
|
|
.waitToClick(selectors.ticketDescriptor.shipSelectButton)
|
2019-03-12 07:38:17 +00:00
|
|
|
.waitToClick(selectors.ticketDescriptor.shipMenuSecondTicket)
|
2019-03-20 11:23:38 +00:00
|
|
|
.waitForURL('#!/ticket/22/sale')
|
2019-03-12 07:38:17 +00:00
|
|
|
.parsedUrl();
|
|
|
|
|
2019-03-20 11:23:38 +00:00
|
|
|
expect(url.hash).toContain('#!/ticket/22/sale');
|
2019-03-12 07:38:17 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should navigate to the ship ticket using the descriptors ship button`, async() => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.ticketDescriptor.shipButton)
|
|
|
|
.waitForURL('#!/ticket/20/summary')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('#!/ticket/20/summary');
|
|
|
|
});
|
2019-03-20 14:33:33 +00:00
|
|
|
|
|
|
|
it(`should navigate back to the added ticket using the descriptors ship button`, async() => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.ticketDescriptor.closeStowawayDialog)
|
|
|
|
.waitToClick(selectors.ticketDescriptor.shipSelectButton)
|
|
|
|
.waitToClick(selectors.ticketDescriptor.shipMenuSecondTicket)
|
|
|
|
.waitForURL('#!/ticket/22/sale')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('#!/ticket/22/sale');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should delete the stowaway', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
|
|
|
.waitToClick(selectors.ticketDescriptor.moreMenuDeleteStowawayButton)
|
|
|
|
.waitToClick(selectors.ticketDescriptor.acceptDeleteStowawayButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should confirm the ship buton doesn't exisist any more`, async() => {
|
|
|
|
const exists = await nightmare
|
|
|
|
.exists(selectors.ticketDescriptor.shipButton);
|
|
|
|
|
|
|
|
expect(exists).toBeFalsy();
|
|
|
|
});
|
2019-03-12 07:38:17 +00:00
|
|
|
});
|
|
|
|
});
|