Package net.serenitybdd.core
Class Serenity
java.lang.Object
net.serenitybdd.core.Serenity
A utility class that provides services to initialize web testing and reporting-related fields in arbitrary objects.
It is designed to help integrate Serenity into other testing tools such as Cucumber.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic voidstatic booleanstatic voiddone()Indicate that the test run using this object is finished, and reports can be generated.static voiddone(boolean closeAllDrivers) static SessionMap<Object,Object> static Stringstatic Stringstatic org.openqa.selenium.WebDriverstatic org.openqa.selenium.firefox.FirefoxProfileprotected static PagesgetPages()static Pagesstatic StepFactorystatic StepListenerstatic WebdriverManagerstatic booleanstatic voidignoredStep(String reason) static voidinitialize(Object testCase) Initialize Serenity-related fields in the specified object.static voidstatic Serenity.SerenityConfigurerinitializeWithNoStepListener(Object testCase) Initialize Serenity-related fields in the specified object.static voidstatic voidinjectAnnotatedPagesObjectInto(Object testCase) Instantiates the @ManagedPages-annotated Pages instance using current WebDriver.static voidinjectDependenciesInto(Object testCase) static voidinjectDriverInto(Object testCase) Instantiate the @Managed-annotated WebDriver instance with current WebDriver.static voidinjectScenarioStepsInto(Object testCase) Instantiates the @ManagedPages-annotated Pages instance using current WebDriver.static voidpendingStep(String reason) static WithTitlestatic voidreportThat(String message, Reportable reportableAction) Perform an arbitrary task and record it as a step in the reports.static <T> TsetSessionVariable(Object key) static booleanprotected static voidstatic voidstatic voidstatic voiduseFirefoxProfile(org.openqa.selenium.firefox.FirefoxProfile profile) static WebDriverConfigurer
-
Constructor Details
-
Serenity
public Serenity()
-
-
Method Details
-
initialize
Initialize Serenity-related fields in the specified object. This includes managed WebDriver instances,- Parameters:
testCase- any object (testcase or other) containing injectable Serenity components
-
injectDependenciesInto
-
initializeWithNoStepListener
Initialize Serenity-related fields in the specified object. This includes managed WebDriver instances,- Parameters:
testCase- any object (testcase or other) containing injectable Serenity components
-
initStepListener
public static void initStepListener() -
injectDriverInto
Instantiate the @Managed-annotated WebDriver instance with current WebDriver.- Parameters:
testCase- any object (testcase or other) containing injectable Serenity components
-
injectScenarioStepsInto
Instantiates the @ManagedPages-annotated Pages instance using current WebDriver.- Parameters:
testCase- any object (testcase or other) containing injectable Serenity components
-
injectAnnotatedPagesObjectInto
Instantiates the @ManagedPages-annotated Pages instance using current WebDriver.- Parameters:
testCase- any object (testcase or other) containing injectable Serenity components
-
done
public static void done()Indicate that the test run using this object is finished, and reports can be generated. -
currentDriverIsDisabled
public static boolean currentDriverIsDisabled() -
done
public static void done(boolean closeAllDrivers) -
getCurrentSessionID
-
getDriver
public static org.openqa.selenium.WebDriver getDriver() -
getPages
-
stopUsingMockDriver
protected static void stopUsingMockDriver() -
getWebdriverManager
-
getStepFactory
-
getStepListener
-
initializeTestSession
public static void initializeTestSession() -
getCurrentSession
-
pendingStep
-
ignoredStep
-
takeScreenshot
public static void takeScreenshot() -
recordReportData
-
getDefaultProjectKey
- Returns:
- The current working directory name is used as a default project key if no other key is provided.
-
useFirefoxProfile
public static void useFirefoxProfile(org.openqa.selenium.firefox.FirefoxProfile profile) -
getFirefoxProfile
public static org.openqa.selenium.firefox.FirefoxProfile getFirefoxProfile() -
hasASessionVariableCalled
-
sessionVariableCalled
-
setSessionVariable
-
clearSessionVariable
-
clearCurrentSession
public static void clearCurrentSession() -
getPagesFactory
-
throwExceptionsImmediately
public static void throwExceptionsImmediately() -
shouldThrowErrorsImmediately
public static boolean shouldThrowErrorsImmediately() -
webdriver
-
reportThat
Perform an arbitrary task and record it as a step in the reports. Any exceptions that occur will be reported and thrown- Parameters:
message-reportableAction-
-