private boolean currentStepHasMoreThanOneScreenshot() { return getCurrentStep().getScreenshotCount() > 1; }
public void currentStepIsAPrecondition() { getCurrentStep().setPrecondition(true); }
private void addToFluentStepName(String stepName) { String updatedStepName = getCurrentStep().getDescription() + " " + StringUtils.uncapitalize(stepName); getCurrentStep().setDescription(updatedStepName); }
private boolean shouldTakeScreenshot(ScreenshotType screenshotType, ScreenshotAndHtmlSource screenshotAndHtmlSource) { return (screenshotType == MANDATORY_SCREENSHOT) || getCurrentStep().getScreenshots().isEmpty() || shouldTakeOptionalScreenshot(screenshotAndHtmlSource); }
private boolean shouldTakeScreenshot(ScreenshotType screenshotType, ScreenshotAndHtmlSource screenshotAndHtmlSource) { return (screenshotType == MANDATORY_SCREENSHOT) || getCurrentStep().getScreenshots().isEmpty() || shouldTakeOptionalScreenshot(screenshotAndHtmlSource); }
private void startNewGroup() { getCurrentTestOutcome().startGroup(); currentGroupStack.push(getCurrentStep()); }
private void startNewGroupIfNested() { if (thereAreUnfinishedSteps()) { if (getCurrentStep() != getCurrentGroup()) { startNewGroup(); } } }
private void startNewGroupIfNested() { if (thereAreUnfinishedSteps()) { if (getCurrentStep() != getCurrentGroup()) { startNewGroup(); } } }
private void takeScreenshotIfRequired(ScreenshotType screenshotType, ScreenshotAndHtmlSource screenshotAndHtmlSource) { if (shouldTakeScreenshot(screenshotType, screenshotAndHtmlSource) && screenshotWasTaken(screenshotAndHtmlSource)) { getCurrentStep().addScreenshot(screenshotAndHtmlSource); } }
private void takeScreenshotIfRequired(ScreenshotType screenshotType, ScreenshotAndHtmlSource screenshotAndHtmlSource) { if (shouldTakeScreenshot(screenshotType, screenshotAndHtmlSource) && screenshotWasTaken(screenshotAndHtmlSource)) { getCurrentStep().addScreenshot(screenshotAndHtmlSource); } }
public void updateCurrentStepTitle(String updatedStepTitle) { if (currentStepExists()) { getCurrentStep().setDescription(updatedStepTitle); } else { stepStarted(ExecutedStepDescription.withTitle(updatedStepTitle)); } }
private void removeDuplicatedInitalScreenshotsIfPresent() { if (currentStepHasMoreThanOneScreenshot() && getPreviousStep().isPresent() && getPreviousStep().get().hasScreenshots()) { ScreenshotAndHtmlSource lastScreenshotOfPreviousStep = lastScreenshotOf(getPreviousStep().get()); ScreenshotAndHtmlSource firstScreenshotOfThisStep = getCurrentStep().getFirstScreenshot(); if (firstScreenshotOfThisStep.hasIdenticalScreenshotsAs(lastScreenshotOfPreviousStep)) { removeFirstScreenshotOfCurrentStep(); } } }
private void removeDuplicatedInitalScreenshotsIfPresent() { if (currentStepHasMoreThanOneScreenshot() && getPreviousStep().isPresent() && getPreviousStep().get().hasScreenshots()) { ScreenshotAndHtmlSource lastScreenshotOfPreviousStep = lastScreenshotOf(getPreviousStep().get()); ScreenshotAndHtmlSource firstScreenshotOfThisStep = getCurrentStep().getFirstScreenshot(); if (firstScreenshotOfThisStep.hasIdenticalScreenshotsAs(lastScreenshotOfPreviousStep)) { removeFirstScreenshotOfCurrentStep(); } } }
private void removeDuplicatedInitalScreenshotsIfPresent() { if (currentStepHasMoreThanOneScreenshot() && getPreviousStep().isPresent() && getPreviousStep().get().hasScreenshots()) { ScreenshotAndHtmlSource lastScreenshotOfPreviousStep = lastScreenshotOf(getPreviousStep().get()); ScreenshotAndHtmlSource firstScreenshotOfThisStep = getCurrentStep().getFirstScreenshot(); if (firstScreenshotOfThisStep.hasIdenticalScreenshotsAs(lastScreenshotOfPreviousStep)) { removeFirstScreenshotOfCurrentStep(); } } }
private void recordFailureDetailsInFailingTestStep(final StepFailure failure) { if (currentStepExists()) { getCurrentStep().failedWith(new StepFailureException(failure.getMessage(), failure.getException())); } }
public StepMutator updateCurrentStepTitle(String updatedStepTitle) { if (currentStepExists()) { getCurrentStep().setDescription(updatedStepTitle); } else { stepStarted(ExecutedStepDescription.withTitle(updatedStepTitle)); } return new StepMutator(this); }
public void assumptionViolated(String message) { if (thereAreUnfinishedSteps()) { getCurrentStep().testAborted(new PendingStepException(message)); stepIgnored(); } testIgnored(); }
private void recordFailureDetailsInFailingTestStep(final StepFailure failure) { if (currentStepExists()) { getCurrentStep().failedWith(new StepFailureException(failure.getMessage(), failure.getException())); } }
public void assumptionViolated(String message) { if (thereAreUnfinishedSteps()) { getCurrentStep().testAborted(new PendingStepException(message)); stepIgnored(); } testIgnored(); }
private void recordFailureDetails(final StepFailure failure) { if (currentStepExists()) { getCurrentStep().failedWith(new StepFailureException(failure.getMessage(), failure.getException())); } if (shouldTagErrors()) { addTagFor(getCurrentTestOutcome()); } lastFailingExample = currentExample; }