javascript - Vue 未在测试中加载(黄瓜/水豚)
问题描述
我正在用黄瓜测试我的包含 vue 对象的 RoR 应用程序。在浏览器中一切正常,但在测试中未加载 vue。我试图增加水豚的等待时间,但没有奏效。请指出我的地方。
我要测试的代码是
#student_profiles.nomargin
= render "header"
.container-fluid.nopadding
.student_count.aside-wrap.rounded-corners
%text v-bind:students-count="studentsCount"
%p.text Sie können aktuell aus <b>{{studentsCount.count}}</b>
Schülerinnen und Schülern aus bis zu 50 Ländern wählen.</p>
.filters.aside-wrap
%h4 Verfeinern Sie Ihre Auswahl durch Filtern: <filters :filters="filters" :filter-params="filterParams" :load-limit="loadLimit" :students="students" :counter="counter" :hobbies="hobbies" :update="update" :filter-loaded="filterLoaded"></filters>
%br
%text v-bind:students-count="studentsCount"
%p.text Es werden <b>{{studentsCount.count_filter}}</b> von <b>{{studentsCount.count}}</b> angezeigt.</p>
%br
我使用的步骤是:
@javascript
Scenario: Happy path to bla-bla
Given I am on a mobile device
Given I have '6' students shown in the app
And I visit 'url'
And I wait for the ajax request to finish
Then I should see "6" within ".student_count"
对于步骤,Given I have '6' students shown in the app
我有以下步骤定义。
Given(/^I have '(\d+)' students shown in the app$/) do |student_count|
student_count.to_i.times do
student = FactoryBot.create(:ib_student)
FactoryBot.create(:ib_student_profile, student: student, force_profile_visible: true)
end
end
解决方案
对我有用的事情是将我们的整个测试套件切换到 Selenium headless-chrome 而不是 Poltergeist/Phantom JS。
推荐阅读
- docker - 无法从私有 Docker 注册表中删除图像
- jenkins - Jenkins 负载平衡 - 其他免费系统上的自动路由
- jquery - 将 jquery 插件转换为角度组件
- javascript - 从 JSON 模式生成 JavaScript 类
- javascript - 如何在量角器 e2e 测试中等待浏览器?
- c - 当我打印新值时,我得到了以前的浮点值
- c# - 从不同项目的 appsettings.json 读取多个连接字符串
- macos - 如何在 shell 脚本中确定 Mac OS X 版本?
- javascript - 选择下拉列表首先显示最后一个值
- javascript - 内联箭头函数点击监听器