2018-10-25 14:44:03 +00:00
|
|
|
/* eslint no-invalid-this: "off" */
|
|
|
|
|
2017-09-15 10:24:37 +00:00
|
|
|
import Nightmare from 'nightmare';
|
2018-02-20 09:00:19 +00:00
|
|
|
import {URL} from 'url';
|
2019-01-26 12:12:18 +00:00
|
|
|
import config from './config.js';
|
2017-09-15 10:24:37 +00:00
|
|
|
|
2019-01-26 12:12:18 +00:00
|
|
|
let currentUser;
|
2017-10-31 07:14:33 +00:00
|
|
|
|
2018-11-21 15:59:09 +00:00
|
|
|
Nightmare.asyncAction = function(name, func) {
|
|
|
|
Nightmare.action(name, function(...args) {
|
|
|
|
let done = args[arguments.length - 1];
|
|
|
|
func.apply(this, args)
|
|
|
|
.then(result => done(null, result))
|
|
|
|
.catch(done);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
Nightmare.asyncAction('clearInput', async function(selector) {
|
2018-10-25 14:44:03 +00:00
|
|
|
const backSpaces = [];
|
2018-10-31 10:58:10 +00:00
|
|
|
for (let i = 0; i < 50; i += 1)
|
2017-09-15 10:24:37 +00:00
|
|
|
backSpaces.push('\u0008');
|
2018-10-31 10:58:10 +00:00
|
|
|
|
2019-01-23 14:34:16 +00:00
|
|
|
await this.write(selector, backSpaces.join(''));
|
2017-09-15 10:24:37 +00:00
|
|
|
});
|
|
|
|
|
2018-11-22 11:34:20 +00:00
|
|
|
let actions = {
|
|
|
|
login: function(userName, done) {
|
2019-01-26 12:12:18 +00:00
|
|
|
if (currentUser)
|
|
|
|
this.waitToClick('#logout');
|
|
|
|
|
|
|
|
let doLogin = () => {
|
|
|
|
this.wait(`vn-login input[name=user]`)
|
|
|
|
.write(`vn-login input[name=user]`, userName)
|
|
|
|
.write(`vn-login input[name=password]`, 'nightmare')
|
|
|
|
.click(`vn-login input[type=submit]`)
|
|
|
|
.then(() => {
|
|
|
|
currentUser = userName;
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(done);
|
|
|
|
};
|
|
|
|
|
|
|
|
this.waitForURL('#!/login')
|
|
|
|
.then(doLogin)
|
|
|
|
.catch(() => {
|
|
|
|
this.goto(`${config.url}/#!/login`)
|
|
|
|
.then(doLogin)
|
|
|
|
.catch(done);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
waitForLogin: function(userName, done) {
|
|
|
|
if (currentUser === userName) {
|
|
|
|
return this.waitToClick('vn-topbar a[ui-sref="home"]')
|
|
|
|
.waitForURL('#!/')
|
2019-02-06 15:08:23 +00:00
|
|
|
.changeLanguageToEnglish()
|
2019-01-26 12:12:18 +00:00
|
|
|
.then(done)
|
|
|
|
.catch(done);
|
|
|
|
}
|
|
|
|
return this.login(userName)
|
|
|
|
.waitForURL('#!/')
|
|
|
|
.url()
|
|
|
|
.changeLanguageToEnglish()
|
|
|
|
.then(done)
|
2019-01-23 14:34:16 +00:00
|
|
|
.catch(done);
|
|
|
|
},
|
|
|
|
|
|
|
|
resetLogin: function(done) {
|
|
|
|
this.then(() => {
|
|
|
|
currentUser = undefined;
|
|
|
|
done();
|
|
|
|
})
|
2018-11-22 11:34:20 +00:00
|
|
|
.catch(done);
|
|
|
|
},
|
|
|
|
|
|
|
|
changeLanguageToEnglish: function(done) {
|
2019-01-30 23:33:43 +00:00
|
|
|
let langSelector = 'vn-user-configuration-popover vn-autocomplete[field="$ctrl.lang"]';
|
|
|
|
|
|
|
|
this.waitToClick('#user')
|
|
|
|
.wait(langSelector)
|
|
|
|
.waitToGetProperty(`${langSelector} input`, 'value')
|
|
|
|
.then(lang => {
|
2019-01-30 23:34:49 +00:00
|
|
|
if (lang === 'English') {
|
2018-11-22 11:34:20 +00:00
|
|
|
this.then(done)
|
|
|
|
.catch(done);
|
|
|
|
} else {
|
2019-01-30 23:33:43 +00:00
|
|
|
this.autocompleteSearch(langSelector, 'English')
|
2018-11-22 11:34:20 +00:00
|
|
|
.then(done)
|
|
|
|
.catch(done);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2018-11-23 07:05:57 +00:00
|
|
|
selectModule: function(moduleName, done) {
|
2019-01-20 17:48:03 +00:00
|
|
|
this.waitToClick(`vn-home a[ui-sref="${moduleName}.index"]`)
|
2018-11-23 07:05:57 +00:00
|
|
|
.waitForURL(moduleName)
|
|
|
|
.then(done)
|
|
|
|
.catch(done);
|
|
|
|
},
|
|
|
|
|
|
|
|
loginAndModule: function(userName, moduleName, done) {
|
|
|
|
this.waitForLogin(userName)
|
|
|
|
.selectModule(moduleName)
|
|
|
|
.then(done)
|
|
|
|
.catch(done);
|
|
|
|
},
|
|
|
|
|
2018-11-22 11:34:20 +00:00
|
|
|
parsedUrl: function(done) {
|
|
|
|
this.url()
|
|
|
|
.then(url => {
|
|
|
|
done(null, new URL(url));
|
|
|
|
}).catch(done);
|
|
|
|
},
|
|
|
|
|
|
|
|
getProperty: function(selector, property, done) {
|
|
|
|
this.evaluate_now((selector, property) => {
|
|
|
|
return document.querySelector(selector)[property].replace(/\s+/g, ' ').trim();
|
|
|
|
}, done, selector, property);
|
|
|
|
},
|
|
|
|
|
|
|
|
waitPropertyLength: function(selector, property, minLength, done) {
|
|
|
|
this.wait((selector, property, minLength) => {
|
|
|
|
const element = document.querySelector(selector);
|
|
|
|
return element && element[property] != null && element[property] !== '' && element[property].length >= minLength;
|
|
|
|
}, selector, property, minLength)
|
|
|
|
.getProperty(selector, property)
|
|
|
|
.then(result => done(null, result), done);
|
|
|
|
},
|
|
|
|
|
2019-02-07 13:33:52 +00:00
|
|
|
waitPropertyValue: function(selector, property, status, done) {
|
|
|
|
this.wait(selector)
|
|
|
|
.wait((selector, property, status) => {
|
|
|
|
const element = document.querySelector(selector);
|
|
|
|
return element[property] === status;
|
|
|
|
}, selector, property, status)
|
|
|
|
.then(done)
|
|
|
|
.catch(done);
|
|
|
|
},
|
|
|
|
|
2018-11-22 11:34:20 +00:00
|
|
|
waitToGetProperty: function(selector, property, done) {
|
|
|
|
this.wait((selector, property) => {
|
|
|
|
const element = document.querySelector(selector);
|
|
|
|
return element && element[property] != null && element[property] !== '';
|
|
|
|
}, selector, property)
|
|
|
|
.getProperty(selector, property)
|
|
|
|
.then(result => done(null, result), done);
|
|
|
|
},
|
|
|
|
|
|
|
|
write: function(selector, text, done) {
|
|
|
|
this.wait(selector)
|
|
|
|
.type(selector, text)
|
|
|
|
.then(done)
|
|
|
|
.catch(done);
|
|
|
|
},
|
2017-09-15 10:24:37 +00:00
|
|
|
|
2018-11-22 11:34:20 +00:00
|
|
|
waitToClick: function(selector, done) {
|
|
|
|
this.wait(selector)
|
|
|
|
.click(selector)
|
|
|
|
.then(done)
|
|
|
|
.catch(done);
|
|
|
|
},
|
|
|
|
|
2019-02-26 16:32:32 +00:00
|
|
|
waitToFocus: function(selector, done) {
|
|
|
|
this.wait(selector)
|
|
|
|
.evaluate_now(selector => {
|
|
|
|
let element = document.querySelector(selector);
|
|
|
|
element.focus();
|
|
|
|
}, done, selector)
|
|
|
|
.then(done)
|
|
|
|
.catch(done);
|
|
|
|
},
|
|
|
|
|
2018-11-22 11:34:20 +00:00
|
|
|
isVisible: function(selector, done) {
|
|
|
|
this.wait(selector)
|
|
|
|
.evaluate_now(elementSelector => {
|
|
|
|
const selectorMatches = document.querySelectorAll(elementSelector);
|
|
|
|
const element = selectorMatches[0];
|
|
|
|
if (selectorMatches.length > 1)
|
|
|
|
throw new Error(`multiple matches of ${elementSelector} found`);
|
|
|
|
|
|
|
|
let isVisible = false;
|
|
|
|
if (element) {
|
|
|
|
const eventHandler = event => {
|
|
|
|
event.preventDefault();
|
|
|
|
isVisible = true;
|
|
|
|
};
|
|
|
|
element.addEventListener('mouseover', eventHandler);
|
|
|
|
const elementBoundaries = element.getBoundingClientRect();
|
|
|
|
const x = elementBoundaries.left + element.offsetWidth / 2;
|
|
|
|
const y = elementBoundaries.top + element.offsetHeight / 2;
|
|
|
|
const elementInCenter = document.elementFromPoint(x, y);
|
|
|
|
const elementInTopLeft = document.elementFromPoint(elementBoundaries.left, elementBoundaries.top);
|
|
|
|
const elementInBottomRight = document.elementFromPoint(elementBoundaries.right, elementBoundaries.bottom);
|
|
|
|
const e = new MouseEvent('mouseover', {
|
|
|
|
view: window,
|
|
|
|
bubbles: true,
|
|
|
|
cancelable: true,
|
|
|
|
});
|
|
|
|
if (elementInCenter)
|
|
|
|
elementInCenter.dispatchEvent(e);
|
|
|
|
|
|
|
|
if (elementInTopLeft)
|
|
|
|
elementInTopLeft.dispatchEvent(e);
|
|
|
|
|
|
|
|
if (elementInBottomRight)
|
|
|
|
elementInBottomRight.dispatchEvent(e);
|
|
|
|
|
|
|
|
element.removeEventListener('mouseover', eventHandler);
|
|
|
|
}
|
|
|
|
return isVisible;
|
|
|
|
}, done, selector);
|
|
|
|
},
|
|
|
|
|
2019-02-07 08:07:00 +00:00
|
|
|
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`));
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2019-02-04 13:47:55 +00:00
|
|
|
clickIfVisible: function(selector, done) {
|
|
|
|
this.wait(selector)
|
|
|
|
.isVisible(selector)
|
|
|
|
.then(visible => {
|
|
|
|
if (visible)
|
|
|
|
return this.click(selector);
|
|
|
|
|
|
|
|
throw new Error(`invisible selector: ${selector}`);
|
|
|
|
})
|
|
|
|
.then(done)
|
|
|
|
.catch(done);
|
|
|
|
},
|
|
|
|
|
2018-11-22 11:34:20 +00:00
|
|
|
countElement: function(selector, done) {
|
|
|
|
this.evaluate_now(selector => {
|
|
|
|
return document.querySelectorAll(selector).length;
|
2018-10-25 14:44:03 +00:00
|
|
|
}, done, selector);
|
2018-11-22 11:34:20 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
waitForNumberOfElements: function(selector, count, done) {
|
|
|
|
this.wait((selector, count) => {
|
|
|
|
return document.querySelectorAll(selector).length === count;
|
|
|
|
}, selector, count)
|
|
|
|
.then(done)
|
2019-02-07 08:07:00 +00:00
|
|
|
.catch(() => {
|
2018-11-22 11:34:20 +00:00
|
|
|
done(new Error(`.waitForNumberOfElements() for ${selector}, count ${count} timed out`));
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
waitForClassNotPresent: function(selector, className, done) {
|
|
|
|
this.wait(selector)
|
|
|
|
.wait((selector, className) => {
|
|
|
|
if (!document.querySelector(selector).classList.contains(className))
|
|
|
|
return true;
|
|
|
|
}, selector, className)
|
|
|
|
.then(done)
|
|
|
|
.catch(() => {
|
|
|
|
done(new Error(`.waitForClassNotPresent() for ${selector}, class ${className} timed out`));
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
waitForClassPresent: function(selector, className, done) {
|
|
|
|
this.wait(selector)
|
|
|
|
.wait((selector, className) => {
|
|
|
|
if (document.querySelector(selector).classList.contains(className))
|
|
|
|
return true;
|
|
|
|
}, selector, className)
|
|
|
|
.then(done)
|
2019-02-07 08:07:00 +00:00
|
|
|
.catch(() => {
|
|
|
|
done(new Error(`.waitForClassPresent() for ${selector}, class ${className} timed out`));
|
|
|
|
});
|
2018-11-22 11:34:20 +00:00
|
|
|
},
|
|
|
|
|
2019-02-13 07:53:57 +00:00
|
|
|
waitForTextInElement: function(selector, text, done) {
|
2018-11-22 11:34:20 +00:00
|
|
|
this.wait(selector)
|
2019-02-13 07:53:57 +00:00
|
|
|
.wait((selector, text) => {
|
|
|
|
return document.querySelector(selector).innerText.toLowerCase().includes(text.toLowerCase());
|
|
|
|
}, selector, text)
|
2018-11-22 11:34:20 +00:00
|
|
|
.then(done)
|
|
|
|
.catch(done);
|
|
|
|
},
|
|
|
|
|
2019-02-07 13:33:52 +00:00
|
|
|
waitForTextInInput: function(selector, text, done) {
|
2018-11-22 11:34:20 +00:00
|
|
|
this.wait(selector)
|
2019-02-07 13:33:52 +00:00
|
|
|
.wait((selector, text) => {
|
|
|
|
return document.querySelector(selector).value.toLowerCase().includes(text.toLowerCase());
|
|
|
|
}, selector, text)
|
2018-11-22 11:34:20 +00:00
|
|
|
.then(done)
|
|
|
|
.catch(done);
|
|
|
|
},
|
|
|
|
|
|
|
|
waitForInnerText: function(selector, done) {
|
|
|
|
this.wait(selector)
|
|
|
|
.wait(selector => {
|
|
|
|
const innerText = document.querySelector(selector).innerText;
|
|
|
|
return innerText != null && innerText != '';
|
|
|
|
}, selector)
|
|
|
|
.evaluate_now(selector => {
|
|
|
|
return document.querySelector(selector).innerText;
|
|
|
|
}, done, selector);
|
|
|
|
},
|
|
|
|
|
|
|
|
waitForEmptyInnerText: function(selector, done) {
|
|
|
|
this.wait(selector => {
|
|
|
|
return document.querySelector(selector).innerText == '';
|
2018-10-25 14:44:03 +00:00
|
|
|
}, selector)
|
2018-11-22 11:34:20 +00:00
|
|
|
.then(done)
|
|
|
|
.catch(done);
|
|
|
|
},
|
2018-09-10 08:23:26 +00:00
|
|
|
|
2018-11-22 11:34:20 +00:00
|
|
|
waitForURL: function(hashURL, done) {
|
|
|
|
this.wait(hash => {
|
|
|
|
return document.location.hash.includes(hash);
|
|
|
|
}, hashURL)
|
|
|
|
.then(done)
|
|
|
|
.catch(done);
|
|
|
|
},
|
|
|
|
|
|
|
|
waitForShapes: function(selector, done) {
|
|
|
|
this.wait(selector)
|
|
|
|
.evaluate_now(selector => {
|
|
|
|
const shapes = document.querySelectorAll(selector);
|
|
|
|
const shapesList = [];
|
|
|
|
|
|
|
|
for (const shape of shapes)
|
|
|
|
shapesList.push(shape.innerText);
|
|
|
|
|
|
|
|
|
|
|
|
return shapesList;
|
|
|
|
}, done, selector);
|
|
|
|
},
|
|
|
|
|
|
|
|
waitForSnackbar: function(done) {
|
|
|
|
this.wait(500).waitForShapes('vn-snackbar .shape .text')
|
|
|
|
.then(shapes => {
|
|
|
|
done(null, shapes);
|
|
|
|
}).catch(done);
|
|
|
|
},
|
|
|
|
|
|
|
|
waitForLastShape: function(selector, done) {
|
|
|
|
this.wait(selector)
|
|
|
|
.evaluate_now(selector => {
|
|
|
|
const shape = document.querySelector(selector);
|
|
|
|
|
|
|
|
return shape.innerText;
|
|
|
|
}, done, selector);
|
|
|
|
},
|
|
|
|
|
|
|
|
waitForLastSnackbar: function(done) {
|
|
|
|
this.wait(500).waitForLastShape('vn-snackbar .shape .text')
|
|
|
|
.then(shapes => {
|
|
|
|
done(null, shapes);
|
|
|
|
}).catch(done);
|
2018-11-23 07:05:57 +00:00
|
|
|
},
|
|
|
|
|
2018-12-02 23:45:34 +00:00
|
|
|
accessToSearchResult: function(searchValue, done) {
|
2019-01-23 14:34:16 +00:00
|
|
|
this.write(`vn-searchbar input`, searchValue)
|
2018-12-02 23:45:34 +00:00
|
|
|
.click(`vn-searchbar vn-icon[icon="search"]`)
|
2019-03-01 10:08:31 +00:00
|
|
|
.wait(100)
|
2019-01-22 12:18:20 +00:00
|
|
|
.waitForNumberOfElements('.searchResult', 1)
|
2018-12-02 23:45:34 +00:00
|
|
|
.evaluate(() => {
|
|
|
|
return document.querySelector('ui-view vn-card vn-table') != null;
|
|
|
|
})
|
|
|
|
.then(result => {
|
|
|
|
if (result)
|
|
|
|
return this.waitToClick('ui-view vn-card vn-td');
|
|
|
|
|
|
|
|
return this.waitToClick('ui-view vn-card a');
|
|
|
|
})
|
|
|
|
.then(done)
|
|
|
|
.catch(done);
|
|
|
|
},
|
2018-11-23 07:05:57 +00:00
|
|
|
|
2018-12-02 23:45:34 +00:00
|
|
|
accessToSection: function(sectionRoute, done) {
|
|
|
|
this.wait(`vn-left-menu`)
|
|
|
|
.evaluate(sectionRoute => {
|
|
|
|
return document.querySelector(`vn-left-menu ul li ul li > a[ui-sref="${sectionRoute}"]`) != null;
|
|
|
|
}, sectionRoute)
|
|
|
|
.then(nested => {
|
|
|
|
if (!nested)
|
|
|
|
return this.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
|
|
|
|
|
|
|
|
return this.waitToClick('vn-left-menu .collapsed')
|
|
|
|
.wait('vn-left-menu .expanded')
|
|
|
|
.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
|
|
|
|
})
|
|
|
|
.then(done)
|
|
|
|
.catch(done);
|
2019-01-07 08:33:07 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
autocompleteSearch: function(autocompleteSelector, searchValue, done) {
|
|
|
|
this.wait(autocompleteSelector)
|
|
|
|
.waitToClick(`${autocompleteSelector} input`)
|
2019-01-23 14:34:16 +00:00
|
|
|
.write(`${autocompleteSelector} vn-drop-down input`, searchValue)
|
2019-01-07 08:33:07 +00:00
|
|
|
.waitToClick(`${autocompleteSelector} li.active`)
|
|
|
|
.wait((autocompleteSelector, searchValue) => {
|
|
|
|
return document.querySelector(`${autocompleteSelector} input`).value.toLowerCase().includes(searchValue.toLowerCase());
|
|
|
|
}, autocompleteSelector, searchValue)
|
|
|
|
.then(done)
|
|
|
|
.catch(() => {
|
|
|
|
done(new Error(`.autocompleteSearch() for ${autocompleteSelector}, timed out`));
|
|
|
|
});
|
2019-01-16 07:52:56 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
datePicker: function(datePickerSelector, changeMonth, done) {
|
|
|
|
this.wait(datePickerSelector)
|
|
|
|
.mousedown(datePickerSelector)
|
|
|
|
.wait('div.flatpickr-calendar.open');
|
|
|
|
if (changeMonth > 0)
|
2019-03-25 09:07:10 +00:00
|
|
|
this.mousedown('body > div.flatpickr-calendar.open > div.flatpickr-months > span.flatpickr-next-month > svg');
|
2019-01-16 07:52:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
if (changeMonth < 0)
|
2019-03-25 09:07:10 +00:00
|
|
|
this.mousedown('body > div.flatpickr-calendar.open > div.flatpickr-months > span.flatpickr-prev-month > svg');
|
2019-01-16 07:52:56 +00:00
|
|
|
|
|
|
|
const daySelector = 'div.flatpickr-calendar.open span.flatpickr-day:nth-child(16)';
|
|
|
|
|
|
|
|
this.wait(selector => {
|
|
|
|
return document.querySelector(selector);
|
|
|
|
}, daySelector)
|
|
|
|
.evaluate(selector => {
|
|
|
|
let event = new MouseEvent('mousedown', {
|
|
|
|
bubbles: true,
|
|
|
|
cancelable: true,
|
|
|
|
view: window
|
|
|
|
});
|
|
|
|
document.querySelector(selector).dispatchEvent(event);
|
|
|
|
}, daySelector)
|
|
|
|
.then(done)
|
|
|
|
.catch(() => {
|
|
|
|
done(new Error(`.datePicker(), for ${daySelector} timed out`));
|
|
|
|
});
|
2019-01-27 19:49:15 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
reloadSection: function(sectionRoute, done) {
|
|
|
|
this.waitToClick('vn-icon[icon="desktop_windows"]')
|
|
|
|
.wait('vn-card.summary')
|
|
|
|
.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`)
|
|
|
|
.then(done)
|
|
|
|
.catch(done);
|
2019-01-30 10:09:53 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
forceReloadSection: function(sectionRoute, done) {
|
|
|
|
this.waitToClick('vn-icon[icon="desktop_windows"]')
|
|
|
|
.waitToClick('button[response="ACCEPT"]')
|
|
|
|
.wait('vn-card.summary')
|
|
|
|
.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`)
|
|
|
|
.then(done)
|
|
|
|
.catch(done);
|
2019-02-14 19:17:22 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
checkboxState: function(selector, done) {
|
|
|
|
this.wait(selector)
|
|
|
|
.evaluate(checkboxSelector => {
|
|
|
|
return document.querySelector(checkboxSelector).getAttribute('class');
|
|
|
|
}, selector)
|
|
|
|
.then(elementClass => {
|
|
|
|
let classList = elementClass.split(' ');
|
|
|
|
let className;
|
|
|
|
|
|
|
|
if (classList.includes('md-checked'))
|
|
|
|
className = 'checked';
|
|
|
|
if (classList.includes('md-intermediate'))
|
|
|
|
className = 'intermediate';
|
|
|
|
if (!classList.includes('md-intermediate') && !classList.includes('md-checked'))
|
|
|
|
className = 'unchecked';
|
|
|
|
|
|
|
|
if (!className)
|
|
|
|
throw new Error(`selector: ${selector} is not a md-checkbox`);
|
|
|
|
|
|
|
|
done(null, className);
|
|
|
|
})
|
|
|
|
.then(done)
|
|
|
|
.catch(done);
|
2018-12-02 23:45:34 +00:00
|
|
|
}
|
2018-11-22 11:34:20 +00:00
|
|
|
};
|
2018-09-10 08:23:26 +00:00
|
|
|
|
2018-11-22 11:34:20 +00:00
|
|
|
Object.keys(actions).forEach(function(name) {
|
|
|
|
let fn = actions[name];
|
|
|
|
Nightmare.action(name, fn);
|
2018-09-10 08:23:26 +00:00
|
|
|
});
|