rstudio / shinytest

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

Test only fails in Windows job on Github Actions #371

Closed FrieseWoudloper closed 3 years ago

FrieseWoudloper commented 3 years ago

I created a very basic Shiny app and accompanying test using shinytest. The test passes on my Windows laptop. After I push my local repo to Github, the tests passes for the macOS and ubuntu jobs in Github Actions, but fails for the Windows job. See https://github.com/FrieseWoudloper/reprexshinytest/actions/runs/398213952

When I look at the log file, it seems to me there is a problem with line breaks:

< {

<   "input": {

< 

<   },

<   "output": {

< 

<   },

<   "export": {

< 

<   }

< }

---
> {
>   "input": {
> 
>   },
>   "output": {
> 
>   },
>   "export": {
> 
>   }
> }

Am I correct? How do I solve this issue?

dylanrussellmd commented 3 years ago

I am having identical issues. My log output looks like:

-- FAILURE (test-app.R:9:3): all modules work ----------------------------------
Not all shinytest scripts passed for apps/selector_app: selector_test

Diff output:
==== selector_test ====
diff "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\RtmpWYO0Oy/working_dir\\RtmpqmGvu2\\shinytest-diff-690eb816c1/selector_test-expected/001.json" "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\RtmpWYO0Oy/working_dir\\RtmpqmGvu2\\shinytest-diff-690eb816c1/selector_test-current/001.json"
1,12c1,12
< {

<   "input": {

<     "selector-procedure": "",

<     "selector-subject: ""

<   },

<   "output": {

<     "text": "You have selected subjectID    and procedure   ."

<   },

<   "export": {

< 

<   }

< }

---
> {
>   "input": {
>     "selector-procedure": "",
>     "selector-subject": ""
>   },
>   "output": {
>     "text": "You have selected subjectID    and procedure   ."
>   },
>   "export": {
> 
>   }
> }
wch commented 3 years ago

It might be related to how git on Windows converts \n to \r\n when you do a checkout. You could try doing something like this:

https://github.com/rstudio/shinycoreci-apps/blob/6f2cc1e6bc59e509b8b151190d9dd50ec9efaadd/.github/workflows/ci-runtests.yml#L161-L164

dylanrussellmd commented 3 years ago

It might be related to how git on Windows converts \n to \r\n when you do a checkout. You could try doing something like this:

https://github.com/rstudio/shinycoreci-apps/blob/6f2cc1e6bc59e509b8b151190d9dd50ec9efaadd/.github/workflows/ci-runtests.yml#L161-L164

So to clarify, that step needs to be present before any actions/checkout step. This fixed the issue for me.

FrieseWoudloper commented 3 years ago

It also fixed my problem. Thanks!