Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ide_integration_spec.js « ide « frontend_integration « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 91d89c26ec1d9d6ddb33e5c22609e38406086ca7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
 * 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.
 */
import { TEST_HOST } from 'helpers/test_constants';
import { useOverclockTimers } from 'test_helpers/utils/overclock_timers';
import { initIde } from '~/ide';
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',
};

describe('WebIDE', () => {
  useOverclockTimers();

  let vm;
  let root;

  beforeEach(() => {
    root = document.createElement('div');
    document.body.appendChild(root);

    global.jsdom.reconfigure({
      url: `${TEST_HOST}/-/ide/project/gitlab-test/lorem-ipsum`,
    });
  });

  afterEach(() => {
    vm.$destroy();
    vm = null;
    root.remove();
  });

  const createComponent = () => {
    const el = document.createElement('div');
    Object.assign(el.dataset, TEST_DATASET);
    root.appendChild(el);
    vm = initIde(el, { extendStore });
  };

  it('runs', () => {
    createComponent();

    expect(root).toMatchSnapshot();
  });
});