-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Reporting] Fix screenshot diagnostics (#116199)
* [Reporting] Fix screenshot diagnostics * update snapshots * fix test * tersify test assertions Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
f6dd54a
commit 1211149
Showing
4 changed files
with
72 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
x-pack/plugins/reporting/server/lib/layouts/preserve_layout.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { PreserveLayout } from './preserve_layout'; | ||
|
||
it('preserve layout uses default layout selectors', () => { | ||
const testPreserveLayout = new PreserveLayout({ width: 16, height: 16 }); | ||
|
||
expect(testPreserveLayout.getCssOverridesPath()).toMatch(`layouts/preserve_layout.css`); | ||
expect(testPreserveLayout.getBrowserViewport()).toMatchObject({ height: 32, width: 32 }); | ||
expect(testPreserveLayout.getBrowserZoom()).toBe(2); | ||
expect(testPreserveLayout.getPdfImageSize()).toMatchObject({ height: 16, width: 16 }); | ||
expect(testPreserveLayout.getPdfPageOrientation()).toBe(undefined); | ||
expect( | ||
testPreserveLayout.getPdfPageSize({ | ||
pageMarginTop: 27, | ||
pageMarginBottom: 27, | ||
pageMarginWidth: 13, | ||
tableBorderWidth: 67, | ||
headingHeight: 82, | ||
subheadingHeight: 96, | ||
}) | ||
).toMatchObject({ height: 382, width: 176 }); | ||
expect(testPreserveLayout.selectors).toMatchInlineSnapshot(` | ||
Object { | ||
"itemsCountAttribute": "data-shared-items-count", | ||
"renderComplete": "[data-shared-item]", | ||
"renderError": "[data-render-error]", | ||
"renderErrorAttribute": "data-render-error", | ||
"screenshot": "[data-shared-items-container]", | ||
"timefilterDurationAttribute": "data-shared-timefilter-duration", | ||
} | ||
`); | ||
expect(testPreserveLayout.groupCount).toBe(1); | ||
expect(testPreserveLayout.height).toBe(16); | ||
expect(testPreserveLayout.width).toBe(16); | ||
}); | ||
|
||
it('preserve layout allows customizable selectors', () => { | ||
const testPreserveLayout = new PreserveLayout( | ||
{ width: 16, height: 16 }, | ||
{ renderComplete: '[great-test-selectors]' } | ||
); | ||
|
||
expect(testPreserveLayout.selectors).toMatchInlineSnapshot(` | ||
Object { | ||
"itemsCountAttribute": "data-shared-items-count", | ||
"renderComplete": "[great-test-selectors]", | ||
"renderError": "[data-render-error]", | ||
"renderErrorAttribute": "data-render-error", | ||
"screenshot": "[data-shared-items-container]", | ||
"timefilterDurationAttribute": "data-shared-timefilter-duration", | ||
} | ||
`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters