UNPKG

wix-style-react

Version:
253 lines (209 loc) • 8.43 kB
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; import _regeneratorRuntime from "@babel/runtime/regenerator"; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } import { baseUniDriverFactory } from 'wix-ui-test-utils/base-driver'; export var messageBoxMarketerialLayoutUniDriverFactory = function messageBoxMarketerialLayoutUniDriverFactory(base) { var getPrimaryButtonBase = function getPrimaryButtonBase() { return base.$('[data-hook="primary-button"]'); }; var getPrimaryButtonNodeBase = function getPrimaryButtonNodeBase() { return base.$('[data-hook="primary-button-node"]'); }; var getSecondaryButtonBase = function getSecondaryButtonBase() { return base.$('[data-hook="secondary-button"]'); }; var getCloseButtonBase = function getCloseButtonBase() { return base.$('[data-hook="close-button"]'); }; var getMessageBoxTitleBase = function getMessageBoxTitleBase() { return base.$('[data-hook="message-box-title"]'); }; var getHeaderImageBase = function getHeaderImageBase() { return base.$('[data-hook="header-image"]'); }; return _objectSpread(_objectSpread({}, baseUniDriverFactory(base)), {}, { getPrimaryButtonText: function getPrimaryButtonText() { return getPrimaryButtonBase().text(); }, getPrimaryButton: function () { var _getPrimaryButton = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() { return _regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: _context.next = 2; return getPrimaryButtonBase().exists(); case 2: if (!_context.sent) { _context.next = 6; break; } _context.t0 = getPrimaryButtonBase(); _context.next = 7; break; case 6: _context.t0 = null; case 7: return _context.abrupt("return", _context.t0); case 8: case "end": return _context.stop(); } } }, _callee); })); function getPrimaryButton() { return _getPrimaryButton.apply(this, arguments); } return getPrimaryButton; }(), getPrimaryButtonNode: function () { var _getPrimaryButtonNode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() { return _regeneratorRuntime.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return getPrimaryButtonNodeBase().exists(); case 2: if (!_context2.sent) { _context2.next = 6; break; } _context2.t0 = getPrimaryButtonNodeBase(); _context2.next = 7; break; case 6: _context2.t0 = null; case 7: return _context2.abrupt("return", _context2.t0); case 8: case "end": return _context2.stop(); } } }, _callee2); })); function getPrimaryButtonNode() { return _getPrimaryButtonNode.apply(this, arguments); } return getPrimaryButtonNode; }(), getSecondaryButtonText: function getSecondaryButtonText() { return getSecondaryButtonBase().text(); }, getSecondaryButton: function () { var _getSecondaryButton = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() { return _regeneratorRuntime.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: _context3.next = 2; return getSecondaryButtonBase().exists(); case 2: if (!_context3.sent) { _context3.next = 6; break; } _context3.t0 = getSecondaryButtonBase(); _context3.next = 7; break; case 6: _context3.t0 = null; case 7: return _context3.abrupt("return", _context3.t0); case 8: case "end": return _context3.stop(); } } }, _callee3); })); function getSecondaryButton() { return _getSecondaryButton.apply(this, arguments); } return getSecondaryButton; }(), getHeaderCloseButton: function () { var _getHeaderCloseButton = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() { return _regeneratorRuntime.wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: _context4.next = 2; return getCloseButtonBase().exists(); case 2: if (!_context4.sent) { _context4.next = 6; break; } _context4.t0 = getCloseButtonBase(); _context4.next = 7; break; case 6: _context4.t0 = null; case 7: return _context4.abrupt("return", _context4.t0); case 8: case "end": return _context4.stop(); } } }, _callee4); })); function getHeaderCloseButton() { return _getHeaderCloseButton.apply(this, arguments); } return getHeaderCloseButton; }(), clickOnPrimaryButton: function clickOnPrimaryButton() { return getPrimaryButtonBase().click(); }, clickOnSecondaryButton: function clickOnSecondaryButton() { return getSecondaryButtonBase().click(); }, closeMessageBox: function closeMessageBox() { return getCloseButtonBase().click(); }, getTitle: function getTitle() { return getMessageBoxTitleBase().text(); }, getContentBySelector: function () { var _getContentBySelector = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(selector) { return _regeneratorRuntime.wrap(function _callee5$(_context5) { while (1) { switch (_context5.prev = _context5.next) { case 0: _context5.next = 2; return base.$(selector).exists(); case 2: if (!_context5.sent) { _context5.next = 6; break; } _context5.t0 = base.$(selector); _context5.next = 7; break; case 6: _context5.t0 = null; case 7: return _context5.abrupt("return", _context5.t0); case 8: case "end": return _context5.stop(); } } }, _callee5); })); function getContentBySelector(_x) { return _getContentBySelector.apply(this, arguments); } return getContentBySelector; }(), getImageSrc: function getImageSrc() { return getHeaderImageBase().attr('src'); } }); };