Skip to content
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

Potentially wrongly labeled failing command #3

Closed
archfz opened this issue Feb 12, 2020 · 1 comment · Fixed by #4
Closed

Potentially wrongly labeled failing command #3

archfz opened this issue Feb 12, 2020 · 1 comment · Fixed by #4
Labels
bug Something isn't working

Comments

@archfz
Copy link
Owner

archfz commented Feb 12, 2020

Due to the async nature of the cypress testing flow commands can get executed after the actual failing command. We are presuming that the last registered command is the failing one so in these cases the wrong command will be labeled as the incorrect one. We should see if there is a better way to detect which commands failed.

This issue can potentially confuse people.

@archfz archfz added the bug Something isn't working label Feb 12, 2020
@zhex900
Copy link
Contributor

zhex900 commented Feb 12, 2020

How are about using options.state to check if the command or assert failed or passed

  Cypress.on('log:added', options => {
    if (options.instrument === 'command' && options.consoleProps) {
      if (options.name === 'log' || (options.name === 'task' && options.message.match(/terminalLogs/))) {
        return;
      }
      let detailMessage = '';
      if (options.name === 'xhr') {
        detailMessage = (options.consoleProps.Stubbed === 'Yes' ? 'STUBBED ' : '') + options.consoleProps.Method + ' ' + options.consoleProps.URL;
      }
      const log = options.name + '\t' + options.message + (detailMessage !== '' ? ' ' + detailMessage : '');
      // options have a property state. 
      logs.push(['cy:command', log, options.state])
    }
  });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants