I have a problem and I’ve tried to solve it, but I don’t understand why it’s not working. I run a test, and the test never finishes. I get “Your tests are loading….”, but it doesn’t select the button either. I’m attaching the information I have here:
'''describe('Salesforce Login', () => {
it('should login to Salesforce', () => {
// Visit the Salesforce login page
console.log('Clicked on Login button');
cy.visit('');
// Fill in the username and password
cy.get('#username').type('');
cy.get('#password').type('');
cy.get('#Login').click();
cy.wait(10000);
cy.get('button.slds-button[title="Show Navigation Menu"]').click();
console.log('Clicked on element after login');
})});'''
and the following:
index.js
import './commands';
require('cypress-xpath');
Cypress.on('uncaught:exception', (err, runnable) => {
// Check for the specific error message
if (err.message.includes('Cannot read properties of undefined (reading 'addEventHandler')')) {
// Prevent Cypress from failing the test
return false;
}
// Let other errors fail the test
return true;
});
and the following:
cypress.config.js:
”’
const { defineConfig } = require('vite');
const react = require('@vitejs/plugin-react');
module.exports = defineConfig({
e2e: {
// Enable experimental studio mode for Cypress
experimentalStudio: true,
// Specify the path to the Cypress support file
supportFile: 'cypress/support/index.js',
},
// Set the viewport dimensions for the tests
viewportHeight: 768,
viewportWidth: 1366,
component: {
devServer: {
// Specify the framework being used
framework: "react",
// Specify the bundler being used
bundler: "vite",
viteConfig: {
// Add the React plugin for Vite
plugins: [react()],
server: {
// Set the development server port
port: 3000,
},
// Disable Chrome web security for tests (use with caution)
chromeWebSecurity: false,
},
},
},
});
'''