Shinytest has problem finding external package imported into R package

I have a package with shiny code to which I try to add tests by using the shinytest::recordTest() function. Basically, I just downloaded the shinytestPackageExample repo but added @importFrom roperator chrand a call to chr in the server method.

If I try devtools::load_all() followed by shinytest::recordTest('inst/sampleapp/')I get the error Error in chr: could not find function "chr". See screen shot.

My modified version of the repo is available here. I also list the changed files below.

helloworld.R:

#' A Hello World Shiny app
#'
#' @import shiny
#' @importFrom graphics plot
#' @importFrom utils head
#' @importFrom roperators chr
#' @export
helloWorldApp <- function() {
  utils::data(cars)
  shinyApp(
    ui = fluidPage(
      sliderInput("n", "n", 1, nrow(cars), 10),
      plotOutput("plot")
    ),
    server = function(input, output) {
      output$plot <- renderPlot({
        a <- chr(9)
        plot(head(cars, input$n), xlim = range(cars[[1]]), ylim = range(cars[[2]]))
      })
    }
  )
}

# This is needed to make R CMD check happy
globalVariables("cars")

DESCRIPTION:

Package: shinytestPackageExample
Version: 1.0
Title: Example package that uses shinytest
Description: Example package that uses shinytest.
Authors@R: person("Chang", "Winston", , "winston@rstudio.com", c("aut", "cre"))
License: Unlimited
Encoding: UTF-8
LazyData: true
ByteCompile: true
RoxygenNote: 7.1.1
Suggests: 
    testthat,
    shinytest
Imports: 
    shiny,
    roperators
Remotes:
    rstudio/shinytest

And NAMESPACE (generated through the use of devtools::document()):

# Generated by roxygen2: do not edit by hand

export(helloWorldApp)
import(shiny)
importFrom(graphics,plot)
importFrom(roperators,chr)
importFrom(utils,head)

I hope that this is enough info, if not, please let me know. I would be grateful if someone has a solution to the problem.

I managed to solve the problem. Basically, I removed the contents of inst/sampleapp/app.R, and instead it now only contains the following two lines:

pkgload::load_all()
helloWorldApp()

By calling pkgload::load_all(), it loads the app and finds the @importFrom roperator chr.

If you find the solution unsatisfactory, please comment, as this will help me and others.

I have pushed the solution to the repo in the original post. The commit containing the original question is commit 844011a, whereas my fix is in commit b297e1d.