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

Retry And TryTo step decorators fail Steps #5666

Closed
Mitrichius opened this issue Aug 26, 2019 · 1 comment · Fixed by #5667

Comments

@Mitrichius
Copy link
Contributor

commented Aug 26, 2019

What are you trying to achieve?

I want to check failed step in my custom extension with $stepEvent->getStep()->hasFailed() method.

What do you get instead?

I've got a wrong failed step (it's always before the real one). The reason is step decorators: Retry and TryTo.
Retry should be failed only if all attempts left. TryTo shouldn't fails at all.

Provide console output if related. Use -vvv mode for more details.

I assert equals "tryTo","dontTryDoIt","TryTo fail"
  Failed to perform: TryTo fail
  Failed asserting that two strings are equal., skipping...
  Step: assert equals "tryTo","dontTryDoIt","TryTo fail"
  Is Failed: 1
I assert false true,"The real one problem"
  Step: assert false true,"The real one problem"
  Is Failed: 1

 Test  tests/acceptance/TempCest:checkTryTo
 Step  Assert equals "tryTo","dontTryDoIt","TryTo fail"
 Fail  The real one problem

Provide test source code if related

Extension:

<?php

use \Codeception\Events;

class FailInfoExtension extends \Codeception\Extension 
{
	public static $events = [
		Events::STEP_AFTER => 'stepAfter',
	];

	public function stepAfter(\Codeception\Event\StepEvent $e) {
		codecept_debug('Step: ' . $e->getStep());
		codecept_debug('Is Failed: ' . $e->getStep()->hasFailed());
	}
}

Test:

class TempCest 
{
	public function checkTryTo(AcceptanceTester $I) {
		$I->amOnPage('/');
		$I->tryToAssertEquals('tryTo', 'dontTryDoIt', 'TryTo fail');
		$I->assertFalse(true, 'The real one problem');
	}
}

Details

  • Codeception version: 3.1.0
  • PHP Version: 7.3.7
  • Installation type: Composer
  • Suite configuration:
step_decorators:
  - \Codeception\Step\Retry
  - \Codeception\Step\TryTo
@Mitrichius Mitrichius changed the title Retry And TryTo step decorators fail steps Retry And TryTo step decorators fail Steps Aug 28, 2019
@reinholdfuereder

This comment has been minimized.

Copy link
Contributor

commented Sep 6, 2019

I may have stumbled over this problem/bug as well, but I am not certain:

  • Codeception exit code and (HTML) report are OK (not showing any error), but in the WebDriver's Recorder extension report (when not deleting succesful tests) such tests are shown as error AND in all "slides" of the recordings of this test after the first tryTo* step the step info background colour is red (instead of black)

In acceptance webdriver suite.yml:

...
    - Codeception\Extension\Recorder:
        delete_successful: false
...
step_decorators:
  - \Codeception\Step\Retry
  - \Codeception\Step\TryTo

grafik

grafik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.