Rails Github Action 无法填写操作文本

Bra*_*ues 6 ruby-on-rails capybara github-actions

使用 Rails 6.1.4,以下工作在本地进行,以在系统测试中填充富文本(操作文本):

find("trix-editor").set("Something")
Run Code Online (Sandbox Code Playgroud)

但是,在 GitHub 操作上运行时,我收到:

Capybara::ElementNotFound: Unable to find visible css "trix-editor"

将代码更改为:

find("trix-editor", visible: false).set("Something")
Run Code Online (Sandbox Code Playgroud)

在本地也可以工作,但在 GitHub CI 上再次失败:

Selenium::WebDriver::Error::ElementNotInteractableError: element not interactable

我还尝试过以下方法:

find("#unique_element_id").set("Something")
find(:css, ".trix-content").click.set("Something")
Run Code Online (Sandbox Code Playgroud)

我在本地和 GitHub CI 映像上运行 Ubuntu 20.04。我该如何解决这个问题?

编辑:

我发现有一些未合并的 Rails 代码应该执行此操作。然而,在 my 中实现它test_helper也可以在本地工作,但在 CI 上失败。也许我只需要尝试另一个 CI 提供商

yos*_*dyo 0

您可以尝试等到元素显示:

element = wait.until { driver.find_element(:class => "trix-editor") }
element.click

Run Code Online (Sandbox Code Playgroud)