wix-style-react
Version:
73 lines (64 loc) • 2.39 kB
JavaScript
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
import _regeneratorRuntime from "@babel/runtime/regenerator";
/*
Testkit is not exported!!!
Input.uni.driver.js is exported as the puppeteer testkit
This driver is here only because it is still used inside NoBorderInput.puppeteer.driver.js
Once changed, this file will be removed!
*/
var inputDriverFactory = /*#__PURE__*/function () {
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(component, page) {
var input;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return component.$('input');
case 2:
input = _context2.sent;
return _context2.abrupt("return", {
element: function element() {
return component;
},
enterText: function () {
var _enterText = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(text) {
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return input.focus();
case 2:
_context.next = 4;
return input.type(text);
case 4:
case "end":
return _context.stop();
}
}
}, _callee);
}));
function enterText(_x3) {
return _enterText.apply(this, arguments);
}
return enterText;
}(),
getText: function getText() {
return page.evaluate(function (_input) {
return _input.value;
}, input);
}
});
case 4:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
return function inputDriverFactory(_x, _x2) {
return _ref.apply(this, arguments);
};
}();
export default inputDriverFactory;