Skip to content

Add compare_file_screenshot(); Add AppDriver$expect_screenshot(compare=)#231

Merged
schloerke merged 29 commits intomainfrom
cpp11_all_the_things
Sep 13, 2022
Merged

Add compare_file_screenshot(); Add AppDriver$expect_screenshot(compare=)#231
schloerke merged 29 commits intomainfrom
cpp11_all_the_things

Conversation

@schloerke
Copy link
Copy Markdown
Collaborator

@schloerke schloerke commented Jun 27, 2022

Fixes rstudio/chromote#96
Fixes #220

(Creating PR now, will update docs before merge); Updated docs for methods

@schloerke schloerke added this to the v0.2.0 milestone Jun 27, 2022
@schloerke
Copy link
Copy Markdown
Collaborator Author

Some widows have a very large diff in the value found in a test

I wonder if reading a png is different in different operating systems. Or if finding the diff matrix is different on different OS values

routine is a bug in shiny-workflows / pak. IDK which right now

@schloerke
Copy link
Copy Markdown
Collaborator Author

Found a bug in which I was accessing matrix locations that were not initialized in cpp. 🤦‍♂️

@schloerke schloerke marked this pull request as ready for review September 9, 2022 14:39
schloerke and others added 4 commits September 9, 2022 12:12
Co-Authored-By: Garrick Aden-Buie <garrick@adenbuie.com>
* main:
  Fix docs on `delay` being in seconds (#255)
* main:
  Add test app to test ui/server combo (#257)
screenshot_args = missing_arg(),
delay = missing_arg(),
selector = missing_arg(),
compare = missing_arg(),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

For future reference, here's another possibility for the API.

We could remove the threshold and kernel_size params from this function, and the default value for compare would be:

  compare = testthat::compare_file_binary

And then if people want to use the fuzzy comparison, they would do something like:

  compare = fuzzy_comparer(threshold = 3, kernel_size = 5)

  # Or maybe those values could use those as defaults
  compare = fuzzy_comparer()

The benefit is that it's a more general API, and provides a cleaner interface for plugging in other comparison functions. However, it seems unlikely anyone would ever use this capability, and it requires people to know about the fuzzy_comparer function.

@wch
Copy link
Copy Markdown
Collaborator

wch commented Sep 13, 2022

Here's a diagram illustrating the algorithm when traversing a row.

image

@schloerke
Copy link
Copy Markdown
Collaborator Author

Merging and keeping unresolved convo open as it is a comment.

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.

ChromoteSession$screenshot() triggers a page resize before screenshot. Rounded corners are not consistent

2 participants