UNPKG

wix-style-react

Version:
134 lines (110 loc) 5.24 kB
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); var _this = this; 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 eyes from 'eyes.it'; import { createStoryUrl, waitForVisibilityOf, scrollToElement } from 'wix-ui-test-utils/protractor'; import { storySettings } from '../../stories/TableActionCell/storySettings'; import { tableActionCellTestkitFactory } from '../../testkit/protractor'; var hoverElement = function hoverElement(element) { return browser.actions().mouseMove(element).perform(); }; describe('Table Action Cell', function () { var storyUrl = createStoryUrl({ kind: storySettings.kind, story: storySettings.storyName }); var verifyItem = function () { var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(name, dataHook) { var driver, element; return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: driver = tableActionCellTestkitFactory({ dataHook: dataHook }); element = driver.element(); _context.next = 4; return waitForVisibilityOf(element, 'Cannot find ' + dataHook); case 4: _context.next = 6; return scrollToElement(element); case 6: _context.next = 8; return eyes.checkWindow(name + ' idle'); case 8: _context.next = 10; return hoverElement(element); case 10: _context.next = 12; return eyes.checkWindow(name + ' hovered'); case 12: _context.prev = 12; _context.next = 15; return driver.getHiddenActionsPopoverMenu().click(); case 15: _context.next = 17; return eyes.checkWindow(name + ' PopoverMenu opened'); case 17: _context.next = 19; return driver.getHiddenActionsPopoverMenu().click(); case 19: _context.next = 23; break; case 21: _context.prev = 21; _context.t0 = _context['catch'](12); case 23: case 'end': return _context.stop(); } } }, _callee, _this, [[12, 21]]); })); return function verifyItem(_x, _x2) { return _ref.apply(this, arguments); }; }(); var examples = { 'Blue primary action': 'story-primary-blue', 'White primary action': 'story-primary-white', 'Primary and secondary actions': 'story-primary-secondary', 'Primary and hidden secondary actions': 'story-primary-hidden-secondary', 'With custom PopoverMenu props': 'story-popover-menu-props', 'Always visible secondary actions': 'story-always-visible-secondary', 'Only secondary actions': 'story-only-secondary', 'Only visible secondary actions': 'story-only-visible-secondary', 'Primary and secondary actions with RTL': 'story-primary-secondary-rtl' }; beforeAll(_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 browser.get(storyUrl); case 2: case 'end': return _context2.stop(); } } }, _callee2, _this); }))); Object.entries(examples).forEach(function (_ref3) { var _ref4 = _slicedToArray(_ref3, 2), name = _ref4[0], dataHook = _ref4[1]; eyes.it('should render correctly for ' + name, _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 verifyItem(name, dataHook); case 2: case 'end': return _context3.stop(); } } }, _callee3, _this); }))); }); });