I have the following code in the test:
it('shows correct language', () => {
cy.visit('/product/my product');
cy.changeLanguage('English');
cy.get('[data-test=attribute-name]').should(
(elements) => {
console.log('this shows in console', elements);
alert('But it wont break!!!!!!!!!!');//this alert shows
debugger;//never breaks here
},
);
});
Started cypress with ./node_modules/.bin/cypress open then I run the test in the cypress window, that opens chrome and I open the dev tools manually (don't know how tell cypress to open chrome with devtools open).
It shows the message in the console and shows the alert but never actually breaks. In the sources tab the "Deactivate breakpoints" is not set so breakpoints are active.
Manually set the breakpoint and then click the "Run all test" button after the first run will pause on the manually set breakpoint but ignores the debugger statement.
I think I've managed to solve the issue you're having
Rather than using debugger, you can use cy.debug(). But for it to work, you NEED to have your debugger/console open when running the test.
Check out this page for more info: https://docs.cypress.io/api/commands/debug.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With