use of ru.sbtqa.tag.pagefactory.optional.PickleStepTag in project page-factory-2 by sbtqa.
the class DataReplacer method replacePickleArguments.
private void replacePickleArguments(PickleStepTestStep currentStep, boolean isStash) throws IllegalAccessException {
PickleStepTag pickleStepTag = (PickleStepTag) currentStep.getPickleStep();
for (gherkin.pickles.Argument argument : currentStep.getPickleStep().getArgument()) {
if (argument.getClass().equals(PickleTable.class)) {
replacePickleTable(pickleStepTag, (PickleTable) argument, isStash);
} else if (argument.getClass().equals(PickleString.class)) {
String content = replaceData(pickleStepTag, ((PickleString) argument).getContent(), isStash);
FieldUtils.writeField(argument, "content", content, true);
}
}
Object definitionMatchArguments = FieldUtils.readField(FieldUtils.readField(currentStep, "definitionMatch", true), "arguments", true);
if (definitionMatchArguments instanceof ArrayList) {
for (Object definitionMatchArgument : (ArrayList) definitionMatchArguments) {
if (definitionMatchArgument instanceof DataTableArgument) {
List<List<String>> newDefinitionMatchArgument = replaceDataTable(definitionMatchArgument, currentStep, isStash);
FieldUtils.writeField(definitionMatchArgument, "argument", newDefinitionMatchArgument, true);
} else if (definitionMatchArgument instanceof DocStringArgument) {
String newDefinitionMatchArgument = replaceData((PickleStepTag) currentStep.getPickleStep(), ((DocStringArgument) definitionMatchArgument).getValue().toString(), isStash);
FieldUtils.writeField(definitionMatchArgument, "argument", newDefinitionMatchArgument, true);
}
}
}
}
use of ru.sbtqa.tag.pagefactory.optional.PickleStepTag in project page-factory-2 by sbtqa.
the class CriticalStepAspect method removeNonCriticalSign.
@Around(value = "removeNonCriticalSign(featurePath, step)")
public Object removeNonCriticalSign(ProceedingJoinPoint joinPoint, String featurePath, PickleStep step) throws Throwable {
PickleStepTag pickleStepTag = step instanceof PickleStepTag ? (PickleStepTag) step : new PickleStepTag(step);
pickleStepTag.removeNonCriticalSign();
return joinPoint.proceed(new Object[] { featurePath, pickleStepTag });
}
use of ru.sbtqa.tag.pagefactory.optional.PickleStepTag in project page-factory-2 by sbtqa.
the class DataAspect method run.
@Around("run(testCase,bus,scenario,skipSteps)")
public Object run(ProceedingJoinPoint joinPoint, TestCase testCase, EventBus bus, cucumber.api.Scenario scenario, boolean skipSteps) throws Throwable {
TestStep testStep = (TestStep) joinPoint.getThis();
if (!(testStep instanceof HookTestStep)) {
PickleStepTestStep pickleStepTestStep = (PickleStepTestStep) testStep;
PickleStepTag stepCustom = getPickleStepTag(pickleStepTestStep);
stepCustom.setSkipped(skipSteps);
replaceByPickleStepTag(pickleStepTestStep, stepCustom);
}
return joinPoint.proceed();
}
use of ru.sbtqa.tag.pagefactory.optional.PickleStepTag in project page-factory-2 by sbtqa.
the class DataAspect method run.
@Around("sendCaseStart(event)")
public Object run(ProceedingJoinPoint joinPoint, TestCaseStarted event) throws Throwable {
List<PickleTag> tags = event.testCase.getTags().stream().filter(pickleTag -> pickleTag.getName().startsWith(DataUtils.DATA_TAG)).collect(Collectors.toList());
if (!tags.isEmpty()) {
String dataTagName = tags.get(tags.size() - 1).getName();
String data = DataUtils.getDataTagValue(dataTagName);
for (TestStep testStep : event.testCase.getTestSteps()) {
if (!(testStep instanceof HookTestStep)) {
PickleStepTestStep pickleStepTestStep = (PickleStepTestStep) testStep;
PickleStepTag stepCustom = getPickleStepTag(pickleStepTestStep);
stepCustom.setDataTag(data);
replaceByPickleStepTag(pickleStepTestStep, stepCustom);
}
}
}
return joinPoint.proceed();
}
use of ru.sbtqa.tag.pagefactory.optional.PickleStepTag in project page-factory-2 by sbtqa.
the class PrintSteps method sendStepStarted.
@Around("sendStepStarted(event)")
public void sendStepStarted(ProceedingJoinPoint joinPoint, Event event) throws Throwable {
PickleStepTestStep testStep = (PickleStepTestStep) ((TestStepStarted) event).testStep;
String stepText = testStep.getStepText();
if (!previous.equals(stepText) && testStep.getPickleStep() instanceof PickleStepTag && !((PickleStepTag) testStep.getPickleStep()).isSkipped()) {
System.out.println(" * " + stepText);
previous = stepText;
}
joinPoint.proceed();
}
Aggregations