I am trying to execute a simple program to visit a page -
describe('Login to Tabaq', () => {
it('Login Valid Test', () => {
cy.visit('https://tabaq.ae/Login/index')
})
})
Upon execution it throws error -
SyntaxError: The following error originated from your application code, not from Cypress.
Cannot use import statement outside a module
I read few blogs and videos and already set the "type": "module" in my package.json
The error comes from the web page itself not the test code - The following error originated from your application code, not from Cypress.
If you open the page in a browser (not running Cypress), look at the devtools Console tab you see the error, and it's referring to
parsley.jswhich would appear to be part of this library parsleyjs.org.It seems that the library has been used incorrectly in the app, but you will have to alter the app to fix it.
You could handle it in the test as per this documentation
To conditionally turn off uncaught exception handling for a certain error
This will allow the test to proceed, but if the Parsley validation library is part of your testing, you will get further errors later in the test spec.
The best approach is to fix the problem in the app.