Skip to content

Test Issue Found During R CMD check #130

@Andrew-Acker125

Description

@Andrew-Acker125

Hello, We've been running R CMD check for packages for our package registry manager PRISM (https://prism.dev.a2-ai.cloud/ ) and noticed that sortable is failing with the following error:

checking tests Running testthat.R
  Running the tests in tests/testthat.R failed.
  Last 13 lines of output:
    Deleting unused snapshots:
    'linux-4.2/shinytest2/test_update_title-001.png',
    'linux-4.2/shinytest2/test_update_title-002.png',
    'shinytest2/test_change_labels-001.json',
    'shinytest2/test_change_labels-001_.png',
    'shinytest2/test_change_labels-002.json',
    'shinytest2/test_change_labels-002_.png',
    'shinytest2/test_empty_labels-001.json',
    'shinytest2/test_empty_labels-001_.png',
    'shinytest2/test_empty_labels-002.json',
    'shinytest2/test_empty_labels-002_.png',
    'shinytest2/test_empty_labels-003.json',
    and 'shinytest2/test_empty_labels-003_.png'
    Error: ! Test failures.
    Execution halted

Here are the failing tests:

test-shinytest2.R:

app_dir <- system.file("shiny/update_rank_list", package = "sortable")

test_that("{shinytest2} recording: test_update_title", {
  skip_on_cran()
  skip_on_ci()
  skip_if_not_installed("shinytest2")
  app <- AppDriver$new(
    variant = platform_variant(),
    name = "test_update_title",
    app_dir = app_dir, seed = 123, height = 945, width = 1619
  )
  app$expect_values()
  app$set_inputs(`rank_list_basic-rank_list_container` = c("Level 2", "Level 1", "Level 3"))
  app$wait_for_idle()
  app$expect_screenshot(threshold = 3)
  app$click("update_title")
  app$expect_screenshot(threshold = 3)
  app$stop()
})

test_that("{shinytest2} recording: test_change_labels", {
  skip_on_cran()
  skip_on_ci()
  skip_if_not_installed("shinytest2")
  app <- AppDriver$new(
    name = "test_change_labels",
    app_dir = app_dir, seed = 123, height = 945, width = 1619
  )
  app$expect_values()
  app$set_inputs(`rank_list_basic-rank_list_container` = c("Level 2", "Level 1", "Level 3"))
  app$wait_for_idle()
  app$click("update_labels")
  app$wait_for_idle()
  app$expect_values()
  app$stop()
})

test_that("{shinytest2} recording: test_empty_labels", {
  skip_on_cran()
  skip_on_ci()
  skip_if_not_installed("shinytest2")
  app <- AppDriver$new(
    name = "test_empty_labels",
    app_dir = app_dir, seed = 123, height = 945, width = 1619
  )
  app$expect_values()
  app$set_inputs(`rank_list_basic-rank_list_container` = c("Level 2", "Level 1", "Level 3"))
  app$wait_for_idle()
  app$click("empty_labels")
  app$wait_for_idle()
  app$expect_values()
  app$stop()
})

All 3 tests fail with the same error: object 'AppDriver' not found.

Investigating the error, we found that the tests call AppDriver$new() but shinytest2 is never called from the library, causing all 3 tests to fail. We confirmed that adding library(shinytest2) to tests/testthat/setup-shinytest2.R resolves all 3 failures. Happy to provide any more details or clarity if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions