private boolean isSoftAssert() { return StepEventBus.getEventBus().softAssertsActive(); }
public boolean webdriverCallsAreSuspended() { if (softAssertsActive()) { return !webdriverSuspensions.isEmpty(); } return currentTestIsSuspended() || aStepInTheCurrentTestHasFailed() || !webdriverSuspensions.isEmpty(); }
@Override public void evaluateFor(Actor actor) { if (thisStepShouldBeIgnored() && !StepEventBus.getEventBus().softAssertsActive()) { return; } Broadcaster.getEventBus().post(new ActorAsksQuestion(question, actor.getName())); try { optionalPrecondition.orElse(DO_NOTHING).performAs(actor); assertThat(reason(), question.answeredBy(actor), is(true)); } catch (Throwable actualError) { throwComplaintTypeErrorIfSpecified(errorFrom(actualError)); throwDiagosticErrorIfProvided(errorFrom(actualError)); throw actualError; } }
@Override public void evaluateFor(Actor actor) { if (thisStepShouldBeIgnored() && !StepEventBus.getEventBus().softAssertsActive()) { return; } Broadcaster.getEventBus().post(new ActorAsksQuestion(question, actor.getName())); Serenity.injectScenarioStepsInto(question); try { optionalPrecondition.orElse(DO_NOTHING).performAs(actor); assertTrue("predicate failed", expected.test(question.answeredBy(actor))); } catch (Throwable actualError) { throwComplaintTypeErrorIfSpecified(errorFrom(actualError)); throwDiagosticErrorIfProvided(errorFrom(actualError)); throw actualError; } }
@Override public void evaluateFor(Actor actor) { if (thisStepShouldBeIgnored() && !StepEventBus.getEventBus().softAssertsActive()) { return; } Broadcaster.getEventBus().post(new ActorAsksQuestion(question, actor.getName())); Serenity.injectScenarioStepsInto(question); try { optionalPrecondition.orElse(DO_NOTHING).performAs(actor); addHints(fromAssertion(expected)).to(question); assertThat(question.answeredBy(actor), expected); } catch (Throwable actualError) { throwComplaintTypeErrorIfSpecified(errorFrom(actualError)); throwDiagosticErrorIfProvided(errorFrom(actualError)); throw actualError; } }
private boolean shouldTakeScreenshots() { if (StepEventBus.getEventBus().aStepInTheCurrentTestHasFailed() && !StepEventBus.getEventBus().softAssertsActive()) { return false; } return (currentStepExists() && browserIsOpen() && !StepEventBus.getEventBus().isDryRun() && !StepEventBus.getEventBus().currentTestIsSuspended()); }
public boolean shouldIgnoreConsequences() { if (StepEventBus.getEventBus().isDryRun()) { return true; } if (StepEventBus.getEventBus().softAssertsActive() && !StepEventBus.getEventBus().currentTestIsSuspended() ) { return false; } return (StepEventBus.getEventBus().currentTestIsSuspended() || StepEventBus.getEventBus().aStepInTheCurrentTestHasFailed()); }