input-number e2e
This commit is contained in:
parent
4f1a1ae004
commit
104cfaadfe
|
@ -11,41 +11,51 @@ describe('Ticket Create packages path', () => {
|
|||
.accessToSection('ticket.card.package.index');
|
||||
});
|
||||
|
||||
it(`should delete the first package and receive and error to save a new one with blank quantity`, async() => {
|
||||
it(`should attempt create a new package but receive an error if package is blank`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketPackages.firstRemovePackageButton)
|
||||
.waitToClick(selectors.ticketPackages.addPackageButton)
|
||||
.autocompleteSearch(selectors.ticketPackages.firstPackageAutocomplete, 'Container medical box 1m')
|
||||
.waitToClick(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it(`should attempt create a new package but receive an error if quantity is 0`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.ticketPackages.firstQuantityInput)
|
||||
.write(selectors.ticketPackages.firstQuantityInput, 0)
|
||||
.waitToClick(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it(`should attempt create a new package but receive an error if package is blank`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.ticketPackages.firstQuantityInput)
|
||||
.write(selectors.ticketPackages.firstQuantityInput, 'text and 99')
|
||||
.waitToClick(selectors.ticketPackages.clearPackageAutocompleteButton)
|
||||
.write(selectors.ticketPackages.firstQuantityInput, 99)
|
||||
.waitToClick(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Package cannot be blank');
|
||||
});
|
||||
|
||||
it(`should delete the first package and receive and error to save a new one with blank quantity`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.ticketPackages.firstQuantityInput)
|
||||
.autocompleteSearch(selectors.ticketPackages.firstPackageAutocomplete, 'Container medical box 1m')
|
||||
.waitToClick(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it(`should confirm the quantity input isn't invalid yet`, async() => {
|
||||
const result = await nightmare
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checkValidity();
|
||||
}, selectors.ticketPackages.firstQuantityInput);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should attempt create a new package but receive an error if the quantity is invalid`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketPackages.firstQuantityInput, -99)
|
||||
.waitToClick(selectors.ticketPackages.savePackagesButton)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checkValidity();
|
||||
}, selectors.ticketPackages.firstQuantityInput);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
|
||||
it(`should create a new package with correct data`, async() => {
|
||||
const result = await nightmare
|
||||
.autocompleteSearch(selectors.ticketPackages.firstPackageAutocomplete, 'Container medical box 1m')
|
||||
.clearInput(selectors.ticketPackages.firstQuantityInput)
|
||||
.write(selectors.ticketPackages.firstQuantityInput, 99)
|
||||
.waitToClick(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
|
|
Loading…
Reference in New Issue