How to use build method of com.github.epadronu.balin.config.ConfigurationBuilder class

Best Balin code snippet using com.github.epadronu.balin.config.ConfigurationBuilder.build

Browser.kt

Source:Browser.kt Github

copy

Full Screen

...40 */41interface Browser : JavaScriptSupport, WaitingSupport, WebDriver {42 companion object {43 /**44 * The builder in charge of generating the configuration.45 */46 private val configurationBuilder: ConfigurationBuilder by ThreadLocalDelegate {47 ConfigurationBuilder()48 }49 /**50 * The name of the property that dictates which setup to use.51 */52 internal const val BALIN_SETUP_NAME_PROPERTY: String = "balin.setup.name"53 /**54 * Retrieves the configuration generated by the builder, taking in55 * account the value of the [BALIN_SETUP_NAME_PROPERTY] property.56 */57 internal val desiredConfiguration: ConfigurationSetup58 get() = configurationBuilder.build().run {59 setups[System.getProperty(BALIN_SETUP_NAME_PROPERTY) ?: "default"] ?: this60 }61 /**62 * Domain-Specific language that let's you configure Balin's global63 * behavior.64 *65 * @sample com.github.epadronu.balin.config.ConfigurationTests.call_the_configure_method_and_make_changes66 *67 * @param block here you can interact with the DSL.68 */69 fun configure(block: ConfigurationBuilder.() -> Unit) {70 block(configurationBuilder)71 }72 /**...

Full Screen

Full Screen

ConfigurationTests.kt

Source:ConfigurationTests.kt Github

copy

Full Screen

...132 autoQuit = defaultConfigurationSetup.autoQuit133 driverFactory = defaultConfigurationSetup.driverFactory134 }135 )136 }.build()137 Browser.drive(desiredConfigurationSetup) {138 Assert.assertEquals(configurationSetup, defaultConfigurationSetup)139 }140 }141 @Test(dataProvider = "JavaScript-incapable WebDriver factory")142 fun `Call the drive method with a default setup configuration and use it explicitly`(testFactory: () -> WebDriver) {143 val defaultConfigurationSetup: ConfigurationSetup = Configuration(false, testFactory)144 val desiredConfigurationSetup = ConfigurationBuilder().apply {145 setups = mapOf(146 "default" to setup {147 autoQuit = defaultConfigurationSetup.autoQuit148 driverFactory = defaultConfigurationSetup.driverFactory149 }150 )151 }.build()152 System.setProperty(Browser.BALIN_SETUP_NAME_PROPERTY, "default")153 Browser.drive(desiredConfigurationSetup) {154 Assert.assertEquals(configurationSetup, defaultConfigurationSetup)155 }156 }157 @Test(dataProvider = "JavaScript-incapable WebDriver factory")158 fun `Call the drive method with a development setup configuration and don't use it`(testFactory: () -> WebDriver) {159 val developmentConfigurationSetup: ConfigurationSetup = Configuration(false, testFactory)160 val desiredConfigurationSetup = ConfigurationBuilder().apply {161 driverFactory = testFactory162 setups = mapOf(163 "development" to setup {164 autoQuit = developmentConfigurationSetup.autoQuit165 driverFactory = developmentConfigurationSetup.driverFactory166 }167 )168 }.build()169 Browser.drive(desiredConfigurationSetup) {170 Assert.assertEquals(configurationSetup, desiredConfigurationSetup)171 }172 }173 @Test(description = "Call the drive method with a development setup configuration and use it",174 dataProvider = "JavaScript-incapable WebDriver factory")175 fun call_the_drive_method_with_a_development_setup_configuration_and_use_it(testFactory: () -> WebDriver) {176 val developmentConfigurationSetup: ConfigurationSetup = Configuration(false, testFactory)177 val desiredConfigurationSetup = ConfigurationBuilder().apply {178 driverFactory = testFactory179 setups = mapOf(180 "development" to setup {181 autoQuit = developmentConfigurationSetup.autoQuit182 driverFactory = developmentConfigurationSetup.driverFactory183 }184 )185 }.build()186 System.setProperty(Browser.BALIN_SETUP_NAME_PROPERTY, "development")187 Browser.drive(desiredConfigurationSetup) {188 Assert.assertEquals(configurationSetup, developmentConfigurationSetup)189 }190 }191}192/* ***************************************************************************/...

Full Screen

Full Screen

ConfigurationBuilder.kt

Source:ConfigurationBuilder.kt Github

copy

Full Screen

...17package com.github.epadronu.balin.config18/* ***************************************************************************/19/* ***************************************************************************/20/**21 * Defines the builder used in the configuration DSL that can be interacted22 * with via the [com.github.epadronu.balin.core.Browser.configure] method.23 *24 * @see ConfigurationSetup25 * @sample com.github.epadronu.balin.config.ConfigurationTests.call_the_configure_method_and_make_changes26 *27 * @property setups may contain configuration setups to be used according to the `balin.setup.name` system property.28 * @constructor Creates a new configuration builder.29 */30class ConfigurationBuilder : ConfigurationSetupBuilder() {31 var setups: Map<String, ConfigurationSetup> = mapOf()32 /**33 * Domain-Specific language that let's you create a configuration.34 *35 * @sample com.github.epadronu.balin.config.ConfigurationTests.call_the_drive_method_with_a_development_setup_configuration_and_use_it36 *37 * @param block here you can interact with the DSL.38 */39 fun setup(block: ConfigurationSetupBuilder.() -> Unit): ConfigurationSetup = ConfigurationSetupBuilder().apply {40 block()41 }.build()42 /**43 * Creates a new configuration.44 *45 * @return a new configuration setup using the options provided to the builder.46 */47 override fun build(): Configuration = Configuration(48 autoQuit, driverFactory, waitForSleepTimeInMilliseconds, waitForTimeOutTimeInSeconds, setups)49}50/* ***************************************************************************/...

Full Screen

Full Screen

build

Using AI Code Generation

copy

Full Screen

1com.github.epadronu.balin.config.ConfigurationBuilder . build { driver { driver = ChromeDriver :: class options { addArguments ( "--headless" ) } } }2com.github.epadronu.balin.config.ConfigurationBuilder . build { driver { driver = FirefoxDriver :: class options { addArguments ( "--headless" ) } } }3com.github.epadronu.balin.config.ConfigurationBuilder . build { driver { driver = SafariDriver :: class options { addArguments ( "--headless" ) } } }4com.github.epadronu.balin.config.ConfigurationBuilder . build { driver { driver = EdgeDriver :: class options { addArguments ( "--headless" ) } } }5com.github.epadronu.balin.config.ConfigurationBuilder . build { driver { driver = OperaDriver :: class options { addArguments ( "--headless" ) } } }6com.github.epadronu.balin.config.ConfigurationBuilder . build { driver { driver = PhantomJSDriver :: class options { addArguments ( "--headless" ) } } }7com.github.epadronu.balin.config.ConfigurationBuilder . build { driver { driver = InternetExplorerDriver :: class options { addArguments ( "--headless" ) } } }8com.github.epadronu.balin.config.ConfigurationBuilder . build { driver { driver = HtmlUnitDriver :: class options { addArguments ( "--headless" ) } } }

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Balin automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in ConfigurationBuilder

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful