-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cypress will not stop test run if errors in before hook #1343
Comments
haven't tested but I suspect that after() hook has a similar issue. |
Can confirm - but this is only in the I'm investigating to understand if this is a regression. To be clear, it only happens in |
Okay did my homework
All that's a problem is that we're not visually showing the error and the test's state is not displayed. The test continues to "spin" but it should be errored, and we should show the error that explains that the remaining tests in the suite have been skipped. |
The root cause of this is a bug in mocha - it's short circuiting some login in certain situations and we don't account for it. Mocha is not correctly running root level Additionally this bug only crops up when the test has siblings - if its the last test in a suite, it will work correctly. |
Nevermind - mocha is not the problem here. We are just not taking into account the edge case where a test fails in a |
…or tests which failed due to a before hook and have sibling tests - add e2e test around this behavior - cleanup runner code for clarity
This PR should fix this. Thank you for opening a good issue. |
Released in |
FWIW I'm seeing this in "run" mode as well as a result of a page timeout during before. The screenshot gets written but the process never exits. |
I can confirm this is still exists even in 3.1.0
cypress waiting for the ^C to stop
|
HEy @podarok, could you provide a reproducible example? Can you share you test code? |
code const paragraphType = 'Teaser';
const contentTitle = '4D FITNESS GOALS';
const contentImg = '010619 4d fitness goals';
const contentDescription = 'Throughout the year, Y locations offer: Baseball/Softball/T-ball, Basketball, Cheerleading, Dodgeball, Flag Football, Floor Hockey, Lacrosse, Martial Arts, Running Club, Soccer, Special Olympics Young Athletes Program, Track & Field, Tumbling, Swim Team and Volleyball.';
const contentUrl = '/';
const contentUrlText = 'About';
it('Create landing page with ' + paragraphType + ' paragraph type in all areas', function () {
cy.visit('user/login', {
auth: {
username: Cypress.env('basic_auth_username'),
password: Cypress.env('basic_auth_passwd')
}
}).wait(2000);
cy.get('#edit-name').type(Cypress.env('drupal_auth_username'), {force: true})
.get('#edit-pass').type(Cypress.env('drupal_auth_passwd'), {force: true})
.get('#edit-submit').click({force: true}).wait(2000);
cy.visit('/node/add/landing_page', {
auth: {
username: Cypress.env('basic_auth_username'),
password: Cypress.env('basic_auth_passwd')
}
}).wait(2000);
cy.get('#edit-title-0-value').type('Style guide for '+ paragraphType + ' paragraph type in all areas', {force: true})
.get('#edit-field-lp-layout').select('One Column', {force: true});
cy.get('#edit-group-content-area > summary').click({force: true}).wait(2000)
.get('#edit-group-content-area > div > div > div > div > div > div > ul > li').contains('Add ' + paragraphType).click({force: true}).wait(2000)
.get('#edit-group-content-area').contains('Title').siblings('input').type(contentTitle, {force: true}).wait(2000)
.get('#edit-group-content-area').contains('Image').click({force: true}).wait(2000)
.get('#edit-group-content-area').contains('Select images').click({force: true}).wait(4000)
.get('#entity_browser_iframe_images_library').then(function ($iframe) {
let $body = $iframe
.contents().find('body');
cy.wrap($body).find('a').contains('All Images').click({force: true}).wait(4000)
.get('#entity_browser_iframe_images_library').then(function ($iframe) {
let $body = $iframe
.contents().find('body');
cy.wrap($body).find('#edit-name').type(contentImg, {force: true}).wait(2000)
.wrap($body).find('#edit-submit-images-library').click({force: true}).wait(2000)
.wrap($body).find('img').click({force: true}).wait(2000)
.wrap($body).find('#edit-submit').click({force: true}).wait(2000)
});
})
.get('#edit-group-content-area').contains('Text format').siblings('select').select('Code', {force: true}).wait(2000)
.get('#edit-group-content-area').contains('Description').siblings('div').children('textarea').type(contentDescription, {force: true}).wait(2000)
.get('#edit-group-content-area').contains('URL').siblings('input').type(contentUrl, {force: true}).wait(2000)
.get('#edit-group-content-area').contains('Link text').siblings('input').type(contentUrlText, {force: true}).wait(2000)
cy.get('#edit-moderation-state-0-state').select('Published', {force: true});
cy.get('#edit-submit').click({force: true}).wait(2000);
}); error
|
Is this a Feature or Bug?
Bug
Current behavior:
If an error is raised in the before hook for tests, Cypress will not stop the test run and seems to continue indefinitely.
This behaviour seems identical to #674
Desired behavior:
Tests should fail with a descriptive error message.
How to reproduce:
Run the below code
Test code:
Additional Info (images, stack traces, etc)
Below is a screenshot that shows that although the error is thrown, the spinner still continues to... spin :)
The text was updated successfully, but these errors were encountered: