Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

240
Visualizações
R/Shiny - Shinytest JS interpreter can not work with Promise and has old JS Standart

I want to use the R package shinytest to test my R/Shiny application. Now, I facing one strange issue after another. It seams that the JavaScript Interpreter of "shinytest" or which runs in the background can not work with Promise, neither simple things like 'a'.startsWith('a') does not work.

Can I switch the backend of shinytest or can I somehow add the missing JavaScript features?

In the following you see a minimal example, the app itself has no meaning, but the executing Javascript inside the test suite shows that simple calls fails.

To run the example you may need to install the "globals" package. Like renv::install("globals").

Example:

library(shiny)
library(shinytest)

# you may need to run: 
# renv::install("globals")


ui <- fluidPage(
  titlePanel("Hello Shiny!"),
  sidebarLayout(
    sidebarPanel(),
    mainPanel()
  )
)


# Define server logic required to draw a histogram ----
server <- function(input, output) {}


# See above for the definitions of ui and server
app <- shinyApp(ui = ui, server = server)

testapp <- ShinyDriver$new(app, debug="all")

testapp$executeScript("console.log('Hello')")
print(testapp$getDebugLog("browser"))
testapp$executeScript("console.log('a'.startsWith('b'))")
print(testapp$getDebugLog("browser"))
testapp$executeScript("console.log(Promise)")
print(testapp$getDebugLog("browser"))


The last print statements should always return correct output. But the error messages are:

B/I 12:26:40.26 Hello (:)> testapp$executeScript("console.log('a'.startsWith('b'))")
Error in session_makeRequest(self, private, endpoint, data, params, headers) : 
  undefined is not a function (evaluating ''a'.startsWith('b')')
> print(testapp$getDebugLog("browser"))
> testapp$executeScript("console.log(Promise)")
Error in session_makeRequest(self, private, endpoint, data, params, headers) : 
  Can't find variable: Promise

This means that Promises are not available in this shinytest package.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda