mirror of
https://github.com/apache/superset.git
synced 2026-04-24 18:44:53 +00:00
add loading log for dash and exploreview breakdown whole page load action to multiple charts loading events and render events
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
/* eslint no-undef: 0, no-native-reassign: 0 */
|
|
import 'babel-polyfill';
|
|
import chai from 'chai';
|
|
import jsdom from 'jsdom';
|
|
|
|
require('babel-register')();
|
|
|
|
const exposedProperties = ['window', 'navigator', 'document'];
|
|
|
|
global.jsdom = jsdom.jsdom;
|
|
global.document = global.jsdom('<!doctype html><html><body></body></html>');
|
|
global.window = document.defaultView;
|
|
Object.keys(document.defaultView).forEach((property) => {
|
|
if (typeof global[property] === 'undefined') {
|
|
exposedProperties.push(property);
|
|
global[property] = document.defaultView[property];
|
|
}
|
|
});
|
|
|
|
global.navigator = {
|
|
userAgent: 'node.js',
|
|
platform: 'linux',
|
|
appName: 'Netscape',
|
|
};
|
|
|
|
// Configuration copied from https://github.com/sinonjs/sinon/issues/657
|
|
// allowing for sinon.fakeServer to work
|
|
|
|
global.window = global.document.defaultView;
|
|
global.XMLHttpRequest = global.window.XMLHttpRequest;
|
|
|
|
global.sinon = require('sinon');
|
|
|
|
global.expect = chai.expect;
|
|
global.assert = chai.assert;
|
|
|
|
global.sinon.useFakeXMLHttpRequest();
|
|
|
|
global.window.XMLHttpRequest = global.XMLHttpRequest;
|
|
global.window.location = { href: 'about:blank' };
|
|
global.window.performance = { now: () => (new Date().getTime()) };
|
|
global.$ = require('jquery')(global.window);
|