#817 ticket purchase request e2e
This commit is contained in:
parent
a8161f1ef0
commit
3997b34301
|
@ -407,6 +407,19 @@ export default {
|
||||||
margin: 'vn-ticket-components tfoot > tr:nth-child(2) > td',
|
margin: 'vn-ticket-components tfoot > tr:nth-child(2) > td',
|
||||||
total: 'vn-ticket-components tfoot > tr:nth-child(3) > td'
|
total: 'vn-ticket-components tfoot > tr:nth-child(3) > td'
|
||||||
},
|
},
|
||||||
|
ticketRequests: {
|
||||||
|
requestButton: `vn-left-menu a[ui-sref="ticket.card.request"]`,
|
||||||
|
addRequestButton: `vn-ticket-request vn-icon[icon="add_circle"]`,
|
||||||
|
request: 'vn-ticket-request > form > vn-card > div > vn-horizontal',
|
||||||
|
fifthDescriptionInput: `vn-ticket-request > form > vn-card > div > vn-horizontal:nth-child(6) > vn-textfield:nth-child(1) > div > div > div.infix > input`,
|
||||||
|
fifthQuantityInput: `vn-ticket-request > form > vn-card > div > vn-horizontal:nth-child(6) > vn-textfield:nth-child(2) > div > div > div.infix > input`,
|
||||||
|
fifthAtenderSelect: `vn-ticket-request > form > vn-card > div > vn-horizontal:nth-child(6) > vn-autocomplete > div > div > input`,
|
||||||
|
fifthAtenderSelectFirstOption: `vn-ticket-request > form > vn-card > div > vn-horizontal:nth-child(6) > vn-autocomplete vn-drop-down ul > li:nth-child(1)`,
|
||||||
|
fifthAtenderSelectSecondOption: `vn-ticket-request > form > vn-card > div > vn-horizontal:nth-child(6) > vn-autocomplete vn-drop-down ul > li:nth-child(2)`,
|
||||||
|
fifthPriceInput: `vn-ticket-request > form > vn-card > div > vn-horizontal:nth-child(6) > vn-textfield:nth-child(4) > div > div > div.infix > input`,
|
||||||
|
fifthRemoveRequestButton: `vn-ticket-request vn-horizontal:nth-child(6) vn-icon[icon="remove_circle_outline"]`,
|
||||||
|
saveButton: `${components.vnSubmit}`
|
||||||
|
},
|
||||||
createStateView: {
|
createStateView: {
|
||||||
stateInput: `vn-autocomplete[field="$ctrl.ticket.stateFk"] > div > div > input`,
|
stateInput: `vn-autocomplete[field="$ctrl.ticket.stateFk"] > div > div > input`,
|
||||||
stateInputOptionOne: `vn-autocomplete[field="$ctrl.ticket.stateFk"] vn-drop-down ul > li:nth-child(1)`,
|
stateInputOptionOne: `vn-autocomplete[field="$ctrl.ticket.stateFk"] vn-drop-down ul > li:nth-child(1)`,
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
import selectors from '../../helpers/selectors.js';
|
||||||
|
import createNightmare from '../../helpers/nightmare';
|
||||||
|
|
||||||
|
describe('Ticket purchase request path', () => {
|
||||||
|
const nightmare = createNightmare();
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
nightmare
|
||||||
|
.waitForLogin('salesPerson');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should click on the Tickets button of the top bar menu', async () => {
|
||||||
|
const url = await nightmare
|
||||||
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||||
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||||
|
.waitToClick(selectors.globalItems.ticketsButton)
|
||||||
|
.wait(selectors.ticketsIndex.searchResult)
|
||||||
|
.parsedUrl();
|
||||||
|
|
||||||
|
expect(url.hash).toEqual('#!/ticket/index');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should search for a specific ticket', async () => {
|
||||||
|
const result = await nightmare
|
||||||
|
.wait(selectors.ticketsIndex.searchResult)
|
||||||
|
.type(selectors.ticketsIndex.searchTicketInput, 'id:16')
|
||||||
|
.click(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 Purchase request`, async () => {
|
||||||
|
const url = await nightmare
|
||||||
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
|
||||||
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||||
|
.waitToClick(selectors.ticketRequests.requestButton)
|
||||||
|
.waitForURL('/request')
|
||||||
|
.url();
|
||||||
|
|
||||||
|
expect(url).toContain('/request');
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should add a new request`, async () => {
|
||||||
|
const result = await nightmare
|
||||||
|
.waitToClick(selectors.ticketRequests.addRequestButton)
|
||||||
|
.wait(selectors.ticketRequests.fifthDescriptionInput)
|
||||||
|
.type(selectors.ticketRequests.fifthDescriptionInput, 'New stuff')
|
||||||
|
.type(selectors.ticketRequests.fifthQuantityInput, 99)
|
||||||
|
.waitToClick(selectors.ticketRequests.fifthAtenderSelect)
|
||||||
|
.waitToClick(selectors.ticketRequests.fifthAtenderSelectSecondOption)
|
||||||
|
.type(selectors.ticketRequests.fifthPriceInput, 999)
|
||||||
|
.waitToClick(selectors.ticketRequests.saveButton)
|
||||||
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
|
expect(result).toEqual('Data saved!');
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should confirm the new request was added`, async () => {
|
||||||
|
const result = await nightmare
|
||||||
|
.waitToClick(selectors.ticketBasicData.basicDataButton)
|
||||||
|
.wait(selectors.ticketBasicData.clientSelect)
|
||||||
|
.waitToClick(selectors.ticketRequests.requestButton)
|
||||||
|
.waitForTextInInput(selectors.ticketRequests.fifthDescriptionInput, 'New Stuff')
|
||||||
|
.getProperty(selectors.ticketRequests.fifthDescriptionInput, 'value');
|
||||||
|
|
||||||
|
expect(result).toEqual('New stuff');
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should edit the added request`, async () => {
|
||||||
|
const result = await nightmare
|
||||||
|
.clearInput(selectors.ticketRequests.fifthDescriptionInput)
|
||||||
|
.type(selectors.ticketRequests.fifthDescriptionInput, 'Cool stuff')
|
||||||
|
.clearInput(selectors.ticketRequests.fifthQuantityInput)
|
||||||
|
.type(selectors.ticketRequests.fifthQuantityInput, 55)
|
||||||
|
.waitToClick(selectors.ticketRequests.fifthAtenderSelect)
|
||||||
|
.waitToClick(selectors.ticketRequests.fifthAtenderSelectFirstOption)
|
||||||
|
.clearInput(selectors.ticketRequests.fifthPriceInput)
|
||||||
|
.type(selectors.ticketRequests.fifthPriceInput, 55)
|
||||||
|
.waitToClick(selectors.ticketRequests.saveButton)
|
||||||
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
|
expect(result).toEqual('Data saved!');
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should confirm the new request was added`, async () => {
|
||||||
|
const result = await nightmare
|
||||||
|
.waitToClick(selectors.ticketBasicData.basicDataButton)
|
||||||
|
.wait(selectors.ticketBasicData.clientSelect)
|
||||||
|
.waitToClick(selectors.ticketRequests.requestButton)
|
||||||
|
.waitForTextInInput(selectors.ticketRequests.fifthDescriptionInput, 'Cool Stuff')
|
||||||
|
.getProperty(selectors.ticketRequests.fifthDescriptionInput, 'value');
|
||||||
|
|
||||||
|
expect(result).toEqual('Cool stuff');
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should delete the added request`, async () => {
|
||||||
|
const result = await nightmare
|
||||||
|
.waitToClick(selectors.ticketRequests.fifthRemoveRequestButton)
|
||||||
|
.waitToClick(selectors.ticketRequests.saveButton)
|
||||||
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
|
expect(result).toEqual('Data saved!');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
it(`should confirm the new request was deleted`, async () => {
|
||||||
|
const result = await nightmare
|
||||||
|
.waitToClick(selectors.ticketBasicData.basicDataButton)
|
||||||
|
.wait(selectors.ticketBasicData.clientSelect)
|
||||||
|
.waitToClick(selectors.ticketRequests.requestButton)
|
||||||
|
.wait(selectors.ticketRequests.request)
|
||||||
|
.countElement(selectors.ticketRequests.request);
|
||||||
|
|
||||||
|
expect(result).toEqual(4);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue