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

Can we take screenshot wherever we wanted.?despite of fail scenario #300

Open
lravihs opened this issue Jul 27, 2023 · 3 comments
Open

Can we take screenshot wherever we wanted.?despite of fail scenario #300

lravihs opened this issue Jul 27, 2023 · 3 comments

Comments

@lravihs
Copy link

lravihs commented Jul 27, 2023

No description provided.

@linchen2chris
Copy link

you can call context.world.appDriver.screenshot() in your step to take screenshot

@lravihs
Copy link
Author

lravihs commented Aug 22, 2023

@linchen2chris can you provide me the sample code because I am not able to import world.

@linchen2chris
Copy link

import 'package:flutter_gherkin/flutter_gherkin.dart';
import 'package:gherkin/gherkin.dart';

/// take a screenshot
///
/// Examples:
///
///   `When the screenshot "xxx" is taken
///   xxx.png will be taken in screenshot folder
///
final takeScreenshotStep = when1<String, FlutterWidgetTesterWorld>(
  RegExp(r'(?:a|an|the|) screenshot {string} is taken$'),
  (screenshotName, context) async {
    print("going to step: takeScreenshotStep");
    await context.world.appDriver.waitForAppToSettle();
    var data = await context.world.appDriver
        .screenshot(screenshotName: screenshotName);

    await context.world.appDriver.waitForAppToSettle();
  },
  configuration: StepDefinitionConfiguration()
    ..timeout = const Duration(seconds: 30),
);

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

2 participants