#604 nightmare extensions plus 1 e2e excluded instead of commented +task
This commit is contained in:
parent
4005c58ac3
commit
d2e77eecdb
|
@ -147,6 +147,26 @@ Nightmare.action('waitForNumberOfElements', function(selector, count, done) {
|
|||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('waitForClassNotPresent', function(selector, className, done) {
|
||||
this.wait(selector)
|
||||
.wait((resultSelector, targetClass) => {
|
||||
if (!document.querySelector(resultSelector).classList.contains(targetClass)) {
|
||||
return true;
|
||||
}
|
||||
}, selector, className)
|
||||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('waitForClassPresent', function(selector, className, done) {
|
||||
this.wait(selector)
|
||||
.wait((resultSelector, targetClass) => {
|
||||
if (document.querySelector(resultSelector).classList.contains(targetClass)) {
|
||||
return true;
|
||||
}
|
||||
}, selector, className)
|
||||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('waitForTextInElement', function(selector, name, done) {
|
||||
this.wait(selector)
|
||||
.wait((resultSelector, expectedText) => {
|
||||
|
@ -181,19 +201,6 @@ Nightmare.action('waitForEmptyInnerText', function(selector, done) {
|
|||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('waitForSnackbarReset', function(done) {
|
||||
this.click('vn-snackbar button')
|
||||
.waitForEmptyInnerText('vn-snackbar .text')
|
||||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('waitForSnackbar', function(done) {
|
||||
this.wait(500).waitForShapes('vn-snackbar .shape .text')
|
||||
.then(shapes => {
|
||||
done(null, shapes);
|
||||
});
|
||||
});
|
||||
|
||||
Nightmare.action('waitForURL', function(hashURL, done) {
|
||||
this.wait(hash => {
|
||||
return document.location.hash.includes(hash);
|
||||
|
@ -214,3 +221,26 @@ Nightmare.action('waitForShapes', function(selector, done) {
|
|||
return shapesList;
|
||||
}, done, selector);
|
||||
});
|
||||
|
||||
Nightmare.action('waitForSnackbar', function(done) {
|
||||
this.wait(500).waitForShapes('vn-snackbar .shape .text')
|
||||
.then(shapes => {
|
||||
done(null, shapes);
|
||||
});
|
||||
});
|
||||
|
||||
Nightmare.action('waitForLastShape', function(selector, done) {
|
||||
this.wait(selector)
|
||||
.evaluate_now(selector => {
|
||||
let shape = document.querySelector(selector);
|
||||
|
||||
return shape.innerText;
|
||||
}, done, selector);
|
||||
});
|
||||
|
||||
Nightmare.action('waitForLastSnackbar', function(done) {
|
||||
this.wait(500).waitForLastShape('vn-snackbar .shape .text')
|
||||
.then(shapes => {
|
||||
done(null, shapes);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,128 +1,127 @@
|
|||
// import selectors from '../../helpers/selectors.js';
|
||||
// import createNightmare from '../../helpers/helpers';
|
||||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/helpers';
|
||||
|
||||
// describe('Ticket', () => {
|
||||
// describe('Create packages path', () => {
|
||||
// const nightmare = createNightmare();
|
||||
// #640 Ticket Create packages path is excluded
|
||||
xdescribe('Ticket Create packages path', () => {
|
||||
const nightmare = createNightmare();
|
||||
|
||||
// beforeAll(() => {
|
||||
// return nightmare
|
||||
// .waitForLogin('developer');
|
||||
// });
|
||||
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/index');
|
||||
// });
|
||||
// });
|
||||
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/index');
|
||||
});
|
||||
});
|
||||
|
||||
// it('should search for the ticket 1', () => {
|
||||
// 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);
|
||||
// });
|
||||
// });
|
||||
it('should search for the ticket 1', () => {
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
// 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 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).toEqual(jasmine.arrayContaining(['Some fields are invalid']));
|
||||
// });
|
||||
// });
|
||||
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).toEqual(jasmine.arrayContaining(['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).toEqual(jasmine.arrayContaining(['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).toEqual(jasmine.arrayContaining(['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).toEqual(jasmine.arrayContaining(['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).toEqual(jasmine.arrayContaining(['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).toEqual(jasmine.arrayContaining(['Package cannot be blank']));
|
||||
// });
|
||||
// });
|
||||
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).toEqual(jasmine.arrayContaining(['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).toEqual(jasmine.arrayContaining(['Data saved!']));
|
||||
// });
|
||||
// });
|
||||
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).toEqual(jasmine.arrayContaining(['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 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');
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
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');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue