2053 e2e ticket request
gitea/salix/2053_e2e_tiquet_request This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2020-02-27 07:17:09 +01:00
parent 37ff99d838
commit 83943cd66f
2 changed files with 44 additions and 18 deletions

View File

@ -511,14 +511,16 @@ export default {
},
ticketRequests: {
addRequestButton: 'vn-ticket-request-index > a > vn-float-button > button',
request: 'vn-ticket-request-index vn-table vn-tr',
descriptionInput: 'vn-ticket-request-create [ng-model="$ctrl.ticketRequest.description"]',
atender: 'vn-ticket-request-create vn-autocomplete[ng-model="$ctrl.ticketRequest.attenderFk"]',
quantity: 'vn-ticket-request-create vn-input-number[ng-model="$ctrl.ticketRequest.quantity"]',
price: 'vn-ticket-request-create vn-input-number[ng-model="$ctrl.ticketRequest.price"]',
firstRemoveRequestButton: 'vn-ticket-request-index vn-icon[icon="delete"]:nth-child(1)',
firstRequestQuantity: 'vn-ticket-request-index vn-table vn-tr:nth-child(1) > vn-td:nth-child(6) vn-input-number',
secondRequestQuantity: 'vn-ticket-request-index vn-table vn-tr:nth-child(2) > vn-td:nth-child(6) vn-input-number',
thirdDescription: 'vn-ticket-request-index vn-table vn-tr:nth-child(3) > vn-td:nth-child(2) vn-textfield',
thirdRemoveRequestButton: 'vn-ticket-request-index vn-tr:nth-child(3) vn-icon[icon="delete"]',
thirdRequestQuantity: 'vn-ticket-request-index vn-table vn-tr:nth-child(3) > vn-td:nth-child(6) vn-input-number',
saveButton: 'vn-ticket-request-create button[type=submit]',
firstDescription: 'vn-ticket-request-index vn-table vn-tr:nth-child(1) > vn-td:nth-child(2) vn-textfield',
},
ticketLog: {

View File

@ -9,7 +9,7 @@ describe('Ticket purchase request path', () => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('salesPerson', 'ticket');
await page.accessToSearchResult('16');
await page.accessToSearchResult('1');
await page.accessToSection('ticket.card.request.index');
});
@ -17,10 +17,10 @@ describe('Ticket purchase request path', () => {
await browser.close();
});
it(`should add a new request`, async() => {
it('should add a new request', async() => {
await page.waitToClick(selectors.ticketRequests.addRequestButton);
await page.write(selectors.ticketRequests.descriptionInput, 'New stuff');
await page.write(selectors.ticketRequests.quantity, '99');
await page.write(selectors.ticketRequests.quantity, '9');
await page.autocompleteSearch(selectors.ticketRequests.atender, 'buyerNick');
await page.write(selectors.ticketRequests.price, '999');
await page.waitToClick(selectors.ticketRequests.saveButton);
@ -29,29 +29,53 @@ describe('Ticket purchase request path', () => {
expect(result).toEqual('Data saved!');
});
it(`should have been redirected to the request index`, async() => {
it('should have been redirected to the request index', async() => {
let url = await page.expectURL('/request');
expect(url).toBe(true);
});
it(`should confirm the new request was added`, async() => {
await page.reloadSection('ticket.card.request.index');
const result = await page.waitToGetProperty(selectors.ticketRequests.firstDescription, 'value');
expect(result).toEqual('New stuff');
});
it(`should delete the added request`, async() => {
await page.waitToClick(selectors.ticketRequests.firstRemoveRequestButton);
it(`should edit the third request quantity as it's state is still new`, async() => {
// await page.clearInput(selectors.ticketRequests.thirdRequestQuantity); // clear input performs a post. is this intended?
await page.waitForContentLoaded();
await page.write(selectors.ticketRequests.thirdRequestQuantity, '9');
await page.keyboard.press('Enter');
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it(`should confirm the request was deleted`, async() => {
it('should confirm the new request was added', async() => {
await page.reloadSection('ticket.card.request.index');
const result = await page.waitToGetProperty(selectors.ticketRequests.thirdRequestQuantity, 'value');
expect(result).toEqual('99');
});
it(`should confirm first request can't be edited as its state is different to new`, async() => {
await page.waitForClassPresent(selectors.ticketRequests.firstRequestQuantity, 'disabled');
const result = await page.isDisabled(selectors.ticketRequests.firstRequestQuantity);
expect(result).toBe(true);
});
it(`should confirm second request can't be edited as its state is different to new`, async() => {
await page.waitForClassPresent(selectors.ticketRequests.secondRequestQuantity, 'disabled');
const result = await page.isDisabled(selectors.ticketRequests.secondRequestQuantity);
expect(result).toBe(true);
});
it('should delete the added request', async() => {
await page.waitToClick(selectors.ticketRequests.thirdRemoveRequestButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm the request was deleted', async() => {
await page.reloadSection('ticket.card.request.index');
await page.wait(selectors.ticketRequests.addRequestButton);
await page.waitForSelector(selectors.ticketRequests.request, {hidden: true});
await page.waitForSelector(selectors.ticketRequests.thirdDescription, {hidden: true});
});
});