-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Reporting] Use the real dimensions when taking a screenshot #242127
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
Merged
ersin-erdal
merged 9 commits into
elastic:main
from
ersin-erdal:skewed-reporting-screenshots
Nov 18, 2025
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
63e1a2f
[Reporting] Use the real dimensions when taking a screenshot
ersin-erdal d220c49
fix unit tests
ersin-erdal fc017fc
fix functional test
ersin-erdal 916c6e1
update the map
ersin-erdal 67db352
Merge branch 'main' into skewed-reporting-screenshots
ersin-erdal 9189abc
add reset mocks
ersin-erdal ab634bd
Merge branch 'main' into skewed-reporting-screenshots
ersin-erdal 387b8fa
Merge branch 'main' into skewed-reporting-screenshots
ersin-erdal 2130945
Merge branch 'main' into skewed-reporting-screenshots
ersin-erdal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -58,6 +58,10 @@ describe('chromium driver', () => { | |
| }; | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| jest.resetAllMocks(); | ||
| }); | ||
|
|
||
| it('return screenshot with preserve layout option', async () => { | ||
| const driver = new HeadlessChromiumDriver( | ||
| mockScreenshotModeSetup, | ||
|
|
@@ -105,4 +109,28 @@ describe('chromium driver', () => { | |
| `); | ||
| expect(result).toEqual(Buffer.from(`you won't believe this one weird screenshot`, 'base64')); | ||
| }); | ||
|
|
||
| it('sets the PDF image size', async () => { | ||
| const driver = new HeadlessChromiumDriver( | ||
| mockScreenshotModeSetup, | ||
| mockConfig, | ||
| mockBasePath, | ||
| mockPage | ||
| ); | ||
|
|
||
| const layout = new PreserveLayout({} as Size); | ||
|
|
||
| const testSpy = jest.spyOn(layout, 'setPdfImageSize'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed this file is missing afterEach(() => {
jest.resetAllMocks();
});Could you please add it? |
||
|
|
||
| await driver.screenshot({ | ||
| elementPosition: { | ||
| boundingClientRect: { top: 200, left: 10, height: 10, width: 100 }, | ||
| scroll: { x: 100, y: 300 }, | ||
| }, | ||
| layout, | ||
| }); | ||
|
|
||
| expect(testSpy).toHaveBeenCalledTimes(1); | ||
| expect(testSpy).toHaveBeenCalledWith({ height: 10, width: 100 }); | ||
| }); | ||
| }); | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Binary file modified
BIN
-44.9 KB
(97%)
...k/platform/test/functional/apps/maps/group3/reports/baseline/geo_map_report.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Do we actually need the second part? I assume we don’t need to account for scrollbar width when taking screenshots
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for the old browsers. Looks like
document.documentElement.clientWidthdoesn't work for some old browsers.