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

[Question] Is it possible to restart a test, when some step fails? #310

Open
DiegoVega19 opened this issue Jun 25, 2024 · 0 comments
Open

Comments

@DiegoVega19
Copy link

I have an application developed on Android, which I am running a few tests using the package, everything works correctly.

The problem is, when I am running all the tests, and one fails, it stays on the screen where the test failed, and it does not restart for the next test.

Is it possible to implement something similar or an option that allows doing something similar? I tried using hooks but it didn't work

Hooks code:

class ResetAppBetweenScenariosHook extends Hook {
 late FlutterRunProcessHandler? _flutterRunProcessHandler;

  @override
  Future<void> onAfterStep(World world, String step, StepResult stepResult) async {
    if (stepResult.result == StepExecutionResult.fail ||
        stepResult.result == StepExecutionResult.error ||
        stepResult.result == StepExecutionResult.timeout) {
          stdout.writeln('Restarting Flutter app');
          final myAppWorld = world as FlutterWorld;
          await myAppWorld.restartApp();
        }
    return super.onAfterStep(world, step, stepResult);
  }
  
 
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant