Vue未装入测试(黄瓜/水豚)

时间:2018-06-11 13:14:02

标签: javascript ruby-on-rails ruby vuejs2 cucumber

我正在测试包含黄瓜vue对象的RoR应用程序。 一切都在浏览器中很好,但在测试中没有加载vue。我试图增加水豚的等待时间,但它没有用。请指点我。

我明白了: here is how the page looks in test

我要测试的代码是

#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

1 个答案:

答案 0 :(得分:0)

对我有用的是将整个测试套件切换为Selenium headless-chrome,而不是Poltergeist / Phantom JS。