Skip to content

Change default screenshot selector to "scrollable_area" (from bounding box of "html" DOM) - #325

Merged
schloerke merged 18 commits into
mainfrom
default_screen_screenshot_size
Feb 10, 2023
Merged

schloerke merged 18 commits into
mainfrom
default_screen_screenshot_size

Conversation

@schloerke

@schloerke schloerke commented Feb 9, 2023 •

Copy link
Copy Markdown
Collaborator

Fixes #293

Two new query selector options can be added: "scroll" (default), and "viewport".

This is a (hopefully welcoming) breaking change for oddly sized apps / viewport combinations.

  • Docs
  • News
  • Tests

Independently, I walked down the path of changing the default screen size to 900px high by 1200px wide.

Reasoning...

Using comment from https://github.com/rstudio/shinytest2/issues/218#issuecomment-1146097081 that suggests to use "round" numbers for easier division. While this isn't a perfect fix, it provides a much better opportunity to succeed at first run. If trouble still arises from rounded corners, then the threshold arg can be used.

However...

In rstudio/chromote#96, Chrome DevTool Protocol has a bug which was really causing the redrawing issues. Wouldn't matter what size the screen is if it's doing that.

Therefore...

Not changing the default screen size.

Using comment from https://github.com/rstudio/shinytest2/issues/218#issuecomment-1146097081 that suggests to use "round" numbers for easier division. While this isn't a perfect fix, it provides a much better opportunity to succeed at first run. If trouble still arises from rounded corners, then the `threshold` arg can be used.
* `"scroll"` is the max scroll size. Which can be larger than the browser’s viewport. But takes a picture of the whole scrollable area
* `"viewport"` is literally the browser viewport at it’s current scroll position
@schloerke
schloerke marked this pull request as ready for review February 9, 2023 20:54
@schloerke
schloerke requested a review from cpsievert February 9, 2023 20:55
Comment thread NEWS.md Resolved
Comment thread NEWS.md Resolved
Comment thread R/app-driver.R Resolved
Comment thread R/app-driver.R Resolved
Comment thread R/app-driver.R Resolved

@cpsievert cpsievert left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚀

@schloerke

Copy link
Copy Markdown
Collaborator Author

Haven't see the windows failure before. Seems unrelated. Merging

@schloerke schloerke changed the title Change default screenshot to scrollable area (from bounding box of html DOM) Change default screenshot selector to "scrollable_area" (from bounding box of "html" DOM) Feb 10, 2023
@schloerke
schloerke merged commit c1e303c into main Feb 10, 2023
@schloerke
schloerke deleted the default_screen_screenshot_size branch February 10, 2023 19:51
schloerke added a commit that referenced this pull request Feb 22, 2023
* main:
  Update cran-comments.md
  Update cran-comments.md
  Run revdep
  Move crashpad file to setup test file
  Update cran-comments.md
  Remove detritus Crashpad file/directory on CRAN
  Don't use github `{lintr}` or `{decor}` package
  Run revdep on 12 pkgs; ✅
  Remove C++11 from DESCRIPTION (#326)
  News entries for #284 and #288
  Load global vars when saving app objects (#307)
  Better error message when both app.R and server.R are found (#284)
  Don't assume preview overflow is of length 1 (#291)
  Force JS code to be a character for `{glue}` support (#288)
  fix typo: expect_unqiue_names -> expect_unique... (#270)
  Fix typo: use_shinytest -> use_shinytest2 (#269)
  `compare_screenshot_threshold()` should not error from `screenshot_max_difference()` (#276)
  Increment version number to 0.2.1
  Change default screenshot selector to `"scrollable_area"` (from bounding box of `"html"` DOM) (#325)
  actions/test-app; Add multi app `app-dir` support; Default upload-snapshot to `true`  (#322)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default to screenshot-ing the viewport (and/or make it easier?)

2 participants