2020-05-24 23:13:21 +05:30
|
|
|
/**
|
|
|
|
* WARNING: WIP
|
|
|
|
*
|
|
|
|
* Please do not copy from this spec or use it as an example for anything.
|
|
|
|
*
|
|
|
|
* This is in place to iteratively set up the frontend integration testing environment
|
|
|
|
* and will be improved upon in a later iteration.
|
|
|
|
*
|
|
|
|
* See https://gitlab.com/gitlab-org/gitlab/-/issues/208800 for more information.
|
|
|
|
*/
|
2020-10-24 23:57:45 +05:30
|
|
|
import { TEST_HOST } from 'helpers/test_constants';
|
|
|
|
import { useOverclockTimers } from 'test_helpers/utils/overclock_timers';
|
2020-05-24 23:13:21 +05:30
|
|
|
import { initIde } from '~/ide';
|
2020-10-24 23:57:45 +05:30
|
|
|
import extendStore from '~/ide/stores/extend';
|
|
|
|
|
|
|
|
const TEST_DATASET = {
|
|
|
|
emptyStateSvgPath: '/test/empty_state.svg',
|
|
|
|
noChangesStateSvgPath: '/test/no_changes_state.svg',
|
|
|
|
committedStateSvgPath: '/test/committed_state.svg',
|
|
|
|
pipelinesEmptyStateSvgPath: '/test/pipelines_empty_state.svg',
|
|
|
|
promotionSvgPath: '/test/promotion.svg',
|
|
|
|
ciHelpPagePath: '/test/ci_help_page',
|
|
|
|
webIDEHelpPagePath: '/test/web_ide_help_page',
|
|
|
|
clientsidePreviewEnabled: 'true',
|
|
|
|
renderWhitespaceInCode: 'false',
|
|
|
|
codesandboxBundlerUrl: 'test/codesandbox_bundler',
|
|
|
|
};
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
describe('WebIDE', () => {
|
2020-10-24 23:57:45 +05:30
|
|
|
useOverclockTimers();
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
let vm;
|
|
|
|
let root;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
root = document.createElement('div');
|
2020-10-24 23:57:45 +05:30
|
|
|
document.body.appendChild(root);
|
2020-05-24 23:13:21 +05:30
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
global.jsdom.reconfigure({
|
|
|
|
url: `${TEST_HOST}/-/ide/project/gitlab-test/lorem-ipsum`,
|
2020-05-24 23:13:21 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
vm.$destroy();
|
|
|
|
vm = null;
|
2020-10-24 23:57:45 +05:30
|
|
|
root.remove();
|
2020-05-24 23:13:21 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
const createComponent = () => {
|
|
|
|
const el = document.createElement('div');
|
2020-10-24 23:57:45 +05:30
|
|
|
Object.assign(el.dataset, TEST_DATASET);
|
2020-05-24 23:13:21 +05:30
|
|
|
root.appendChild(el);
|
2020-10-24 23:57:45 +05:30
|
|
|
vm = initIde(el, { extendStore });
|
2020-05-24 23:13:21 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
it('runs', () => {
|
|
|
|
createComponent();
|
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
expect(root).toMatchSnapshot();
|
2020-05-24 23:13:21 +05:30
|
|
|
});
|
|
|
|
});
|