rstudio / shinytest

Automated testing for shiny apps
https://rstudio.github.io/shinytest/
Other
225 stars 55 forks source link

Error: unable to start device PNG only when recording a test #366

Closed alessap closed 4 years ago

alessap commented 4 years ago

Dear All,

I have created a very simple dashboard following golem framework and when run the app looks like this:

image

However, when I record a test, the histogram is not rendered correctly and it looks like this;

image

From the R session (3.6.0):

> capabilities()
       jpeg         png        tiff       tcltk         X11        aqua    http/ftp     sockets      libxml 
       TRUE        TRUE        TRUE        TRUE       FALSE       FALSE        TRUE        TRUE        TRUE 
       fifo      cledit       iconv         NLS     profmem       cairo         ICU long.double     libcurl 
       TRUE        TRUE        TRUE        TRUE        TRUE        TRUE        TRUE        TRUE        TRUE 

> options("bitmapType")
$bitmapType
[1] "cairo"

I have installed phantomjs and all its dependencies on the server where I am running my development environment.

Does anybody have any idea what is wrong with this?

Best regards, Alessandro

alessap commented 4 years ago

More info:

> shinytest::recordTest("~/repos/cicdtest.dashboard")
Loading required package: shiny

Listening on http://127.0.0.1:7518
C> Running application in test mode.
C> Loading required package: shiny
C> Warning: replacing previous import ‘graphics::box’ by ‘shinydashboard::box’ when loading ‘cicdtest.dashboard’
C> 
C> Listening on http://127.0.0.1:6143
C> Warning in (function (filename = "Rplot%03d.png", width = 480, height = 480,  :
C>   unable to open connection to X11 display ''
C> Warning: Error in .External2: unable to start device PNG
C>   141: <Anonymous>
C>   139: startPNG
C>   138: drawPlot
C>   124: <reactive:plotObj>
C>   108: drawReactive
C>    95: origRenderFunc
C>    94: output$plot1
C>    14: <Anonymous>
C>    12: <Anonymous>
C> Warning in (function (filename = "Rplot%03d.png", width = 480, height = 480,  :
C>   unable to open connection to X11 display ''
C> Warning: Error in .External2: unable to start device PNG
C>   141: <Anonymous>
C>   139: startPNG
C>   138: drawPlot
C>   124: <reactive:plotObj>
C>   108: drawReactive
C>    95: origRenderFunc
C>    94: output$plot1
C>    14: <Anonymous>
C>    12: <Anonymous>
alessap commented 4 years ago

Adding options(bitmapType='cairo') to my .Rprofile file in the project folder solved the issue.