Example #1
0
def test_parse_config_data_no_command_line_params(mock_stdout):
    userdata = {}
    context = MockContext()
    context.config = MockConfig(userdata)

    parse_config_data(context)

    assert_that(mock_stdout.getvalue(), equal_to("No Command line Params detected, using Config file values\n"),
                "Unexpected print string")
def test_parse_config_data_sets_browser_type():
    userdata = {"browser": "chrome"}
    context = MockContext()
    context.config = MockConfig(userdata)

    parse_config_data(context)

    assert_that(context.browser, equal_to("chrome"),
                "Expected browser type was not found")
Example #3
0
def test_parse_config_data_sets_base_url():
    userdata = {
        "base_url": "https://www.test.com"
    }
    context = MockContext()
    context.config = MockConfig(userdata)

    parse_config_data(context)

    assert_that(context.url, equal_to("https://www.test.com"), "Expected url value was not found")
Example #4
0
def test_parse_config_data_true_values():
    userdata = {
        "logging_flag": "true",
        "maximize_browser_flag": "true",
    }
    context = MockContext()
    context.config = MockConfig(userdata)

    parse_config_data(context)

    assert_that(context.logging_flag, equal_to(True), "Logging flag should be true")
    assert_that(context.maximize_browser, equal_to(True), "Maximize browser should be true")
Example #5
0
    def prepare_browser(context):
        """
        Set up the browser based on the config options
        :param context: the test context instance
        """
        # Check if we have any command line parameters to parse
        parse_config_data(context)

        # Check the Browser specified in config and load the Selenium Web Driver
        open_browser(context)

        # Set Implicit Wait on Selenium Driver
        context.browser.implicitly_wait(context.implicit_wait)

        # Check if Maximize Browser Flag has been activated
        BrowserHandler.set_browser_size(context)