#175 e2e for ticket packages
This commit is contained in:
parent
7a3c2d0725
commit
04ac260738
|
@ -294,12 +294,18 @@ export default {
|
||||||
},
|
},
|
||||||
ticketPackages: {
|
ticketPackages: {
|
||||||
packagesButton: `${components.vnMenuItem}[ui-sref="ticket.card.package.index"]`,
|
packagesButton: `${components.vnMenuItem}[ui-sref="ticket.card.package.index"]`,
|
||||||
firstPackageSelect: `${components.vnAutocomplete}[label="Package"] input`
|
firstPackageSelect: `${components.vnAutocomplete}[label="Package"] > div > div > input`,
|
||||||
|
firstPackageSelectOptionThree: `${components.vnAutocomplete}[label="Package"] vn-drop-down ul > li:nth-child(3)`,
|
||||||
|
firstQuantityInput: `vn-textfield[label="Quantity"] > div > input`,
|
||||||
|
firstRemovePackageButton: `vn-icon[vn-tooltip="Remove package"]`,
|
||||||
|
addPackageButton: `vn-icon[vn-tooltip="Add package"]`,
|
||||||
|
clearPackageSelectButton: `${components.vnAutocomplete}[label="Package"] > div > div > div > vn-icon > i`,
|
||||||
|
savePackagesButton: `${components.vnSubmit}`
|
||||||
},
|
},
|
||||||
ticketSales: {
|
ticketSales: {
|
||||||
saleButton: `${components.vnMenuItem}[ui-sref="ticket.card.sale"]`,
|
saleButton: `${components.vnMenuItem}[ui-sref="ticket.card.sale"]`,
|
||||||
firstPackageSelect: `${components.vnAutocomplete}[label="Package"] input`,
|
|
||||||
firstSaleText: `table > tbody > tr:nth-child(1)`,
|
firstSaleText: `table > tbody > tr:nth-child(1)`,
|
||||||
secondSaleText: `table > tbody > tr:nth-child(2)`
|
secondSaleText: `table > tbody > tr:nth-child(2)`
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,126 @@
|
||||||
|
import selectors from '../../helpers/selectors.js';
|
||||||
|
import createNightmare from '../../helpers/helpers';
|
||||||
|
|
||||||
|
describe('create ticket packages path', () => {
|
||||||
|
const nightmare = createNightmare();
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
return nightmare
|
||||||
|
.waitForLogin('developer');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should click on the Tickets button of the top bar menu', () => {
|
||||||
|
return nightmare
|
||||||
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||||
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||||
|
.waitToClick(selectors.globalItems.ticketsButton)
|
||||||
|
.wait(selectors.ticketsIndex.createTicketButton)
|
||||||
|
.parsedUrl()
|
||||||
|
.then(url => {
|
||||||
|
expect(url.hash).toEqual('#!/ticket/list');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should search for the ticket 1', () => {
|
||||||
|
return nightmare
|
||||||
|
.wait(selectors.ticketsIndex.searchResult)
|
||||||
|
.type(selectors.ticketsIndex.searchTicketInput, 1)
|
||||||
|
.click(selectors.ticketsIndex.searchButton)
|
||||||
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||||
|
.countSearchResults(selectors.ticketsIndex.searchResult)
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toEqual(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should click on the search result to access to the ticket packages`, () => {
|
||||||
|
return nightmare
|
||||||
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Batman')
|
||||||
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||||
|
.waitToClick(selectors.ticketPackages.packagesButton)
|
||||||
|
.waitForURL('package/index')
|
||||||
|
.url()
|
||||||
|
.then(url => {
|
||||||
|
expect(url).toContain('package/index');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should delete the first package and receive and error to save a new one with blank quantity`, () => {
|
||||||
|
return nightmare
|
||||||
|
.waitToClick(selectors.ticketPackages.firstRemovePackageButton)
|
||||||
|
.waitToClick(selectors.ticketPackages.addPackageButton)
|
||||||
|
.waitToClick(selectors.ticketPackages.firstPackageSelect)
|
||||||
|
.waitToClick(selectors.ticketPackages.firstPackageSelectOptionThree)
|
||||||
|
.click(selectors.ticketPackages.savePackagesButton)
|
||||||
|
.waitForSnackbar()
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toContain('Some fields are invalid');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should attempt create a new package but receive an error if quantity is a string`, () => {
|
||||||
|
return nightmare
|
||||||
|
.type(selectors.ticketPackages.firstQuantityInput, 'ninety 9')
|
||||||
|
.click(selectors.ticketPackages.savePackagesButton)
|
||||||
|
.waitForSnackbar()
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toContain('Some fields are invalid');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should attempt create a new package but receive an error if quantity is 0`, () => {
|
||||||
|
return nightmare
|
||||||
|
.clearInput(selectors.ticketPackages.firstQuantityInput)
|
||||||
|
.type(selectors.ticketPackages.firstQuantityInput, '0')
|
||||||
|
.click(selectors.ticketPackages.savePackagesButton)
|
||||||
|
.waitForSnackbar()
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toContain('Some fields are invalid');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should attempt create a new package but receive an error if package is blank`, () => {
|
||||||
|
return nightmare
|
||||||
|
.clearInput(selectors.ticketPackages.firstQuantityInput)
|
||||||
|
.type(selectors.ticketPackages.firstQuantityInput, '99')
|
||||||
|
.click(selectors.ticketPackages.clearPackageSelectButton)
|
||||||
|
.click(selectors.ticketPackages.savePackagesButton)
|
||||||
|
.waitForSnackbar()
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toContain('Package cannot be blank');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should create a new package with correct data`, () => {
|
||||||
|
return nightmare
|
||||||
|
.waitToClick(selectors.ticketPackages.firstPackageSelect)
|
||||||
|
.waitToClick(selectors.ticketPackages.firstPackageSelectOptionThree)
|
||||||
|
.waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Iron Patriot')
|
||||||
|
.click(selectors.ticketPackages.savePackagesButton)
|
||||||
|
.waitForSnackbar()
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toContain('Data saved!');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should confirm the first select is the expected one`, () => {
|
||||||
|
return nightmare
|
||||||
|
.click(selectors.ticketSales.saleButton)
|
||||||
|
.wait(selectors.ticketSales.firstPackageSelect)
|
||||||
|
.click(selectors.ticketPackages.packagesButton)
|
||||||
|
.waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Iron Patriot')
|
||||||
|
.getInputValue(selectors.ticketPackages.firstPackageSelect)
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toEqual('Iron Patriot');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should confirm the first quantity is the expected one`, () => {
|
||||||
|
return nightmare
|
||||||
|
.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '99')
|
||||||
|
.getInputValue(selectors.ticketPackages.firstQuantityInput)
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toEqual('99');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -9,6 +9,6 @@
|
||||||
"DNI Incorrecto": "DNI Incorrecto",
|
"DNI Incorrecto": "DNI Incorrecto",
|
||||||
"Ya existe un usuario con ese nombre": "Ya existe un usuario con ese nombre",
|
"Ya existe un usuario con ese nombre": "Ya existe un usuario con ese nombre",
|
||||||
"is invalid": "is invalid",
|
"is invalid": "is invalid",
|
||||||
"Quantity cannot be zero": "La cantidad no puede ser cero",
|
"Enter an integer different to zero": "Introduce un entero distinto de cero",
|
||||||
"Package cannot be blank": "Package cannot be blank"
|
"Package cannot be blank": "Package cannot be blank"
|
||||||
}
|
}
|
|
@ -39,7 +39,7 @@ module.exports = function(Self) {
|
||||||
await tx.commit();
|
await tx.commit();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
throw e;
|
throw Array.isArray(e) ? e[0] : e;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,7 @@ module.exports = function(Self) {
|
||||||
require('../methods/packaging/crudTicketPackaging')(Self);
|
require('../methods/packaging/crudTicketPackaging')(Self);
|
||||||
|
|
||||||
Self.validateBinded('quantity', validateQuantity, {
|
Self.validateBinded('quantity', validateQuantity, {
|
||||||
message: 'Quantity cannot be zero',
|
message: 'Enter an integer different to zero',
|
||||||
allowNull: false,
|
allowNull: false,
|
||||||
allowBlank: false
|
allowBlank: false
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue