UNPKG

wix-style-react

Version:
58 lines (51 loc) 1.95 kB
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator"; import _regeneratorRuntime from "@babel/runtime/regenerator"; var filePickerDriverFactory = function filePickerDriverFactory(component) { return { click: function click() { return component.click(); }, uploadFile: function () { var _uploadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(file) { return _regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: _context.next = 2; return browser.executeScript("document.querySelector(['[data-hook=\"file-upload-input\"]']).style.display = 'block'"); case 2: _context.next = 4; return browser.$('[data-hook="file-upload-input"]').sendKeys(file); case 4: _context.next = 6; return browser.executeScript("document.querySelector(['[data-hook=\"file-upload-input\"]']).style.display = 'none'"); case 6: case "end": return _context.stop(); } } }, _callee); })); function uploadFile(_x) { return _uploadFile.apply(this, arguments); } return uploadFile; }(), getSubLabel: function getSubLabel() { return component.$("[data-hook=\"sub-label\"]").getText(); }, getMainLabel: function getMainLabel() { return component.$("[data-hook=\"main-label\"]").getText(); }, hasError: function hasError() { return !!component.$("[data-hook=\"filePicker-error\"]"); }, errorMessage: function errorMessage() { return component.$("[data-hook=\"filePicker-error\"]").getText(); }, element: function element() { return component; } }; }; export default filePickerDriverFactory;