Skip to content
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

add app$waitForValue #304

Merged
merged 22 commits into from
Feb 7, 2020
Merged

add app$waitForValue #304

merged 22 commits into from
Feb 7, 2020

Conversation

schloerke
Copy link
Contributor

@schloerke schloerke commented Feb 3, 2020

Fixes #301

  • Document Usage
  • Document R6 docs
  • Document website, in Testing in Depth
  • Document website, in FAQ
  • NEWS item

Prior

app <- ShinyDriver$new("../../", seed = 100, shinyOptions = list(display.mode = "normal"))
app$snapshotInit("mytest")

Sys.sleep(5)
app$snapshot()

app$setInputs(state = "California")
Sys.sleep(1)
app$snapshot()

New

app <- ShinyDriver$new("../../", seed = 100, shinyOptions = list(display.mode = "normal"))
shinyOptions = list(display.mode = "normal"))
app$snapshotInit("mytest")

initValue <- app$waitForValue("state")
app$snapshot()

app$setInputs(state = "California")
app$waitForValue("state", initValue)

app$snapshot()

System time for both waitForValue calls take < 1s on my machine.

@schloerke schloerke self-assigned this Feb 3, 2020
@schloerke schloerke requested a review from wch February 3, 2020 21:25
@schloerke
Copy link
Contributor Author

schloerke commented Feb 4, 2020

I don't know if this would actually work....

app <- ShinyDriver$new("../../", seed = 100, shinyOptions = list(display.mode = "normal"))
shinyOptions = list(display.mode = "normal"))
app$snapshotInit("mytest")

initValue <- app$waitForValue("state")
app$snapshot()

app$setInputs(state = "California")
app$waitForValue("state", initValue)

app$snapshot()

I have a feeling that the last snapshot will be called before the ggplot2 value is set.

I think it would almost need a

app$setInputs(state = "California")
app$waitForValue("state", initValue)
app$waitForValue("plot", priorPlotValue, iotype = "output")

app$snapshot()

@wch What about adding another function that says app$waitForUpdatedValue which will capture the existing value and keep checking until the retrieved value does not match the initial retrieved value? Should we go down the app$waitForValues / app$waitForUpdatedValues route as well?

@schloerke schloerke requested a review from wch February 4, 2020 23:43
@wch
Copy link
Collaborator

wch commented Feb 6, 2020

Thoughts:

  • Change invalidValues to ignore
  • Always use list() in examples for ignore
  • Document this usage pattern:
priorPlotValue <- app$getValue("plot")
app$setInputs(state = "California")
app$waitForValue("state", ignore = list(initValue))
app$waitForValue("plot", ignore = list(priorPlotValue), iotype = "output")
app$snapshot()

@schloerke schloerke requested a review from wch February 7, 2020 20:52
@schloerke schloerke merged commit 82ae7c4 into master Feb 7, 2020
@schloerke schloerke deleted the wait_for_value branch February 7, 2020 22:14
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.

Should have function to wait for input to be a certain value
2 participants