diff --git a/tests/testthat/helper-functions.R b/tests/testthat/helper-functions.R index 0931c34ab..a19eb0546 100644 --- a/tests/testthat/helper-functions.R +++ b/tests/testthat/helper-functions.R @@ -417,14 +417,10 @@ find_test_path <- function(dir = ".") { file.path(dir, ext_dir) } -runtime_evaluate <- function(script=NULL,return.value=FALSE){ +runtime_evaluate <- function(script=NULL){ eval.result<- remDr$Runtime$evaluate(script,returnByValue = TRUE) - if (return.value){ - eval.result$result$value - }else{ - eval.result - } + } runtime_evaluate_helper <- function(class_name=NULL, id=NULL, list_num=NULL, dispatch_event=NULL, return.value=FALSE) { @@ -441,5 +437,5 @@ runtime_evaluate_helper <- function(class_name=NULL, id=NULL, list_num=NULL, dis script_template <- "document.getElementsByClassName('%s')[%d].dispatchEvent(new CustomEvent('click'));" script <- sprintf(script_template,class_name,list_num) } - runtime_evaluate(script = script, return.value = return.value) + runtime_evaluate(script = script) } diff --git a/tests/testthat/test-renderer1-knit-print.R b/tests/testthat/test-renderer1-knit-print.R index 0c24c968c..5d8f46e7d 100644 --- a/tests/testthat/test-renderer1-knit-print.R +++ b/tests/testthat/test-renderer1-knit-print.R @@ -78,10 +78,10 @@ get_circles <- function(html=getHTML()) { } get_elements <- function(id){ - a<- runtime_evaluate_helper(id=as.character(id),class_name='show_hide_selector_widgets',list_num=0,return.value=TRUE) - b<- runtime_evaluate_helper(id=as.character(id),class_name='show_hide_selector_widgets',list_num=0,return.value=TRUE) - show_hide <- runtime_evaluate_helper(id=as.character(id),class_name='table.legend tr.label_variable',list_num=0,return.value=TRUE) - widget <- runtime_evaluate_helper(id=as.character(id),class_name='table.legend tr.label_variable',list_num=1,return.value=TRUE) + a<- runtime_evaluate_helper(id=id,class_name='show_hide_selector_widgets',list_num=0,return.value=TRUE) + b<- runtime_evaluate_helper(id=id,class_name='show_hide_selector_widgets',list_num=0,return.value=TRUE) + show_hide <- runtime_evaluate_helper(id=id,class_name='table.legend tr.label_variable',list_num=0,return.value=TRUE) + widget <- runtime_evaluate_helper(id=id,class_name='table.legend tr.label_variable',list_num=1,return.value=TRUE) list(a178=a, b934=b, show_hide=show_hide, diff --git a/tests/testthat/test-renderer2-widerect.R b/tests/testthat/test-renderer2-widerect.R index e1ff86387..9dc1a2cbb 100644 --- a/tests/testthat/test-renderer2-widerect.R +++ b/tests/testthat/test-renderer2-widerect.R @@ -339,7 +339,6 @@ test_that("pause stops animation (third time)", { expect_true(old.year == new.year) }) -#runtime_evaluate(script="document.getElementsByClassName('show_hide_selector_widgets')[0].dispatchEvent(new CustomEvent('click'));") runtime_evaluate_helper(class_name="show_hide_selector_widgets",list_num=0,dispatch_event=TRUE) clickSelector("year_variable_selector_widget") sendKey("Backspace", "Backspace", 8)