Class BrowserStackSdkHelper

java.lang.Object
com.shaft.driver.internal.DriverFactory.BrowserStackSdkHelper

public class BrowserStackSdkHelper extends Object
Utility class for generating a browserstack.yml configuration file from SHAFT's BrowserStack property system. This enables integration with the BrowserStack SDK, which reads the YAML file at runtime to configure test execution on BrowserStack's cloud platform.

The generated file maps SHAFT's browserStack.* properties to the SDK's expected YAML format, supporting desktop web, mobile web, and native mobile app scenarios.

Usage: Call generateBrowserStackYml() before driver creation to produce a browserstack.yml file in the project root directory. When the BrowserStack SDK Java agent is active, it reads this file and intercepts WebDriver creation accordingly.

See Also:
  • Method Details

    • generateBrowserStackYml

      public static String generateBrowserStackYml()
      Generates a browserstack.yml configuration file in the project root directory by mapping SHAFT's BrowserStack properties to the SDK's expected YAML format.

      If the browserStack.customBrowserStackYmlPath property is set to a non-empty value, the specified file is copied to the project root as browserstack.yml and SHAFT's property-to-YAML mapping is skipped entirely. This allows users to provide their own SDK configuration file and override SHAFT's properties.

      The generated file includes authentication credentials, platform configuration, build/project naming, and optional settings like local testing, debugging, and geo-location.

      Returns:
      the absolute path to the browserstack.yml file (generated or copied)
      Throws:
      IllegalStateException - if the file cannot be written or the custom file is not found