This commit is contained in:
parent
01c130fc52
commit
eb4e29fb48
|
@ -191,6 +191,18 @@ let actions = {
|
||||||
}, done, selector);
|
}, 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) {
|
clickIfVisible: function(selector, done) {
|
||||||
this.wait(selector)
|
this.wait(selector)
|
||||||
.isVisible(selector)
|
.isVisible(selector)
|
||||||
|
@ -215,7 +227,7 @@ let actions = {
|
||||||
return document.querySelectorAll(selector).length === count;
|
return document.querySelectorAll(selector).length === count;
|
||||||
}, selector, count)
|
}, selector, count)
|
||||||
.then(done)
|
.then(done)
|
||||||
.catch(err => {
|
.catch(() => {
|
||||||
done(new Error(`.waitForNumberOfElements() for ${selector}, count ${count} timed out`));
|
done(new Error(`.waitForNumberOfElements() for ${selector}, count ${count} timed out`));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -239,7 +251,9 @@ let actions = {
|
||||||
return true;
|
return true;
|
||||||
}, selector, className)
|
}, selector, className)
|
||||||
.then(done)
|
.then(done)
|
||||||
.catch(done);
|
.catch(() => {
|
||||||
|
done(new Error(`.waitForClassPresent() for ${selector}, class ${className} timed out`));
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
waitForTextInElement: function(selector, name, done) {
|
waitForTextInElement: function(selector, name, done) {
|
||||||
|
|
|
@ -335,6 +335,7 @@ export default {
|
||||||
saleDescriptorPopoverSummaryButton: 'vn-item-descriptor-popover a[href="#!/item/1/summary"]',
|
saleDescriptorPopoverSummaryButton: 'vn-item-descriptor-popover a[href="#!/item/1/summary"]',
|
||||||
descriptorItemDiaryButton: `vn-item-descriptor .quicklinks.ng-scope > vn-horizontal > a > vn-icon > i`,
|
descriptorItemDiaryButton: `vn-item-descriptor .quicklinks.ng-scope > vn-horizontal > a > vn-icon > i`,
|
||||||
newItemButton: 'vn-float-button[icon="add"]',
|
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)`,
|
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',
|
firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) vn-td:nth-child(3) > img',
|
||||||
firstSaleZoomedImage: 'body > div > div > img',
|
firstSaleZoomedImage: 'body > div > div > img',
|
||||||
|
|
|
@ -87,7 +87,7 @@ describe('Ticket Edit sale path', () => {
|
||||||
it(`should click on the first sale ID making the item descriptor visible`, async() => {
|
it(`should click on the first sale ID making the item descriptor visible`, async() => {
|
||||||
const visible = await nightmare
|
const visible = await nightmare
|
||||||
.waitToClick(selectors.ticketSales.firstSaleID)
|
.waitToClick(selectors.ticketSales.firstSaleID)
|
||||||
.wait(1000)
|
.waitImgLoad(selectors.ticketSales.firstSaleDescriptorImage)
|
||||||
.isVisible(selectors.ticketSales.saleDescriptorPopover);
|
.isVisible(selectors.ticketSales.saleDescriptorPopover);
|
||||||
|
|
||||||
expect(visible).toBeTruthy();
|
expect(visible).toBeTruthy();
|
||||||
|
|
Loading…
Reference in New Issue