import logging

import page_objects

def option_should_be_selected(text):
    '''
    Verifies specified dropdown option is selected.

    Parameters
    ----------
    text : str

    Returns
    -------
    None

    Raises
    ------
    AssertionError
        If the specified option is not selected.
    '''
    page = page_objects.dropdown.DropdownPage()
    selected_option = page.selected_option()
    if selected_option != text:
        log_str = 'FAIL:\n  Actual option selected:   {}\n  Expected option selected: {}'.format(selected_option, text)
        logging.error(log_str)
        raise AssertionError(log_str)
    logging.info('PASS: Option "{}" selected.'.format(selected_option))
    return
