Skip to content

[Bug]: Tests fail #951

@llrs-roche

Description

@llrs-roche

What happened?

Check on main are failing, this affects #922 and other PR.

The errors are due to:

  • example failing on tm_file_viewer()
  • Not finding some elements on shinytest2-tm_file_viewer
Details

  Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  >   pkg_name <- "teal.modules.general"
  >   if (requireNamespace("testthat", quietly = TRUE)) {
  +     library(testthat)
  +     reporter <- MultiReporter$new(list(
  +       CheckReporter$new(),
  +       JunitReporter$new(file = "junit-result.xml")
  +     ))
  +     test_check(pkg_name, reporter = reporter)
  +   }
  Loading required package: teal.modules.general
  Loading required package: ggplot2
  Loading required package: shiny
  Loading required package: teal
  Loading required package: teal.data
  Loading required package: teal.code
  Loading required package: teal.slice
  
  You are using teal version 1.1.0.9002
  
  Attaching package: 'teal'
  
  The following objects are masked from 'package:teal.slice':
  
      as.teal_slices, teal_slices
  
Execution halted
  Loading required package: teal.transform
  Saving _problems/test-shinytest2-tm_file_viewer-47.R
  Saving _problems/test-shinytest2-tm_file_viewer-64.R
  Saving _problems/test-shinytest2-tm_file_viewer-70.R
  Saving _problems/test-shinytest2-tm_file_viewer-86.R
  [ FAIL 4 | WARN 1 | SKIP 5 | PASS 470 ]
  
  ══ Skipped tests (5) ═══════════════════════════════════════════════════════════
  • distribution initializes with short validation error (1):
    'test-examples.R:145:9'
  • ggmosaic issue: will be resumed via the issue (3):
    'test-shinytest2-tm_g_association.R:69:3',
    'test-shinytest2-tm_g_association.R:91:3',
    'test-shinytest2-tm_g_association.R:101:3'
  • ggmosaic issue: will be resumed via the issue #925 in tmg (1):
    'test-shinytest2-tm_g_association.R:52:3'
  
  ══ Warnings ════════════════════════════════════════════════════════════════════
  ── Warning ('test-examples.R:155:7'): example-tm_file_viewer.Rd ────────────────
  Non-existent file or url path. Please provide valid paths for:
  https://fda.gov/files/drugs/published/Portable-Document-Format-Specifications.pdf
  Backtrace:
       ▆
    1. ├─teal.modules.general (local) with_mocked_app_bindings(...) at test-examples.R:155:7
    2. │ ├─testthat::with_mocked_bindings(...) at test-examples.R:121:3
    3. │ └─testthat::with_mocked_bindings(...) at test-examples.R:121:3
    4. ├─teal.modules.general (local) suppress_warnings(...) at test-examples.R:121:3
    5. │ └─base::withCallingHandlers(...) at test-examples.R:24:3
    6. ├─testthat::expect_no_error(...)
    7. │ └─testthat:::expect_no_(...)
    8. │   └─testthat:::quasi_capture(enquo(object), NULL, capture)
    9. │     ├─testthat (local) .capture(...)
   10. │     │ ├─base::withRestarts(...)
   11. │     │ │ └─base (local) withOneRestart(expr, restarts[[1L]])
   12. │     │ │   └─base (local) doWithOneRestart(return(expr), restart)
   13. │     │ └─base::withCallingHandlers(...)
   14. │     └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
   15. └─pkgload::run_example(...)
   16.   └─base::source(tmp, echo = !quiet, local = env, max.deparse.length = Inf)
   17.     ├─base::withVisible(eval(ei, envir))
   18.     └─base::eval(ei, envir)
   19.       └─base::eval(ei, envir)
   20.         ├─teal::init(...)
   21.         │ ├─checkmate::assert(...)
   22.         │ │ └─base::eval(dots[[i]], envir = env)
   23.         │ │   └─base::eval(dots[[i]], envir = env)
   24.         │ └─checkmate::check_multi_class(modules, c("teal_modules", "teal_module"))
   25.         ├─teal::modules(...)
   26.         └─teal.modules.general::tm_file_viewer(...)
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-shinytest2-tm_file_viewer.R:47:3'): e2e - tm_file_viewer: Shows selected image file ──
  Error in `app_find_node_id(self, private, input = input, output = output, selector = selector)`: Cannot find HTML element with selector [id= '4_anchor']
  Backtrace:
      ▆
   1. └─app_driver$click(selector = "[id= '4_anchor']") at test-shinytest2-tm_file_viewer.R:47:3
   2.   └─super$click(...)
   3.     └─shinytest2:::app_click(...)
   4.       └─shinytest2:::app_find_node_id(self, private, input = input, output = output, selector = selector)
   5.         └─shinytest2:::app_abort(...)
   6.           └─rlang::abort(..., app = self, call = call)
  ── Failure ('test-shinytest2-tm_file_viewer.R:64:3'): e2e - tm_file_viewer: Shows selected text file ──
  Expected `app_driver$is_visible(app_driver$namespaces(TRUE)$module("output pre"))` to be TRUE.
  Differences:
  `actual` is NULL
  `expected` is a logical vector (TRUE)
  
  ── Failure ('test-shinytest2-tm_file_viewer.R:70:3'): e2e - tm_file_viewer: Shows selected text file ──
  Expected `!is.na(pre_text)` to be TRUE.
  Differences:
  `actual`:   FALSE
  `expected`: TRUE 
  
  ── Failure ('test-shinytest2-tm_file_viewer.R:86:3'): e2e - tm_file_viewer: Shows selected url ──
  Expected `app_driver$is_visible(app_driver$namespaces(TRUE)$module("output img"))` to be TRUE.
  Differences:
  `actual` is NULL
  `expected` is a logical vector (TRUE)
  
  
  [ FAIL 4 | WARN 1 | SKIP 5 | PASS 470 ]
  Error:
  ! Test failures.
  Execution halted

They might be partially addressed by #947

sessionInfo()

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.

Security Policy

  • I agree to follow this project's Security Policy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcore

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions