cypress: Does not pass the test from the example "XHR spying and stubbing"
- version:
- cyCypress package version: 2.1.0
- Cypress binary version: 2.1.0
- platform: OS X El Capitan
- expected pass test in GUI
- actual behavior: Error: CypressError: Timed out retrying: cy.wait() timed out waiting 5000ms for the 1st request to the route: βusersβ. No request ever occurred.
In CLI test passed.
In GUI failed:

AjaxList.vue:
<template>
<div>
<ul v-if="users && users.length">
<li v-for="user of users" v-bind:key="user.id">
<p><strong>{{user.id}}</strong> - {{user.name}}</p>
</li>
</ul>
</div>
</template>
<script>
// example from https://alligator.io/vuejs/rest-api-axios/
import axios from 'axios';
export default {
data() {
return {
users: []
}
},
// Fetches posts when the component is created.
created() {
axios.get('http://jsonplaceholder.typicode.com/users?_limit=3')
.then(response => {
// JSON responses are automatically parsed.
this.users = response.data
})
}
}
</script>
ajax-list-spec.js:
import AjaxList from '../../components/AjaxList.vue'
const mountVue = require('cypress-vue-unit-test')
/* eslint-env mocha */
describe('AjaxList', () => {
beforeEach(mountVue(AjaxList))
it('can inspect real data in XHR', () => {
cy.server()
cy.route('/users?_limit=3').as('users')
cy.wait('@users').its('response.body').should('have.length', 3)
})
})
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 21 (9 by maintainers)
Commits related to this issue
- chore: trying to figure out why #43 happens — committed to cypress-io/cypress-vue-unit-test by bahmutov 6 years ago
- chore: trying to figure out why bahmutov/cypress-vue-unit-test#43 happens — committed to cypress-io/cypress by bahmutov 6 years ago
Thanks after a commit dfffa0a, the test passes π. Cypress is a brilliant project π. Idea, implementation, support at the highest level. I wish you great success!