我正在运行一个非常简单的测试,它需要 javascript,只是为了检查索引加载和元素是否存在,如下所示:
\nclass ProfitsTest < ApplicationSystemTestCase\n setup do\n @admin = users(:admin)\n @admin.confirm\n sign_in @admin\n end\n\n test 'visiting the index' do\n # Index only test\n visit profits_url\n assert_selector 'h1', text: '\xe8\xa8\x88\xe7\xae\x97\xe8\xa1\xa8'\n end\nend\nRun Code Online (Sandbox Code Playgroud)\n我的水豚配置如下(只是删除 Puma 启动日志):
\nrequire 'test_helper'\n\nclass ApplicationSystemTestCase < ActionDispatch::SystemTestCase\n driven_by :selenium, using: :headless_chrome # :chrome\n Capybara.server = :puma, { Silent: true }\n Selenium::WebDriver.logger.ignore(:browser_options)\nend\nRun Code Online (Sandbox Code Playgroud)\n这是我收到的错误:
\n#<Thread:0x000000010f82b2d8 /Users/cody/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/capybara-3.37.1/lib/capybara/server.rb:76 run> terminated with exception (report_on_exception is true):\n/Users/cody/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/capybara-3.37.1/lib/capybara/registrations/servers.rb:32:in `block in <main>': undefined method `strings' for Puma::Events:Class (NoMethodError)\n\n events = conf.options[:Silent] …Run Code Online (Sandbox Code Playgroud) 就在上周,这工作正常,现在我的 PDF 文档给了我这个“无法提取嵌入字体 '1491bd-SourceHanSans-Normal'。某些字符可能无法正确显示。” 错误。
一直在寻找这几个小时,我查看了我最近的提交,找不到任何会导致这个问题突然出现的重大变化。
这是我用来进行错误测试的基本代码。
def invoice_pdf
require "prawn"
# document set up
Prawn::Document.generate("PDF.pdf", :page_size => "A4", :margin => [25], disposition: "inline") do |pdf|
# set utf-8 japanese font
pdf.font_families.update("SourceHan" => {
:normal => ".fonts/SourceHan/SourceHanSans-Normal.ttf",
})
pdf.font "SourceHan"
pdf.font_size 10
pdf.text '??? ????'
send_data pdf.render, type: 'application/pdf', disposition: :inline
end
end
Run Code Online (Sandbox Code Playgroud)
它在 Google Chrome 中打开时正确显示。但是使用 acrobat 或其他浏览器(如使用默认系统预览应用程序的 Firefox),它给了我错误。
想法?
这记录在定制文档中。但是,如果您以这种方式添加菜单项,即使用户尚未登录管理区域,它也会显示为链接。