2020-03-11 11:09:37 -04:00
|
|
|
// this file can't be migrated to jest because it relies on the browser to perform integration tests:
|
|
|
|
// see: https://gitlab.com/gitlab-org/gitlab/-/issues/194207#note_301878738
|
2019-04-25 08:11:01 -04:00
|
|
|
import { FIXTURES_PATH } from 'spec/test_constants';
|
2019-12-09 07:07:58 -05:00
|
|
|
import BalsamiqViewer from '~/blob/balsamiq/balsamiq_viewer';
|
2019-04-25 08:11:01 -04:00
|
|
|
|
|
|
|
const bmprPath = `${FIXTURES_PATH}/blob/balsamiq/test.bmpr`;
|
2017-05-15 03:48:54 -04:00
|
|
|
|
|
|
|
describe('Balsamiq integration spec', () => {
|
|
|
|
let container;
|
|
|
|
let endpoint;
|
|
|
|
let balsamiqViewer;
|
|
|
|
|
2019-03-26 12:03:28 -04:00
|
|
|
preloadFixtures('static/balsamiq_viewer.html');
|
2017-05-15 03:48:54 -04:00
|
|
|
|
|
|
|
beforeEach(() => {
|
2019-03-26 12:03:28 -04:00
|
|
|
loadFixtures('static/balsamiq_viewer.html');
|
2017-05-15 03:48:54 -04:00
|
|
|
|
|
|
|
container = document.getElementById('js-balsamiq-viewer');
|
|
|
|
balsamiqViewer = new BalsamiqViewer(container);
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('successful response', () => {
|
2018-10-17 03:13:26 -04:00
|
|
|
beforeEach(done => {
|
2017-05-15 03:48:54 -04:00
|
|
|
endpoint = bmprPath;
|
|
|
|
|
2018-10-17 03:13:26 -04:00
|
|
|
balsamiqViewer
|
|
|
|
.loadFile(endpoint)
|
|
|
|
.then(done)
|
|
|
|
.catch(done.fail);
|
2017-05-15 03:48:54 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it('does not show loading icon', () => {
|
|
|
|
expect(document.querySelector('.loading')).toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders the balsamiq previews', () => {
|
|
|
|
expect(document.querySelectorAll('.previews .preview').length).not.toEqual(0);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('error getting file', () => {
|
2018-10-17 03:13:26 -04:00
|
|
|
beforeEach(done => {
|
2017-05-15 03:48:54 -04:00
|
|
|
endpoint = 'invalid/path/to/file.bmpr';
|
|
|
|
|
2018-10-17 03:13:26 -04:00
|
|
|
balsamiqViewer
|
|
|
|
.loadFile(endpoint)
|
|
|
|
.then(done.fail, null)
|
|
|
|
.catch(done);
|
2017-05-15 03:48:54 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it('does not show loading icon', () => {
|
|
|
|
expect(document.querySelector('.loading')).toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('does not render the balsamiq previews', () => {
|
|
|
|
expect(document.querySelectorAll('.previews .preview').length).toEqual(0);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|