2018-09-10 08:23:26 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/helpers';
|
2018-04-04 14:41:06 +00:00
|
|
|
|
2018-09-12 14:25:12 +00:00
|
|
|
describe('Ticket Create packages path', () => {
|
2018-09-10 08:23:26 +00:00
|
|
|
const nightmare = createNightmare();
|
2018-04-04 14:41:06 +00:00
|
|
|
|
2018-09-10 08:23:26 +00:00
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
2018-10-11 07:14:26 +00:00
|
|
|
.waitForLogin('employee');
|
2018-09-10 08:23:26 +00:00
|
|
|
});
|
2018-04-04 14:41:06 +00:00
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should click on the Tickets button of the top bar menu', done => {
|
2018-09-10 08:23:26 +00:00
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
|
|
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
|
|
|
.waitToClick(selectors.globalItems.ticketsButton)
|
2018-10-20 10:07:48 +00:00
|
|
|
.wait(selectors.ticketsIndex.searchResult)
|
2018-09-10 08:23:26 +00:00
|
|
|
.parsedUrl()
|
|
|
|
.then(url => {
|
|
|
|
expect(url.hash).toEqual('#!/ticket/index');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-10 08:23:26 +00:00
|
|
|
});
|
2018-04-04 14:41:06 +00:00
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should search for the ticket 1', done => {
|
2018-09-10 08:23:26 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.ticketsIndex.searchResult)
|
|
|
|
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
|
|
|
|
.click(selectors.ticketsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.ticketsIndex.searchResult)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual(1);
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-10 08:23:26 +00:00
|
|
|
});
|
2018-04-04 14:41:06 +00:00
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should click on the search result to access to the ticket packages`, done => {
|
2018-09-10 08:23:26 +00:00
|
|
|
return nightmare
|
2018-09-12 14:25:12 +00:00
|
|
|
.waitForTextInElement(selectors.ticketsIndex.searchResultAddress, 'address 21')
|
2018-09-10 08:23:26 +00:00
|
|
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
|
|
|
.waitToClick(selectors.ticketPackages.packagesButton)
|
|
|
|
.waitForURL('package/index')
|
|
|
|
.url()
|
|
|
|
.then(url => {
|
|
|
|
expect(url).toContain('package/index');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-10 08:23:26 +00:00
|
|
|
});
|
2018-04-04 14:41:06 +00:00
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should delete the first package and receive and error to save a new one with blank quantity`, done => {
|
2018-09-10 08:23:26 +00:00
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.ticketPackages.firstRemovePackageButton)
|
|
|
|
.waitToClick(selectors.ticketPackages.addPackageButton)
|
|
|
|
.waitToClick(selectors.ticketPackages.firstPackageSelect)
|
2018-09-13 10:32:33 +00:00
|
|
|
.waitToClick(selectors.ticketPackages.firstPackageSelectOptionTwo)
|
2018-09-10 08:23:26 +00:00
|
|
|
.click(selectors.ticketPackages.savePackagesButton)
|
2018-09-12 14:25:12 +00:00
|
|
|
.waitForLastSnackbar()
|
2018-09-10 08:23:26 +00:00
|
|
|
.then(result => {
|
2018-09-12 14:25:12 +00:00
|
|
|
expect(result).toEqual('Some fields are invalid');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-10 08:23:26 +00:00
|
|
|
});
|
2018-04-04 14:41:06 +00:00
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should attempt create a new package but receive an error if quantity is a string`, done => {
|
2018-09-10 08:23:26 +00:00
|
|
|
return nightmare
|
|
|
|
.type(selectors.ticketPackages.firstQuantityInput, 'ninety 9')
|
|
|
|
.click(selectors.ticketPackages.savePackagesButton)
|
2018-09-12 14:25:12 +00:00
|
|
|
.waitForLastSnackbar()
|
2018-09-10 08:23:26 +00:00
|
|
|
.then(result => {
|
2018-09-12 14:25:12 +00:00
|
|
|
expect(result).toEqual('Some fields are invalid');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-10 08:23:26 +00:00
|
|
|
});
|
2018-04-04 14:41:06 +00:00
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should attempt create a new package but receive an error if quantity is 0`, done => {
|
2018-09-10 08:23:26 +00:00
|
|
|
return nightmare
|
|
|
|
.clearInput(selectors.ticketPackages.firstQuantityInput)
|
2018-09-12 14:25:12 +00:00
|
|
|
.type(selectors.ticketPackages.firstQuantityInput, 0)
|
2018-09-10 08:23:26 +00:00
|
|
|
.click(selectors.ticketPackages.savePackagesButton)
|
2018-09-12 14:25:12 +00:00
|
|
|
.waitForLastSnackbar()
|
2018-09-10 08:23:26 +00:00
|
|
|
.then(result => {
|
2018-09-12 14:25:12 +00:00
|
|
|
expect(result).toEqual('Some fields are invalid');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-10 08:23:26 +00:00
|
|
|
});
|
2018-04-04 14:41:06 +00:00
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should attempt create a new package but receive an error if package is blank`, done => {
|
2018-09-10 08:23:26 +00:00
|
|
|
return nightmare
|
|
|
|
.clearInput(selectors.ticketPackages.firstQuantityInput)
|
2018-09-12 14:25:12 +00:00
|
|
|
.type(selectors.ticketPackages.firstQuantityInput, 99)
|
2018-09-10 08:23:26 +00:00
|
|
|
.click(selectors.ticketPackages.clearPackageSelectButton)
|
|
|
|
.click(selectors.ticketPackages.savePackagesButton)
|
2018-09-12 14:25:12 +00:00
|
|
|
.waitForLastSnackbar()
|
2018-09-10 08:23:26 +00:00
|
|
|
.then(result => {
|
2018-09-19 13:05:07 +00:00
|
|
|
expect(result).toEqual('Package cannot be blank');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-10 08:23:26 +00:00
|
|
|
});
|
2018-04-04 14:41:06 +00:00
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should create a new package with correct data`, done => {
|
2018-09-10 08:23:26 +00:00
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.ticketPackages.firstPackageSelect)
|
2018-09-13 10:32:33 +00:00
|
|
|
.waitToClick(selectors.ticketPackages.firstPackageSelectOptionTwo)
|
|
|
|
.waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Legendary Box')
|
2018-09-10 08:23:26 +00:00
|
|
|
.click(selectors.ticketPackages.savePackagesButton)
|
2018-09-12 14:25:12 +00:00
|
|
|
.waitForLastSnackbar()
|
2018-09-10 08:23:26 +00:00
|
|
|
.then(result => {
|
2018-09-12 14:25:12 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-10 08:23:26 +00:00
|
|
|
});
|
2018-04-04 14:41:06 +00:00
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should confirm the first select is the expected one`, done => {
|
2018-09-10 08:23:26 +00:00
|
|
|
return nightmare
|
|
|
|
.click(selectors.ticketSales.saleButton)
|
|
|
|
.wait(selectors.ticketSales.firstPackageSelect)
|
|
|
|
.click(selectors.ticketPackages.packagesButton)
|
2018-09-13 10:32:33 +00:00
|
|
|
.waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Legendary Box')
|
2018-09-10 08:23:26 +00:00
|
|
|
.getInputValue(selectors.ticketPackages.firstPackageSelect)
|
|
|
|
.then(result => {
|
2018-09-13 10:32:33 +00:00
|
|
|
expect(result).toEqual('Legendary Box');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-10 08:23:26 +00:00
|
|
|
});
|
2018-04-04 14:41:06 +00:00
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should confirm the first quantity is the expected one`, done => {
|
2018-09-10 08:23:26 +00:00
|
|
|
return nightmare
|
|
|
|
.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '99')
|
|
|
|
.getInputValue(selectors.ticketPackages.firstQuantityInput)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('99');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-10 08:23:26 +00:00
|
|
|
});
|
|
|
|
});
|