UNPKG

wix-style-react

Version:
92 lines (78 loc) 3.41 kB
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 { imageViewerTestkitFactory } from '../../testkit/protractor'; import { waitForVisibilityOf } from 'wix-ui-test-utils/protractor'; import { getStoryUrl } from '../../test/utils/storybook-helpers'; import autoExampleDriver from 'wix-storybook-utils/AutoExampleDriver'; describe('ImageViewer', function () { var storyUrl = getStoryUrl('3. Inputs', '3.10 ImageViewer'); var driver = imageViewerTestkitFactory({ dataHook: 'story-image-viewer' }); 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, _this); }))); afterEach(function () { return autoExampleDriver.reset(); }); eyes.it('should render', _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 waitForVisibilityOf(driver.element(), 'Cannot find ImageViewer'); case 2: case 'end': return _context2.stop(); } } }, _callee2, _this); }))); eyes.it('should render with an image', _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 waitForVisibilityOf(driver.element(), 'Cannot find ImageViewer'); case 2: _context3.next = 4; return autoExampleDriver.setProps({ imageUrl: 'https://static.wixstatic.com/media/c78d05b79ede429fb77c9d8ec4443b93.jpg/v1/fit/w_375,h_375/c78d05b79ede429fb77c9d8ec4443b93.jpg' }); case 4: case 'end': return _context3.stop(); } } }, _callee3, _this); }))); eyes.it('should render with an error', _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 waitForVisibilityOf(driver.element(), 'Cannot find ImageViewer'); case 2: _context4.next = 4; return autoExampleDriver.setProps({ error: true }); case 4: case 'end': return _context4.stop(); } } }, _callee4, _this); }))); });