wix-style-react
Version:
wix-style-react
182 lines (154 loc) • 5.96 kB
JavaScript
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 autoExampleDriver from 'wix-storybook-utils/AutoExampleDriver';
import { emptyStateTestkitFactory } from '../../testkit/protractor';
import { createStoryUrl, waitForVisibilityOf, scrollToElement } from 'wix-ui-test-utils/protractor';
import { storySettings } from '../../stories/EmptyState/storySettings';
describe('EmptyState', function () {
var storyUrl = createStoryUrl({
kind: storySettings.kind,
story: storySettings.storyName,
withExamples: false
});
var createDriverFactory = function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
var dataHook = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'storybook-empty-state';
var driver;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
driver = emptyStateTestkitFactory({ dataHook: dataHook });
_context.next = 3;
return waitForVisibilityOf(driver.element(), 'Cannot find EmptyState component');
case 3:
_context.next = 5;
return scrollToElement(driver.element());
case 5:
return _context.abrupt('return', driver);
case 6:
case 'end':
return _context.stop();
}
}
}, _callee, _this);
}));
return function createDriverFactory() {
return _ref.apply(this, arguments);
};
}();
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);
})));
beforeEach(_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 autoExampleDriver.reset();
case 2:
case 'end':
return _context3.stop();
}
}
}, _callee3, _this);
})));
eyes.it('should render for \'page\' theme', _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 autoExampleDriver.setProps({ theme: 'page' });
case 2:
_context4.next = 4;
return createDriverFactory();
case 4:
case 'end':
return _context4.stop();
}
}
}, _callee4, _this);
})));
eyes.it('should render for \'page-no-border\' theme', _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 autoExampleDriver.setProps({ theme: 'page-no-border' });
case 2:
_context5.next = 4;
return createDriverFactory();
case 4:
case 'end':
return _context5.stop();
}
}
}, _callee5, _this);
})));
eyes.it('should render for \'section\' theme', _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
return regeneratorRuntime.wrap(function _callee6$(_context6) {
while (1) {
switch (_context6.prev = _context6.next) {
case 0:
_context6.next = 2;
return autoExampleDriver.setProps({ theme: 'section' });
case 2:
_context6.next = 4;
return createDriverFactory();
case 4:
case 'end':
return _context6.stop();
}
}
}, _callee6, _this);
})));
eyes.it('should render without a title', _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
return regeneratorRuntime.wrap(function _callee7$(_context7) {
while (1) {
switch (_context7.prev = _context7.next) {
case 0:
_context7.next = 2;
return autoExampleDriver.setProps({ title: '' });
case 2:
_context7.next = 4;
return createDriverFactory();
case 4:
case 'end':
return _context7.stop();
}
}
}, _callee7, _this);
})));
eyes.it('should render without a subtitle', _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8() {
return regeneratorRuntime.wrap(function _callee8$(_context8) {
while (1) {
switch (_context8.prev = _context8.next) {
case 0:
_context8.next = 2;
return autoExampleDriver.setProps({ subtitle: '' });
case 2:
_context8.next = 4;
return createDriverFactory();
case 4:
case 'end':
return _context8.stop();
}
}
}, _callee8, _this);
})));
});