UNPKG

wix-style-react

Version:
119 lines (98 loc) 4.33 kB
'use strict'; 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; }; var _eyesIt = require('../../test/utils/eyes-it'); var _storybookHelpers = require('../../test/utils/storybook-helpers'); var _storySettings = require('../../stories/IconButton/storySettings'); 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"); }); }; } describe('IconButton', function () { var storyUrl = (0, _storybookHelpers.createStoryUrl)({ kind: _storySettings.storySettings.kind, story: _storySettings.storySettings.storyName }); beforeAll(_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 browser.get(storyUrl); case 2: case 'end': return _context.stop(); } } }, _callee, undefined); }))); var testStoryUrl = function testStoryUrl(testName) { return (0, _storybookHelpers.createTestStoryUrl)(_extends({}, _storySettings.storySettings, { testName: testName })); }; var eyes = (0, _eyesIt.eyesItInstance)(); eyes.it('Make a screenshoft of all IconButton examples', function () { expect(true).toBeTruthy(); }); describe('test stories', function () { var checkTestStory = function () { var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(testName) { return regeneratorRuntime.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return browser.get(testStoryUrl(testName)); case 2: eyes.checkWindow(testName); case 3: case 'end': return _context2.stop(); } } }, _callee2, undefined); })); return function checkTestStory(_x) { return _ref2.apply(this, arguments); }; }(); eyes.it('check iconbutton skins', _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 checkTestStory(_storySettings.testStories.ICONBUTTON_SKINS); case 2: case 'end': return _context3.stop(); } } }, _callee3, undefined); }))); eyes.it('check iconbutton affixes', _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 checkTestStory(_storySettings.testStories.ICONBUTTON_SIZES); case 2: case 'end': return _context4.stop(); } } }, _callee4, undefined); }))); eyes.it('check iconbutton sizes', _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() { return regeneratorRuntime.wrap(function _callee5$(_context5) { while (1) { switch (_context5.prev = _context5.next) { case 0: _context5.next = 2; return checkTestStory(_storySettings.testStories.ICONBUTTON_AS); case 2: case 'end': return _context5.stop(); } } }, _callee5, undefined); }))); }); });