Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing test: Jest Tests.src/plugins/vis_type_vega/public #71834

Merged
merged 12 commits into from
Jul 23, 2020
66 changes: 11 additions & 55 deletions src/plugins/vis_type_vega/public/vega_visualization.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jest.mock('./lib/vega', () => ({
}));

// FLAKY: https://github.com/elastic/kibana/issues/71713
describe.skip('VegaVisualizations', () => {
describe('VegaVisualizations', () => {
let domNode;
let VegaVisualization;
let vis;
Expand All @@ -77,17 +77,17 @@ describe.skip('VegaVisualizations', () => {
mockHeight = jest.spyOn($.prototype, 'height').mockImplementation(() => mockedHeightValue);
};

setKibanaMapFactory((...args) => new KibanaMap(...args));
setInjectedVars({
emsTileLayerId: {},
enableExternalUrls: true,
esShardTimeout: 10000,
});
setData(dataPluginStart);
setSavedObjects(coreStart.savedObjects);
setNotifications(coreStart.notifications);

beforeEach(() => {
setKibanaMapFactory((...args) => new KibanaMap(...args));
setInjectedVars({
emsTileLayerId: {},
enableExternalUrls: true,
esShardTimeout: 10000,
});
setData(dataPluginStart);
setSavedObjects(coreStart.savedObjects);
setNotifications(coreStart.notifications);

vegaVisualizationDependencies = {
core: coreMock.createSetup(),
plugins: {
Expand Down Expand Up @@ -185,49 +185,5 @@ describe.skip('VegaVisualizations', () => {
vegaVis.destroy();
}
});

test('should add a small subpixel value to the height of the canvas to avoid getting it set to 0', async () => {
let vegaVis;
try {
vegaVis = new VegaVisualization(domNode, vis);
const vegaParser = new VegaParser(
`{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"marks": [
{
"type": "text",
"encode": {
"update": {
"text": {
"value": "Test"
},
"align": {"value": "center"},
"baseline": {"value": "middle"},
"xc": {"signal": "width/2"},
"yc": {"signal": "height/2"}
fontSize: {value: "14"}
}
}
}
]
}`,
new SearchAPI({
search: dataPluginStart.search,
uiSettings: coreStart.uiSettings,
injectedMetadata: coreStart.injectedMetadata,
})
);
await vegaParser.parseAsync();

mockedWidthValue = 256;
mockedHeightValue = 256;

await vegaVis.render(vegaParser);
const vegaView = vegaVis._vegaView._view;
expect(vegaView.height()).toBe(250.00000001);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think problem was in that line. I decide to remove that test cause we already have have some snapshots with that adjusted height
image

} finally {
vegaVis.destroy();
}
});
});
});