简体   繁体   中英

Vue not loaded in test (cucumber/capybara)

I'm testing my RoR application containing vue objects with cucumber. All is well in the browser, but in tests vue isn't loaded. I tried to increase waiting time for capybara, but it didn't work. Please point me somewhere.

I get this: 这是测试页面的外观

The code I want to test is

#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

Steps i use are:

@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"

For the step Given I have '6' students shown in the app i have following step definition.

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。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM