Package allurium.aspects
Class UIElementAspects
java.lang.Object
allurium.aspects.UIElementAspects
This class provides Aspect-Oriented Programming (AOP) enhancements for the
UIElement class.
It integrates with the Allure framework to automatically log and report steps, statuses, and exceptions during
the execution of various UI-related operations.
The aspects intercept specific methods of the UIElement class
to wrap their execution with logging and exception handling for improved debugging and reporting.
Key Features:
- Intercepts UI interactions such as clicks, assertions, and visibility checks.
- Logs steps to Allure reports with meaningful step names and statuses.
- Handles and reports exceptions during method execution.
Example Usage:
// Example invocation in a test:
UIElement element = UIElement.$uiElement(By.id("example"));
element.click(); // Automatically logged by the associated aspect
- See Also:
-
UIElementAllure
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidstepAssertEmpty(org.aspectj.lang.ProceedingJoinPoint invocation) Intercepts theassertEmpty()method ofUIElement.voidstepAssertEquals(org.aspectj.lang.ProceedingJoinPoint invocation) Intercepts theassertEquals(Object)method ofUIElement.voidstepAssertExists(org.aspectj.lang.ProceedingJoinPoint invocation) Intercepts theassertExists()method ofUIElement.voidstepAssertHasCssClass(org.aspectj.lang.ProceedingJoinPoint invocation) Intercepts theassertHasCssClass(String)method ofUIElement.voidstepAssertHasCssClassDuringSeconds(org.aspectj.lang.ProceedingJoinPoint invocation) Intercepts theassertHasCssClass(String, int)method ofUIElement.voidstepAssertHasNotCssClass(org.aspectj.lang.ProceedingJoinPoint invocation) Intercepts theassertHasNotCssClass(String)method ofUIElement.voidstepAssertHasNotCssClassDuringSeconds(org.aspectj.lang.ProceedingJoinPoint invocation) Intercepts theassertHasNotCssClass(String, int)method ofUIElement.voidstepAssertHasText(org.aspectj.lang.ProceedingJoinPoint invocation) Intercepts theassertHasText(String)method ofUIElement.voidstepAssertHasTextWithinTime(org.aspectj.lang.ProceedingJoinPoint invocation) Intercepts theassertHasText(String, Integer)method ofUIElement.voidstepAssertNotEmpty(org.aspectj.lang.ProceedingJoinPoint invocation) Intercepts theassertIsNotEmpty()method ofUIElement.voidstepAssertNotExists(org.aspectj.lang.ProceedingJoinPoint invocation) Intercepts theassertNotExists()method ofUIElement.voidstepAssertNotVisible(org.aspectj.lang.ProceedingJoinPoint invocation) voidstepAssertText(org.aspectj.lang.ProceedingJoinPoint invocation) Intercepts theassertText(String)method ofUIElement.voidstepAssertVisible(org.aspectj.lang.ProceedingJoinPoint invocation) Intercepts theassertVisible()method ofUIElement.voidstepAssertVisibleWithDuration(org.aspectj.lang.ProceedingJoinPoint invocation) Intercepts theassertVisibleWithDuration(int)method ofUIElement.voidstepClick(org.aspectj.lang.ProceedingJoinPoint invocation) Intercepts theclick()method ofUIElement.voidstepClickAndHold(org.aspectj.lang.ProceedingJoinPoint invocation) voidstepContextClick(org.aspectj.lang.ProceedingJoinPoint invocation) Intercepts thecontextClick()method ofUIElement.voidstepDoubleClick(org.aspectj.lang.ProceedingJoinPoint invocation) voidstepHover(org.aspectj.lang.ProceedingJoinPoint invocation) Intercepts thehover()method ofUIElement.voidstepScrollTo(org.aspectj.lang.ProceedingJoinPoint invocation) Intercepts thescrollTo()method ofUIElement.voidstepSoftAssertHasText(org.aspectj.lang.ProceedingJoinPoint invocation) Intercepts thesoftAssertHasText(String)method ofUIElement.
-
Constructor Details
-
UIElementAspects
public UIElementAspects()
-
-
Method Details
-
stepClick
Intercepts theclick()method ofUIElement. Logs the click action as a step in Allure reports and updates the step status based on execution outcome.- Parameters:
invocation- the join point representing theclick()method- Throws:
Throwable- if an exception occurs during method execution
-
stepDoubleClick
- Parameters:
invocation- the join point representing theclick()method- Throws:
Throwable- if an exception occurs during method execution
-
stepClickAndHold
- Throws:
Throwable
-
stepContextClick
Intercepts thecontextClick()method ofUIElement. Logs the context click action as a step in Allure reports.- Parameters:
invocation- the join point representing thecontextClick()method- Throws:
Throwable- if an exception occurs during method execution
-
stepAssertText
Intercepts theassertText(String)method ofUIElement. Logs the assertion as a step in Allure reports, including the expected text.- Parameters:
invocation- the join point representing theassertText(String)method- Throws:
Throwable- if an exception occurs during method execution
-
stepAssertHasText
Intercepts theassertHasText(String)method ofUIElement. Logs the assertion step to Allure reports, including the expected text value.- Parameters:
invocation- the join point representing theassertHasText(String)method- Throws:
Throwable- if an exception occurs during method execution
-
stepAssertHasTextWithinTime
public void stepAssertHasTextWithinTime(org.aspectj.lang.ProceedingJoinPoint invocation) throws Throwable Intercepts theassertHasText(String, Integer)method ofUIElement. Logs the assertion step to Allure reports with the expected text value and duration.- Parameters:
invocation- the join point representing theassertHasText(String, Integer)method- Throws:
Throwable- if an exception occurs during method execution
-
stepSoftAssertHasText
Intercepts thesoftAssertHasText(String)method ofUIElement. Logs the assertion as a step in Allure reports. Handles soft assertion logic.- Parameters:
invocation- the join point representing thesoftAssertHasText(String)method- Throws:
Throwable- if an exception occurs during method execution
-
stepAssertEquals
Intercepts theassertEquals(Object)method ofUIElement. Logs the equality check as a step in Allure reports.- Parameters:
invocation- the join point representing theassertEquals(Object)method- Throws:
Throwable- if an exception occurs during method execution
-
stepAssertVisible
Intercepts theassertVisible()method ofUIElement. Logs the visibility check as a step in Allure reports.- Parameters:
invocation- the join point representing theassertVisible()method- Throws:
Throwable- if an exception occurs during method execution
-
stepAssertVisibleWithDuration
public void stepAssertVisibleWithDuration(org.aspectj.lang.ProceedingJoinPoint invocation) throws Throwable Intercepts theassertVisibleWithDuration(int)method ofUIElement. Logs the visibility check with duration as a step in Allure reports.- Parameters:
invocation- the join point representing theassertVisibleWithDuration(int)method- Throws:
Throwable- if an exception occurs during method execution
-
stepAssertNotVisible
- Throws:
Throwable
-
stepAssertExists
Intercepts theassertExists()method ofUIElement. Logs the existence check as a step in Allure reports.- Parameters:
invocation- the join point representing theassertExists()method- Throws:
Throwable- if an exception occurs during method execution
-
stepAssertNotExists
Intercepts theassertNotExists()method ofUIElement. Logs the non-existence check as a step in Allure reports.- Parameters:
invocation- the join point representing theassertNotExists()method- Throws:
Throwable- if an exception occurs during method execution
-
stepHover
Intercepts thehover()method ofUIElement. Logs the hover action as a step in Allure reports.- Parameters:
invocation- the join point representing thehover()method- Throws:
Throwable- if an exception occurs during method execution
-
stepAssertHasCssClass
Intercepts theassertHasCssClass(String)method ofUIElement. Logs the assertion for the presence of a CSS class as a step in Allure reports.- Parameters:
invocation- the join point representing theassertHasCssClass(String)method- Throws:
Throwable- if an exception occurs during method execution
-
stepAssertHasNotCssClass
public void stepAssertHasNotCssClass(org.aspectj.lang.ProceedingJoinPoint invocation) throws Throwable Intercepts theassertHasNotCssClass(String)method ofUIElement. Logs the assertion for the absence of a CSS class as a step in Allure reports.- Parameters:
invocation- the join point representing theassertHasNotCssClass(String)method- Throws:
Throwable- if an exception occurs during method execution
-
stepAssertHasCssClassDuringSeconds
public void stepAssertHasCssClassDuringSeconds(org.aspectj.lang.ProceedingJoinPoint invocation) throws Throwable Intercepts theassertHasCssClass(String, int)method ofUIElement. Logs the assertion for the presence of a CSS class within a duration as a step in Allure reports.- Parameters:
invocation- the join point representing theassertHasCssClass(String, int)method- Throws:
Throwable- if an exception occurs during method execution
-
stepAssertHasNotCssClassDuringSeconds
public void stepAssertHasNotCssClassDuringSeconds(org.aspectj.lang.ProceedingJoinPoint invocation) throws Throwable Intercepts theassertHasNotCssClass(String, int)method ofUIElement. Logs the assertion for the absence of a CSS class within a duration as a step in Allure reports.- Parameters:
invocation- the join point representing theassertHasNotCssClass(String, int)method- Throws:
Throwable- if an exception occurs during method execution
-
stepAssertEmpty
Intercepts theassertEmpty()method ofUIElement. Logs the assertion as a step in Allure reports.- Parameters:
invocation- the join point representing theassertEmpty()method- Throws:
Throwable- if an exception occurs during method execution
-
stepAssertNotEmpty
Intercepts theassertIsNotEmpty()method ofUIElement. Logs the assertion for a non-empty element as a step in Allure reports.- Parameters:
invocation- the join point representing theassertIsNotEmpty()method- Throws:
Throwable- if an exception occurs during method execution
-
stepScrollTo
Intercepts thescrollTo()method ofUIElement. Logs the scroll action as a step in Allure reports.- Parameters:
invocation- the join point representing thescrollTo()method- Throws:
Throwable- if an exception occurs during method execution
-