-
Notifications
You must be signed in to change notification settings - Fork 74
fix: additional fixes of the new assertView command #1282
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
base: master
Are you sure you want to change the base?
Changes from all commits
ff1f281
ab9961c
8f2d38a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -631,6 +631,16 @@ export class ElementsScreenShooter { | |
| opts, | ||
| async currentState => { | ||
| if (currentState.captureSpecs.length === 0) { | ||
| if (iterations > 0) { | ||
|
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.
For a target that needs another scroll chunk and hides after the first scroll, Useful? React with 👍 / 👎. |
||
| debug( | ||
| "Capture area disappeared after %d chunk(s), rendering already captured data for selectors: %s", | ||
| iterations, | ||
| selectorsToCapture.join("; "), | ||
| ); | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| throw new Error(getEmptyCaptureSpecsErrorMessage(selectorsToCapture)); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| <style> | ||
| html, | ||
| body { | ||
| margin: 0; | ||
| padding: 0; | ||
| width: 100%; | ||
| min-height: 1600px; | ||
| font-family: Arial, sans-serif; | ||
| background: #eef3f7; | ||
| } | ||
|
|
||
| .listing { | ||
| position: relative; | ||
| z-index: 1; | ||
| width: 1000px; | ||
| min-height: 900px; | ||
| margin: 0 auto; | ||
| padding-top: 100px; | ||
| } | ||
|
|
||
| .sticky-filter { | ||
| position: sticky; | ||
| top: 112px; | ||
| z-index: 22; | ||
| display: flex; | ||
| align-items: center; | ||
| width: 1000px; | ||
| height: 60px; | ||
| box-sizing: border-box; | ||
| padding: 0 24px; | ||
| background: #304461; | ||
| color: #fff; | ||
| font-weight: 700; | ||
| } | ||
|
|
||
| .card { | ||
| width: 520px; | ||
| height: 260px; | ||
| margin-top: 48px; | ||
| padding: 28px; | ||
| box-sizing: border-box; | ||
| background: #fff; | ||
| border: 1px solid #b9c7d8; | ||
| } | ||
|
|
||
| .popup { | ||
| position: absolute; | ||
| left: 700px; | ||
| top: 120px; | ||
| z-index: 11010; | ||
| width: 360px; | ||
| height: 116px; | ||
| box-sizing: border-box; | ||
| padding: 18px; | ||
| background: #fff; | ||
| border: 2px solid #55a0ff; | ||
| box-shadow: 0 10px 28px rgba(20, 33, 61, 0.22); | ||
| font-weight: 700; | ||
| } | ||
| </style> | ||
|
|
||
| <div class="listing"> | ||
| <div class="sticky-filter">Sticky filter behind popup</div> | ||
|
|
||
| <div class="card"> | ||
| <h3>Listing card</h3> | ||
| <p>The sticky filter belongs to page content and is below the popup in stacking order.</p> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div class="popup">Popup target above sticky filter</div> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Capture Area Disappears After Scroll</title> | ||
| <style> | ||
| html, | ||
| body { | ||
| margin: 0; | ||
| min-height: 1800px; | ||
| font-family: Arial, sans-serif; | ||
| background: #eef1f5; | ||
| } | ||
|
|
||
| .bottom-panel { | ||
| position: fixed; | ||
| left: 0; | ||
| top: calc(100vh - 100px); | ||
| width: 520px; | ||
| height: 100px; | ||
| box-sizing: border-box; | ||
| padding: 24px; | ||
| border-top: 6px solid #6b1111; | ||
| background: #d84444; | ||
| color: #fff; | ||
| font-size: 24px; | ||
| font-weight: 700; | ||
| } | ||
|
|
||
| .capture-target { | ||
| position: absolute; | ||
| left: 40px; | ||
| top: calc(100vh - 350px); | ||
| width: 360px; | ||
| height: 300px; | ||
| box-sizing: border-box; | ||
| border: 6px solid #183153; | ||
| background: #fff; | ||
| color: #183153; | ||
| overflow: hidden; | ||
| } | ||
|
|
||
| body.hide-capture-target .capture-target { | ||
| display: none; | ||
| } | ||
|
|
||
| .stripe { | ||
| height: 100px; | ||
| box-sizing: border-box; | ||
| padding: 30px; | ||
| font-size: 26px; | ||
| font-weight: 700; | ||
| } | ||
|
|
||
| .stripe-top { | ||
| background: #8ed2ff; | ||
| } | ||
|
|
||
| .stripe-middle { | ||
| background: #fff0a3; | ||
| } | ||
|
|
||
| .stripe-bottom { | ||
| background: #b7edc2; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class="bottom-panel">Safe area interference</div> | ||
|
|
||
| <main class="capture-target" data-testid="scroll-sensitive-popup"> | ||
| <div class="stripe stripe-top">Popup top</div> | ||
| <div class="stripe stripe-middle">Popup middle</div> | ||
| <div class="stripe stripe-bottom">Popup bottom</div> | ||
| </main> | ||
|
|
||
| <script> | ||
| window.addEventListener("scroll", function () { | ||
| if (window.scrollY > 0) { | ||
| document.body.classList.add("hide-capture-target"); | ||
| } | ||
| }); | ||
| </script> | ||
| </body> | ||
| </html> |
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.
When
visualViewportexposes fractional CSS pixels, such as under pinch/page zoom, these raw dimensions flow throughfromCssToDeviceunchanged whenever DPR is an integer. Later screenshot cropping and PNG encoding assume integer image sizes (Image.cropstoresactualWidth/actualHeightdirectly, and PNG IHDR writes integer widths), so these captures can fail or produce malformed buffers; round/floor the visual viewport size before returning it.Useful? React with 👍 / 👎.