VOOZH about

URL: https://deepwiki.com/Accenture/Ocaramba/2.4-helpers:-waits-files-performance-screenshots

⇱ Helpers: Waits, Files, Performance, Screenshots | Accenture/Ocaramba | DeepWiki


Loading...
Last indexed: 6 June 2026 (fb3580)
Menu

Helpers: Waits, Files, Performance, Screenshots

The Ocaramba framework provides a suite of helper classes located in OcarambaLite/Helpers to simplify common test automation tasks such as synchronizing with asynchronous UI states, managing file system operations, measuring application performance, and capturing diagnostic artifacts like screenshots. These utilities are designed to be used both internally by the framework and externally within Page Objects and test suites.

WaitHelper: Condition-Based Polling

WaitHelper provides a robust mechanism for polling a condition until it returns true or a timeout is reached. Unlike standard Selenium waits which are often tied to IWebElement states, WaitHelper can evaluate any Func<bool> delegate, making it suitable for checking database states, file existence, or complex UI logic OcarambaLite/Helpers/WaitHelper.cs35-47

Key Implementation Details

The core logic uses Task.Run to execute the condition check and the timeout check in parallel OcarambaLite/Helpers/WaitHelper.cs87-98 It uses an asynchronous loop with Task.Delay to avoid blocking threads unnecessarily while polling OcarambaLite/Helpers/WaitHelper.cs89-93

MethodDescription
Wait(Func<bool> condition, TimeSpan timeout, string message)Waits for a condition with a default 1-second sleep interval. Throws WaitTimeoutException on failure OcarambaLite/Helpers/WaitHelper.cs47-50
Wait(Func<bool> condition, TimeSpan timeout, TimeSpan sleepInterval, string message)Allows specifying a custom polling interval. Throws WaitTimeoutException on failure OcarambaLite/Helpers/WaitHelper.cs63-71
Wait(Func<bool> condition, TimeSpan timeout, TimeSpan sleepInterval)Returns a bool indicating success or failure without throwing an exception OcarambaLite/Helpers/WaitHelper.cs85-120

Sources: OcarambaLite/Helpers/WaitHelper.cs35-121

FilesHelper: Download Detection and Filtering

FilesHelper manages file system interactions, specifically focusing on validating downloaded files and filtering files by type using the FileType enum OcarambaLite/Helpers/FilesHelper.cs37-38

File Type Mapping

The helper maps FileType enum values to string extensions via ReturnFileExtension OcarambaLite/Helpers/FilesHelper.cs55-92 Supported types include .pdf, .xls, .csv, .txt, .docx, .png, .xml, and .html.

Key Functions

Sources: OcarambaLite/Helpers/FilesHelper.cs37-200 Ocaramba.UnitTests/Tests/FilesHelperTests.cs18-80

Performance and Results Helpers

Ocaramba includes a performance monitoring subsystem based on System.Diagnostics.Stopwatch. This is primarily used to measure "Load Times" for specific user scenarios OcarambaLite/Helpers/PerformanceHelper.cs36-37

PerformanceHelper Implementation

This class maintains a loadTimeList of SavedTimes objects OcarambaLite/Helpers/PerformanceHelper.cs48-55

PrintPerformanceResultsHelper

This helper formats performance data into service messages for CI/CD platforms OcarambaLite/Helpers/PrintPerformanceResultsHelper.cs36-37

Performance Data Flow

The following diagram illustrates how performance data moves from the measurement phase to CI reporting.

Performance Data Flow: Measurement to CI


Sources: OcarambaLite/Helpers/PerformanceHelper.cs36-121 OcarambaLite/Helpers/PrintPerformanceResultsHelper.cs36-148

TakeScreenShot: Element-Level Capture

While the standard framework captures full-page screenshots on failure, the TakeScreenShot helper provides specialized support for capturing specific IWebElement instances.

TakeScreenShot Implementation

The class TakeScreenShot provides the TakeScreenShotOfElement method OcarambaLite/Helpers/TakeScreenShot.cs33-50

Sources: OcarambaLite/Helpers/TakeScreenShot.cs33-60 Ocaramba.Tests.PageObjects/PageObjects/TheInternet/IFramePage.cs49-71

NameHelper and DateHelper

NameHelper Utilities

NameHelper provides string manipulation specifically for test data and file management:

DateHelper Utilities

DateHelper provides formatted date strings commonly used in test data generation OcarambaLite/Helpers/DateHelper.cs25-30:

Sources: OcarambaLite/Helpers/NameHelper.cs34-109 OcarambaLite/Helpers/DateHelper.cs25-55 Ocaramba.UnitTests/Tests/NameHelperTests.cs22-38

Relationship between Helpers and WebElements

Helpers are often consumed by high-level WebElement wrappers to provide stable interactions. For example, the Select element uses BaseConfiguration timeouts and internal polling to ensure a dropdown is populated before attempting a selection OcarambaLite/WebElements/Select.cs84

Code Entity Mapping: Helper Usage in WebElements


Sources: OcarambaLite/WebElements/Select.cs74-84 OcarambaLite/WebElements/Table.cs34-87 Ocaramba.Tests.PageObjects/PageObjects/TheInternet/IFramePage.cs63-70 OcarambaLite/Helpers/DateHelper.cs25-30