This commit is contained in:
Carlos Jimenez Ruiz 2019-02-07 09:07:00 +01:00
parent 01c130fc52
commit eb4e29fb48
3 changed files with 18 additions and 3 deletions

View File

@ -191,6 +191,18 @@ let actions = {
}, done, selector);
},
waitImgLoad: function(selector, done) {
this.wait(selector)
.wait(selector => {
const imageReady = document.querySelector(selector).complete;
return imageReady;
}, selector)
.then(done)
.catch(() => {
done(new Error(`image ${selector}, load timed out`));
});
},
clickIfVisible: function(selector, done) {
this.wait(selector)
.isVisible(selector)
@ -215,7 +227,7 @@ let actions = {
return document.querySelectorAll(selector).length === count;
}, selector, count)
.then(done)
.catch(err => {
.catch(() => {
done(new Error(`.waitForNumberOfElements() for ${selector}, count ${count} timed out`));
});
},
@ -239,7 +251,9 @@ let actions = {
return true;
}, selector, className)
.then(done)
.catch(done);
.catch(() => {
done(new Error(`.waitForClassPresent() for ${selector}, class ${className} timed out`));
});
},
waitForTextInElement: function(selector, name, done) {

View File

@ -335,6 +335,7 @@ export default {
saleDescriptorPopoverSummaryButton: 'vn-item-descriptor-popover a[href="#!/item/1/summary"]',
descriptorItemDiaryButton: `vn-item-descriptor .quicklinks.ng-scope > vn-horizontal > a > vn-icon > i`,
newItemButton: 'vn-float-button[icon="add"]',
firstSaleDescriptorImage: 'vn-ticket-sale vn-item-descriptor-popover > vn-popover vn-item-descriptor img',
firstSaleText: `vn-table div > vn-tbody > vn-tr:nth-child(1)`,
firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) vn-td:nth-child(3) > img',
firstSaleZoomedImage: 'body > div > div > img',

View File

@ -87,7 +87,7 @@ describe('Ticket Edit sale path', () => {
it(`should click on the first sale ID making the item descriptor visible`, async() => {
const visible = await nightmare
.waitToClick(selectors.ticketSales.firstSaleID)
.wait(1000)
.waitImgLoad(selectors.ticketSales.firstSaleDescriptorImage)
.isVisible(selectors.ticketSales.saleDescriptorPopover);
expect(visible).toBeTruthy();