Having trouble with the Cypress cy.visit() function timing out and aborting tests on a VueJS Web Application? It seems to work fine when opening other non-VueJS sites. Below is my basic configuration setup:
[package.json]
"dependencies": {
"cypress": "^4.2.0",
"cypress-cucumber-preprocessor": "^2.0.1"
}
[cypress.json]
{
"defaultCommandTimeout": 8000,
"pageLoadTimeout": 10000,
"testFiles": "**/*.{feature,features}"
}
[\cypress\plugins\index.js]
const cucumber = require('cypress-cucumber-preprocessor').default
module.exports = (on, config) => {
on('file:preprocessor', cucumber())
}
[\cypress\integration\cucumber-tests\login.feature]
Feature: Login
As a user I desire to login
Scenario: Login to a Website
Given I open a website
[\cypress\integration\cucumber-tests\login\loginSteps.js]
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
import LoginPage from './loginPage'
Given('I open a website', () => {
LoginPage.visit()
})
[\cypress\integration\cucumber-tests\login\loginPage.js]
//const URL = 'https://www.google.com' // Not a VueJS WebApp - Works Fine
//const URL = 'https://www.gitlab.com' // This is a VueJS WebApp - Times out and aborts rest of tests
const URL = 'https://www.nintendo.com' // This is a VueJS WebApp - Times out and aborts rest of tests
// List of VueJS WebApps: https://www.techuz.com/blog/top-9-websites-built-using-vue-js/
class LoginPage {
static visit() {
cy.wait(3000)
cy.visit(URL)
}
}
export default LoginPage
[Screenshot - Passing on Google]
https://i.sstatic.net/jXkBf.png
[Screenshot - Failing on Nintendo]
https://i.sstatic.net/q8zDC.jpg
[Screenshot - Failing on Gitlab]
https://i.sstatic.net/VqKQs.png
[Screenshot - Passing with a local VueJS instance]
https://i.sstatic.net/UMzyU.png
[Troubleshooting]
- Tried different cypress versions but still facing the issue
- Non-VueJS websites are working, while VueJS websites are failing
- Explored Google for solutions, but couldn't find relevant information
- Increased page load time as suggested in some articles, but no luck
- If you have any insights or additional info to help resolve this, it would be greatly appreciated. Thank you! =)