wix-style-react
Version:
wix-style-react
105 lines (90 loc) • 3.76 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 { eyesItInstance } from '../../test/utils/eyes-it';
import { createStoryUrl } from '../../test/utils/storybook-helpers';
import { avatarTestkitFactory } from '../../testkit/protractor';
import { storySettings } from '../../stories/Avatar/storySettings';
import { getTestStoryKind } from '../../stories/storiesHierarchy';
describe('Avatar', function () {
describe('AutoStory Page', function () {
var avatarDriver = avatarTestkitFactory({
dataHook: storySettings.dataHook
});
var url = createStoryUrl({
kind: storySettings.category,
story: storySettings.storyName
});
describe('driver sanity', function () {
it('should have text content type by default', _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(url);
case 2:
_context.next = 4;
return browser.wait(avatarDriver.exists(), 5000, 'Cannot find <Avatar/>');
case 4:
_context.t0 = expect;
_context.next = 7;
return avatarDriver.getContentType();
case 7:
_context.t1 = _context.sent;
(0, _context.t0)(_context.t1).toBe('text');
_context.t2 = expect;
_context.next = 12;
return avatarDriver.getTextContent();
case 12:
_context.t3 = _context.sent;
(0, _context.t2)(_context.t3).toBe('JD');
case 14:
case 'end':
return _context.stop();
}
}
}, _callee, _this);
})));
});
});
describe('Test Pages', function () {
var eyes = eyesItInstance();
function testUrl(testCase) {
return createStoryUrl({
kind: getTestStoryKind({
category: storySettings.category,
storyName: storySettings.storyName
}),
story: testCase
});
}
eyes.it('should render in all sizes', _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(testUrl(storySettings.testStories.SIZES));
case 2:
case 'end':
return _context2.stop();
}
}
}, _callee2, _this);
})));
eyes.it('should render text with all bg colors', _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 browser.get(testUrl(storySettings.testStories.COLORS));
case 2:
case 'end':
return _context3.stop();
}
}
}, _callee3, _this);
})));
});
});