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.

add
@schloerke schloerke self-assigned this Feb 3, 2020
@schloerke schloerke requested a review from wch Feb 3, 2020
R/shiny-driver.R Outdated Show resolved Hide resolved
R/shiny-driver.R Outdated Show resolved Hide resolved
R/shiny-driver.R Outdated Show resolved Hide resolved
R/shiny-driver.R Outdated Show resolved Hide resolved
@schloerke
Copy link
Contributor Author

@schloerke 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 Feb 4, 2020
DESCRIPTION Outdated Show resolved Hide resolved
@wch
Copy link
Collaborator

@wch 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()
R/shiny-driver.R Outdated Show resolved Hide resolved
@schloerke schloerke requested a review from wch Feb 7, 2020
R/widget-get-value.R Outdated Show resolved Hide resolved
@schloerke schloerke merged commit 82ae7c4 into master Feb 7, 2020
3 checks passed
3 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details
@schloerke schloerke deleted the wait_for_value branch Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.