All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.serenitybdd.cucumber.events.SetTestManualEvent Maven / Gradle / Ivy

There is a newer version: 4.2.8
Show newest version
package net.serenitybdd.cucumber.events;


import io.cucumber.core.plugin.ScenarioContextParallel;
import io.cucumber.core.plugin.TaggedScenario;
import io.cucumber.core.plugin.UpdateManualScenario;
import io.cucumber.messages.types.Tag;
import net.serenitybdd.core.di.SerenityInfrastructure;
import net.thucydides.core.steps.events.StepEventBusEventBase;
import net.thucydides.model.webdriver.Configuration;

import java.util.List;

public class SetTestManualEvent extends StepEventBusEventBase {

	private final List scenarioTags;
	private final String scenarioId;
	private final ScenarioContextParallel scenarioContext;

	public SetTestManualEvent(ScenarioContextParallel scenarioContext, List scenarioTags, String scenarioId) {
		this.scenarioTags = scenarioTags;
		this.scenarioId = scenarioId;
		this.scenarioContext = scenarioContext;
	}
	@Override
	public void play() {
		Configuration systemConfiguration = SerenityInfrastructure.getConfiguration();
		getStepEventBus().testIsManual();
		TaggedScenario.manualResultDefinedIn(scenarioTags).ifPresent(
                testResult ->
                        UpdateManualScenario.forScenario(scenarioContext.getCurrentScenarioDefinition(scenarioId).getDescription())
                                .inContext(getStepEventBus().getBaseStepListener(), systemConfiguration.getEnvironmentVariables())
                                .updateManualScenario(testResult, scenarioTags)
        );
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy