How to use WaitingSupport class of com.github.epadronu.balin.core package

Best Balin code snippet using com.github.epadronu.balin.core.WaitingSupport

Run Balin automation tests on LambdaTest cloud grid

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

ConfigurationSetupBuilder.kt

Source: ConfigurationSetupBuilder.kt Github

copy
1/******************************************************************************
2 * Copyright 2016 Edinson E. Padrón Urdaneta
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17/* ***************************************************************************/
18package com.github.epadronu.balin.config
19/* ***************************************************************************/
20
21/* ***************************************************************************/
22import org.openqa.selenium.WebDriver
23/* ***************************************************************************/
24
25/* ***************************************************************************/
26/**
27 * Defines the builder used in the configuration DSL that can be interacted
28 * with via the [com.github.epadronu.balin.core.Browser.configure] method.
29 *
30 * @see ConfigurationSetup
31 * @sample com.github.epadronu.balin.config.ConfigurationTests.call_the_configure_method_and_make_changes
32 *
33 * @property autoQuit control whether the driver quits at the end of [com.github.epadronu.balin.core.Browser.drive].
34 * @property driverFactory the factory that will create the driver to be used when invoking [com.github.epadronu.balin.core.Browser.drive].
35 * @property waitForSleepTimeInMilliseconds control the amount of time between attempts when using [com.github.epadronu.balin.core.WaitingSupport.waitFor].
36 * @property waitForTimeOutTimeInSeconds control the total amount of time to wait for a condition evaluated by [com.github.epadronu.balin.core.WaitingSupport.waitFor] to hold.
37 * @constructor Creates a new configuration setup builder.
38 */
39open class ConfigurationSetupBuilder {
40
41    var autoQuit: Boolean = ConfigurationSetup.Default.autoQuit
42
43    var driverFactory: () -> WebDriver = ConfigurationSetup.Default.driverFactory
44
45    var waitForSleepTimeInMilliseconds: Long = ConfigurationSetup.Default.waitForSleepTimeInMilliseconds
46
47    var waitForTimeOutTimeInSeconds: Long = ConfigurationSetup.Default.waitForTimeOutTimeInSeconds
48
49    /**
50     * Creates a new configuration setup.
51     *
52     * @return a new configuration setup using the options provided to the builder.
53     */
54    open fun build(): ConfigurationSetup = Configuration(
55        autoQuit, driverFactory, waitForSleepTimeInMilliseconds, waitForTimeOutTimeInSeconds)
56}
57/* ***************************************************************************/
58
Full Screen

Configuration.kt

Source: Configuration.kt Github

copy
1/******************************************************************************
2 * Copyright 2016 Edinson E. Padrón Urdaneta
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17/* ***************************************************************************/
18package com.github.epadronu.balin.config
19/* ***************************************************************************/
20
21/* ***************************************************************************/
22import org.openqa.selenium.WebDriver
23/* ***************************************************************************/
24
25/* ***************************************************************************/
26/**
27 * This class defines a special kind of configuration setup that may contain
28 * other configuration setups, to be used according to the `balin.setup.name`
29 * system property.
30 *
31 * @see ConfigurationSetup
32 * @sample com.github.epadronu.balin.config.ConfigurationTests.call_the_drive_method_with_a_development_setup_configuration_and_use_it
33 *
34 * @property autoQuit control whether the driver quits at the end of [com.github.epadronu.balin.core.Browser.drive].
35 * @property driverFactory the factory that will create the driver to be used when invoking [com.github.epadronu.balin.core.Browser.drive].
36 * @property waitForSleepTimeInMilliseconds control the amount of time between attempts when using [com.github.epadronu.balin.core.WaitingSupport.waitFor].
37 * @property waitForTimeOutTimeInSeconds control the total amount of time to wait for a condition evaluated by [com.github.epadronu.balin.core.WaitingSupport.waitFor] to hold.
38 * @property setups may contain configuration setups to be used according to the `balin.setup.name` system property.
39 * @constructor Creates a new configuration setup
40 */
41data class Configuration(
42    override val autoQuit: Boolean = ConfigurationSetup.Default.autoQuit,
43    override val driverFactory: () -> WebDriver = ConfigurationSetup.Default.driverFactory,
44    override val waitForSleepTimeInMilliseconds: Long = ConfigurationSetup.Default.waitForSleepTimeInMilliseconds,
45    override val waitForTimeOutTimeInSeconds: Long = ConfigurationSetup.Default.waitForTimeOutTimeInSeconds,
46    val setups: Map<String, ConfigurationSetup> = emptyMap()) : ConfigurationSetup
47/* ***************************************************************************/
48
Full Screen

ConfigurationSetup.kt

Source: ConfigurationSetup.kt Github

copy
1/******************************************************************************
2 * Copyright 2016 Edinson E. Padrón Urdaneta
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17/* ***************************************************************************/
18package com.github.epadronu.balin.config
19/* ***************************************************************************/
20
21/* ***************************************************************************/
22import org.openqa.selenium.WebDriver
23import org.openqa.selenium.firefox.FirefoxDriver
24/* ***************************************************************************/
25
26/* ***************************************************************************/
27const val DEFAULT_SLEEP_TIME_IN_MILLISECONDS = 1000L
28
29const val DEFAULT_TIME_OUT_TIME_IN_SECONDS = 10L
30/* ***************************************************************************/
31
32/* ***************************************************************************/
33/**
34 * This interface describe the different configuration options that can be used
35 * to customize Balin's behavior.
36 */
37interface ConfigurationSetup {
38
39    /**
40     * Control whether the driver quits at the end
41     * of [com.github.epadronu.balin.core.Browser.drive].
42     *
43     *     autoQuit = false
44     */
45    val autoQuit: Boolean
46
47    /**
48     * The factory that will create the driver to be used when invoking
49     * [com.github.epadronu.balin.core.Browser.drive].
50     *
51     *     driverFactory = ::FirefoxDriver
52     */
53    val driverFactory: () -> WebDriver
54
55    /**
56     * Control the amount of time between attempts when using
57     * [com.github.epadronu.balin.core.WaitingSupport.waitFor].
58     *
59     *     waitForSleepTimeInMilliseconds = 1_000L // One second
60     */
61    val waitForSleepTimeInMilliseconds: Long
62
63    /**
64     * Control the total amount of time to wait for a condition evaluated by
65     * [com.github.epadronu.balin.core.WaitingSupport.waitFor] to hold.
66     *
67     *     waitForTimeOutTimeInSecond = 10L // Ten seconds
68     */
69    val waitForTimeOutTimeInSeconds: Long
70
71    /**
72     * Contains the default configuration setup used by Balin.
73     */
74    companion object {
75
76        /**
77         * Define the default configuration setup used by Balin.
78         */
79        internal val Default = Configuration(
80            true,
81            ::FirefoxDriver,
82            DEFAULT_SLEEP_TIME_IN_MILLISECONDS,
83            DEFAULT_TIME_OUT_TIME_IN_SECONDS)
84    }
85}
86/* ***************************************************************************/
87
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Most used methods in WaitingSupport

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie