wix-style-react
Version:
wix-style-react
78 lines (65 loc) • 3.07 kB
JavaScript
var _this = this;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
import { baseUniDriverFactory } from 'wix-ui-test-utils/base-driver';
export var generatedTestComponentDriverFactory = function generatedTestComponentDriverFactory(base) {
return _extends({}, baseUniDriverFactory(base), {
/** Get the current count */
getCountText: function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
return _context.abrupt('return', base.$('[data-hook="generatedTestComponent-count"]').text());
case 1:
case 'end':
return _context.stop();
}
}
}, _callee, _this);
}));
return function getCountText() {
return _ref.apply(this, arguments);
};
}(),
/** Click the button */
clickButton: function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
return _context2.abrupt('return', base.$('[data-hook="generatedTestComponent-button"]').click());
case 1:
case 'end':
return _context2.stop();
}
}
}, _callee2, _this);
}));
return function clickButton() {
return _ref2.apply(this, arguments);
};
}(),
/** Get the button's text */
getButtonText: function () {
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
return regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
return _context3.abrupt('return', base.$('[data-hook="generatedTestComponent-button"]').text());
case 1:
case 'end':
return _context3.stop();
}
}
}, _callee3, _this);
}));
return function getButtonText() {
return _ref3.apply(this, arguments);
};
}()
});
};