@thoughtspot/visual-embed-sdk
Version:
ThoughtSpot Embed SDK
909 lines • 88.7 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const liveboard_1 = require("./liveboard");
const index_1 = require("../index");
const types_1 = require("../types");
const test_utils_1 = require("../test/test-utils");
const tsEmbed = tslib_1.__importStar(require("./ts-embed"));
const processTriggerInstance = tslib_1.__importStar(require("../utils/processTrigger"));
const auth = tslib_1.__importStar(require("../auth"));
const previewService = tslib_1.__importStar(require("../utils/graphql/preview-service"));
const SessionInfoService = tslib_1.__importStar(require("../utils/sessionInfoService"));
const defaultViewConfig = {
frameParams: {
width: 1280,
height: 720,
},
};
const liveboardId = 'eca215d4-0d2c-4a55-90e3-d81ef6848ae0';
const activeTabId = '502693ba-9818-4e71-8ecd-d1a194e46861';
const newActiveTabId = '910e2398-eed9-443c-a975-355976629d27';
const vizId = '6e73f724-660e-11eb-ae93-0242ac130002';
const thoughtSpotHost = 'tshost';
const prefixParams = '&isLiveboardEmbed=true';
const prefixParamsVizEmbed = '&isLiveboardEmbed=true&isVizEmbed=true';
const mockGetSessionInfo = (mockSessionInfo) => {
jest.spyOn(SessionInfoService, 'getSessionInfo').mockResolvedValue(mockSessionInfo || {
releaseVersion: '1.0.0',
userGUID: '1234567890',
currentOrgId: 1,
privileges: [],
mixpanelToken: '1234567890',
});
};
beforeAll(() => {
(0, index_1.init)({
thoughtSpotHost,
authType: types_1.AuthType.None,
});
jest.spyOn(auth, 'postLoginService').mockImplementation(() => Promise.resolve(undefined));
});
describe('Liveboard/viz embed tests', () => {
beforeEach(() => {
document.body.innerHTML = (0, test_utils_1.getDocumentBody)();
});
test('should render liveboard', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should render liveboard with data panel v2 flag set to false by default', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}${prefixParams}&enableDataPanelV2=true#/embed/viz/${liveboardId}`);
});
});
test('should set disabled actions using PersonalizedViewsDropdown alias', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
disabledActions: [types_1.Action.PersonalizedViewsDropdown],
disabledActionReason: 'Action denied',
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true&${test_utils_1.defaultParamsWithoutHiddenActions}&disableAction=[%22${types_1.Action.PersonalisedViewsDropdown}%22]&disableHint=Action%20denied&hideAction=[%22${types_1.Action.ReportError}%22]${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should set hidden actions using OrganizeFavorites alias', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
hiddenActions: [types_1.Action.OrganizeFavorites],
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true&${test_utils_1.defaultParamsWithoutHiddenActions}&hideAction=[%22${types_1.Action.ReportError}%22,%22${types_1.Action.OrganiseFavourites}%22]${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should set disabled actions', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
disabledActions: [types_1.Action.DownloadAsCsv, types_1.Action.DownloadAsPdf, types_1.Action.DownloadAsXlsx],
disabledActionReason: 'Action denied',
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true&${test_utils_1.defaultParamsWithoutHiddenActions}&disableAction=[%22${types_1.Action.DownloadAsCsv}%22,%22${types_1.Action.DownloadAsPdf}%22,%22${types_1.Action.DownloadAsXlsx}%22]&disableHint=Action%20denied&hideAction=[%22${types_1.Action.ReportError}%22]${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should set hidden actions', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
hiddenActions: [types_1.Action.DownloadAsCsv, types_1.Action.DownloadAsPdf, types_1.Action.DownloadAsXlsx],
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true&${test_utils_1.defaultParamsWithoutHiddenActions}&hideAction=[%22${types_1.Action.ReportError}%22,%22${types_1.Action.DownloadAsCsv}%22,%22${types_1.Action.DownloadAsPdf}%22,%22${types_1.Action.DownloadAsXlsx}%22]${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should set visible actions', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
visibleActions: [types_1.Action.DownloadAsCsv, types_1.Action.DownloadAsPdf, types_1.Action.DownloadAsXlsx],
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&visibleAction=[%22${types_1.Action.DownloadAsCsv}%22,%22${types_1.Action.DownloadAsPdf}%22,%22${types_1.Action.DownloadAsXlsx}%22]${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should set LiveboardStylePanel in visible actions', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
visibleActions: [types_1.Action.LiveboardStylePanel],
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlToHaveParamsWithValues)((0, test_utils_1.getIFrameSrc)(), {
visibleAction: JSON.stringify([types_1.Action.LiveboardStylePanel]),
});
});
});
test('should set enable2ColumnLayout to true in url', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
enable2ColumnLayout: true,
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&enable2ColumnLayout=true${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should set isLiveboardStylingAndGroupingEnabled to true in url (deprecated, use isLiveboardMasterpiecesEnabled)', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
isLiveboardStylingAndGroupingEnabled: true,
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&isLiveboardStylingAndGroupingEnabled=true${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should set isThisPeriodInDateFiltersEnabled to true in url', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
isThisPeriodInDateFiltersEnabled: true,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&isThisPeriodInDateFiltersEnabled=true${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should set isLiveboardPermissionV2Enabled to true in url', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
isEnhancedFilterInteractivityEnabled: true,
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&isLiveboardPermissionV2Enabled=true${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should set isPNGInScheduledEmailsEnabled to true in url', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
isPNGInScheduledEmailsEnabled: true,
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&isPNGInScheduledEmailsEnabled=true${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should set isWYSIWYGLiveboardPDFEnabled to true in url', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
isContinuousLiveboardPDFEnabled: true,
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&isWYSIWYGLiveboardPDFEnabled=true${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should disable isWYSIWYGLiveboardPDFEnabled by default in url', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&isWYSIWYGLiveboardPDFEnabled=false${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should set isLiveboardXLSXCSVDownloadEnabled to true in url', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
isLiveboardXLSXCSVDownloadEnabled: true,
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&isLiveboardXLSXCSVDownloadEnabled=true${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should set isLiveboardXLSXCSVDownloadEnabled to false in url', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
isLiveboardXLSXCSVDownloadEnabled: false,
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&isLiveboardXLSXCSVDownloadEnabled=false${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should set isGranularXLSXCSVSchedulesEnabled to true in url', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
isGranularXLSXCSVSchedulesEnabled: true,
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&isGranularXLSXCSVSchedulesEnabled=true${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should set isGranularXLSXCSVSchedulesEnabled to false in url', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
isGranularXLSXCSVSchedulesEnabled: false,
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&isGranularXLSXCSVSchedulesEnabled=false${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should set isLinkParametersEnabled to true in url', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
isLinkParametersEnabled: true,
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&isLinkParametersEnabled=true${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should set isLinkParametersEnabled to false in url', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
isLinkParametersEnabled: false,
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&isLinkParametersEnabled=false${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should set visible actions as empty array', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
visibleActions: [],
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&visibleAction=[]${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should enable viz transformations true', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
enableVizTransformations: true,
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&enableVizTransform=true${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should enable viz oAuthPollingInterval true', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
oAuthPollingInterval: 1000,
isForceRedirect: true,
dataSourceId: '12356',
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&oAuthPollingInterval=1000&isForceRedirect=true&dataSourceId=12356${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should disable viz transformations when enableVizTransformations false', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
enableVizTransformations: false,
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&enableVizTransform=false${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should set enableLiveboardDataCache to true in url', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
enableLiveboardDataCache: true,
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&enableLiveboardDataCache=true${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should set enableLiveboardDataCache to false in url', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
enableLiveboardDataCache: false,
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&enableLiveboardDataCache=false${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should not set enableLiveboardDataCache in url when not provided', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
expect((0, test_utils_1.getIFrameSrc)()).not.toContain('enableLiveboardDataCache');
});
});
test('should render viz', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
vizId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}${prefixParamsVizEmbed}#/embed/viz/${liveboardId}/${vizId}`);
});
});
test('should apply runtime filters', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
vizId,
runtimeFilters: [
{
columnName: 'sales',
operator: types_1.RuntimeFilterOp.EQ,
values: [1000],
},
],
excludeRuntimeFiltersfromURL: false,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true&col1=sales&op1=EQ&val1=1000${test_utils_1.defaultParams}${prefixParamsVizEmbed}#/embed/viz/${liveboardId}/${vizId}`);
});
});
test('Should add isLiveboardHeaderSticky flag to the iframe src', async () => {
const appEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
isLiveboardHeaderSticky: false,
});
appEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&isLiveboardHeaderSticky=false${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('Should add isLiveboardCompactHeaderEnabled flag to the iframe src', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
isLiveboardCompactHeaderEnabled: false,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&isLiveboardHeaderV2Enabled=false${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('Should add showLiveboardReverifyBanner flag to the iframe src', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
showLiveboardReverifyBanner: false,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&showLiveboardReverifyBanner=false${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('Should add showLiveboardVerifiedBadge flag to the iframe src', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
showLiveboardVerifiedBadge: false,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&showLiveboardVerifiedBadge=false${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('Should add showMaskedFilterChip flag set to true to the iframe src', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
showMaskedFilterChip: true,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&showMaskedFilterChip=true${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('Should add showMaskedFilterChip flag set to false to the iframe src', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
showMaskedFilterChip: false,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&showMaskedFilterChip=false${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('Should add isLiveboardMasterpiecesEnabled flag set to true to the iframe src', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
isLiveboardMasterpiecesEnabled: true,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&isLiveboardMasterpiecesEnabled=true${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('Should add isLiveboardMasterpiecesEnabled flag set to false to the iframe src', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
isLiveboardMasterpiecesEnabled: false,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&isLiveboardMasterpiecesEnabled=false${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('Should add newChartsLibrary flag set to true to the iframe src', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
newChartsLibrary: true,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&muzeChartPhase1EnabledGA=true${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('Should add newChartsLibrary flag set to false to the iframe src', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
newChartsLibrary: false,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&muzeChartPhase1EnabledGA=false${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('Should add hideIrrelevantFiltersAtTabLevel flag to the iframe src', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
hideIrrelevantChipsInLiveboardTabs: true,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&hideIrrelevantFiltersAtTabLevel=true${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should add coverAndFilterOptionInPDF flag and set value to true to the iframe src', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
coverAndFilterOptionInPDF: true,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&arePdfCoverFilterPageCheckboxesEnabled=true${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should add coverAndFilterOptionInPDF flag and set value to false to the iframe src', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
coverAndFilterOptionInPDF: false,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&arePdfCoverFilterPageCheckboxesEnabled=false&${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should add isCentralizedLiveboardFilterUXEnabled flag and set value to true to the iframe src', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
isCentralizedLiveboardFilterUXEnabled: true,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&isCentralizedLiveboardFilterUXEnabled=true${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should add isCentralizedLiveboardFilterUXEnabled flag and set value to false to the iframe src', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
isCentralizedLiveboardFilterUXEnabled: false,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&isCentralizedLiveboardFilterUXEnabled=false${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should not append runtime filters in URL if excludeRuntimeFiltersfromURL is true', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
vizId,
runtimeFilters: [
{
columnName: 'sales',
operator: types_1.RuntimeFilterOp.EQ,
values: [1000],
},
],
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}${prefixParamsVizEmbed}#/embed/viz/${liveboardId}/${vizId}`);
});
});
test('Should not append runtime parameters in URL if excludeRuntimeParametersfromURL is true', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
vizId,
runtimeParameters: [
{
name: 'sales',
value: 1000,
},
],
excludeRuntimeParametersfromURL: true,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}${prefixParamsVizEmbed}#/embed/viz/${liveboardId}/${vizId}`);
});
});
test('should append runtime filters in URL if excludeRuntimeFiltersfromURL is undefined', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
vizId,
runtimeFilters: [
{
columnName: 'sales',
operator: types_1.RuntimeFilterOp.EQ,
values: [1000],
},
],
excludeRuntimeFiltersfromURL: undefined,
});
liveboardEmbed.render();
const runtimeFilter = 'col1=sales&op1=EQ&val1=1000';
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}${prefixParamsVizEmbed}&${runtimeFilter}#/embed/viz/${liveboardId}/${vizId}`);
});
});
test('should register event handler to adjust iframe height', async () => {
const onSpy = jest.spyOn(liveboard_1.LiveboardEmbed.prototype, 'on');
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
fullHeight: true,
liveboardId,
vizId,
});
liveboardEmbed.render();
(0, test_utils_1.executeAfterWait)(() => {
expect(onSpy).toHaveBeenCalledWith(types_1.EmbedEvent.EmbedHeight, expect.anything());
});
});
test('should not call setIFrameHeight if currentPath starts with "/embed/viz/"', () => {
const myObject = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
fullHeight: true,
liveboardId,
});
const spySetIFrameHeight = jest.spyOn(myObject, 'setIFrameHeight');
myObject.render();
myObject.setIframeHeightForNonEmbedLiveboard({
data: { currentPath: '/embed/viz/' },
type: 'Route',
});
// Assert that setIFrameHeight is not called
expect(spySetIFrameHeight).not.toHaveBeenCalled();
});
test('should not call setIFrameHeight if currentPath starts with "/embed/insights/viz/"', () => {
const myObject = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
fullHeight: true,
liveboardId,
});
const spySetIFrameHeight = jest.spyOn(myObject, 'setIFrameHeight');
myObject.render();
myObject.setIframeHeightForNonEmbedLiveboard({
data: { currentPath: '/embed/insights/viz/' },
type: 'Route',
});
// Assert that setIFrameHeight is not called
expect(spySetIFrameHeight).not.toHaveBeenCalled();
});
test('should call setIFrameHeight if currentPath starts with "/some/other/path/"', () => {
const myObject = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
fullHeight: true,
liveboardId,
});
const spySetIFrameHeight = jest
.spyOn(myObject, 'setIFrameHeight')
.mockImplementation(jest.fn());
myObject.render();
myObject.setIframeHeightForNonEmbedLiveboard({
data: { currentPath: '/some/other/path/' },
type: 'Route',
});
// Assert that setIFrameHeight is not called
expect(spySetIFrameHeight).toHaveBeenCalled();
});
test('Should set the visible vizs', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
visibleVizs: ['abcd', 'pqrs'],
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&pinboardVisibleVizs=[%22abcd%22,%22pqrs%22]${prefixParams}#/embed/viz/${liveboardId}`);
});
});
test('should process the trigger, for vizEmbed', async () => {
const mockProcessTrigger = jest.spyOn(processTriggerInstance, 'processTrigger').mockImplementation(jest.fn());
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
enableVizTransformations: true,
...defaultViewConfig,
vizId: '1234',
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(async () => {
await liveboardEmbed.trigger(types_1.HostEvent.Pin);
expect(mockProcessTrigger).toHaveBeenCalled();
});
});
test('should render active tab when activeTab present', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
liveboardId,
activeTabId,
liveboardV2: true,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&isLiveboardEmbed=true&isPinboardV2Enabled=true#/embed/viz/${liveboardId}/tab/${activeTabId}`);
});
});
test('Should set liveboard options', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
liveboardId,
activeTabId,
liveboardV2: true,
defaultHeight: 100,
preventLiveboardFilterRemoval: true,
enableAskSage: true,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&preventPinboardFilterRemoval=true&isLiveboardEmbed=true&isPinboardV2Enabled=true&enableAskSage=true#/embed/viz/${liveboardId}/tab/${activeTabId}`);
});
});
test('Should set contextMenuTrigger options', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
liveboardId,
activeTabId,
liveboardV2: true,
contextMenuTrigger: types_1.ContextMenuTriggerOptions.LEFT_CLICK,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&contextMenuEnabledOnWhichClick=left&isLiveboardEmbed=true&isPinboardV2Enabled=true#/embed/viz/${liveboardId}/tab/${activeTabId}`);
});
});
test('Should set hideTabPanel option', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
liveboardId,
activeTabId,
liveboardV2: true,
hideTabPanel: true,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlMatchesWithParams)((0, test_utils_1.getIFrameSrc)(), `http://${thoughtSpotHost}/?embedApp=true${test_utils_1.defaultParams}&hideTabPanel=true&isLiveboardEmbed=true&isPinboardV2Enabled=true#/embed/viz/${liveboardId}/tab/${activeTabId}`);
});
});
describe('personalizedViewId functionality', () => {
const personalizedViewId = 'view-456-guid';
test('should render liveboard with personalizedViewId', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
personalizedViewId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlToHaveParamsWithValues)((0, test_utils_1.getIFrameSrc)(), { view: personalizedViewId });
});
});
test('should render liveboard with personalizedViewId and activeTabId together', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
personalizedViewId,
activeTabId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
// URL should be: #/embed/viz/{id}/tab/{tabId}?view={viewId}
expect((0, test_utils_1.getIFrameSrc)()).toMatch(new RegExp(`#/embed/viz/${liveboardId}/tab/${activeTabId}\\?view=${personalizedViewId}`));
});
});
test('should render liveboard with personalizedViewId and vizId together', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
personalizedViewId,
vizId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
// URL should be: #/embed/viz/{id}/{vizId}?view={viewId}
expect((0, test_utils_1.getIFrameSrc)()).toMatch(new RegExp(`#/embed/viz/${liveboardId}/${vizId}\\?view=${personalizedViewId}`));
});
});
test('should render liveboard with personalizedViewId, activeTabId, and vizId together', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
personalizedViewId,
activeTabId,
vizId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
// URL should be:
// #/embed/viz/{id}/tab/{tabId}/{vizId}?view={viewId}
expect((0, test_utils_1.getIFrameSrc)()).toMatch(new RegExp(`#/embed/viz/${liveboardId}/tab/${activeTabId}/${vizId}\\?view=${personalizedViewId}`));
});
});
test('should not include view param when personalizedViewId is not provided', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
expect((0, test_utils_1.getIFrameSrc)()).not.toContain('view=');
});
});
test('should include personalizedViewId in getLiveboardUrl', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
personalizedViewId,
});
await liveboardEmbed.render();
expect(liveboardEmbed.getLiveboardUrl()).toBe(`http://${thoughtSpotHost}/#/pinboard/${liveboardId}?view=${personalizedViewId}`);
});
test('should include personalizedViewId with activeTabId in getLiveboardUrl', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
personalizedViewId,
activeTabId,
});
await liveboardEmbed.render();
expect(liveboardEmbed.getLiveboardUrl()).toBe(`http://${thoughtSpotHost}/#/pinboard/${liveboardId}/tab/${activeTabId}?view=${personalizedViewId}`);
});
test('personalizedViewId should work with runtime filters', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId,
personalizedViewId,
runtimeFilters: [
{
columnName: 'sales',
operator: types_1.RuntimeFilterOp.EQ,
values: [1000],
},
],
excludeRuntimeFiltersfromURL: false,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
(0, test_utils_1.expectUrlToHaveParamsWithValues)((0, test_utils_1.getIFrameSrc)(), {
view: personalizedViewId,
col1: 'sales',
op1: 'EQ',
val1: '1000',
});
});
});
describe('backward compatibility with liveboardId?view= workaround', () => {
const workaroundViewId = 'workaround-view-id';
const liveboardIdWithView = `${liveboardId}?view=${workaroundViewId}`;
test('should extract view from workaround and add at end of URL', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId: liveboardIdWithView,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
// URL: #/embed/viz/{cleanId}?view={workaroundViewId}
expect((0, test_utils_1.getIFrameSrc)()).toMatch(new RegExp(`#/embed/viz/${liveboardId}\\?view=${workaroundViewId}`));
});
});
test('should extract view and place after tab when activeTabId is provided', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId: liveboardIdWithView,
activeTabId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
// URL: #/embed/viz/{id}/tab/{tabId}?view={viewId}
// (view at END, not middle)
expect((0, test_utils_1.getIFrameSrc)()).toMatch(new RegExp(`#/embed/viz/${liveboardId}/tab/${activeTabId}\\?view=${workaroundViewId}`));
});
});
test('should use personalizedViewId over workaround when both provided', async () => {
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
liveboardId: liveboardIdWithView,
personalizedViewId,
});
liveboardEmbed.render();
await (0, test_utils_1.executeAfterWait)(() => {
// personalizedViewId wins, workaround stripped
expect((0, test_utils_1.getIFrameSrc)()).toMatch(new RegExp(`#/embed/viz/${liveboardId}\\?view=${personalizedViewId}`));
});
});
});
});
test('navigateToLiveboard should trigger the navigate event with the correct path', async () => {
(0, test_utils_1.mockMessageChannel)();
// mock getSessionInfo
mockGetSessionInfo();
const liveboardEmbed = new liveboard_1.LiveboardEmbed((0, test_utils_1.getRootEl)(), {
...defaultViewConfig,
});
const onSpy = jest.spyOn(liveboardEmbed, 'trigger');
await liveboardEmbed.prerenderGeneric();
await (0, test_utils_1.executeAfterWait)(() => {
const iframe = (0, test_utils_1.getIFrameEl)();
(0, test_utils_1.postMessageToParent)(iframe.contentWindow, {
type: types_1.EmbedEvent.APP_INIT,
});
(0, test_utils_1.postMessageToParent)(iframe.contentWindow, {
type: types_1.EmbedEvent.AuthInit,
});
liveboardEmbed.navigateToLiveboard('lb1', 'viz1');
});
await (0, test_utils_1.executeAfterWait)(() => {
expect