serenity-bdd / serenity-cucumber-starter

A skeleton project for Serenity BDD and Cucumber JVM
Apache License 2.0
179 stars 286 forks source link

serenity.take.screenshots property is being ignored during the tests execution #148

Open Jordanlosa97 opened 3 months ago

Jordanlosa97 commented 3 months ago

It seems the screenshot process is taking the default procedure (FOR_EACH_ACTION) The optionalScreenshotPreference object is not being created as the function

 private Optional<TakeScreenshots> classOverride() {
        if (StepEventBus.getParallelEventBus().isBaseStepListenerRegistered()) {
            Optional<Method> currentStepMethod = StepEventBus.getParallelEventBus().getBaseStepListener().getCurrentStepMethod();
            if (currentStepMethod != null && currentStepMethod.isPresent()) {
                return overriddenScreenshotPreferenceForClass(currentStepMethod.get().getDeclaringClass());
            }
        }
        return Optional.empty();
    }

is returning always Optional.empty();

image

That makes unnecessary screenshots are being saved

image