Пример #1
0
def client_full_names_equal(client1, client2):
    # POZOR - data v kontextu nemusi obsahovat dane klice
    client1_full_name = common_helpers.client_full_name(
        client1.get("firstname"), client1.get("surname"))
    client2_full_name = common_helpers.client_full_name(
        client2.get("firstname"), client2.get("surname"))
    return client1_full_name == client2_full_name
Пример #2
0
def find_client_with_context(context):
    full_name = common_helpers.client_full_name(context.firstname,
                                                context.surname)
    return helpers.find_client(
        context,
        full_name,
        phone=context.phone,
        email=context.email,
        note=context.note,
        active=context.active,
    )
Пример #3
0
def insert_to_form(context, verify_current_data=False):
    # pockej az bude viditelny formular
    wait_form_visible(context.browser)
    # priprav pole z formulare
    firstname_field = context.browser.find_element_by_css_selector(
        "[data-qa=client_field_firstname]"
    )
    surname_field = context.browser.find_element_by_css_selector("[data-qa=client_field_surname]")
    phone_field = context.browser.find_element_by_css_selector("[data-qa=client_field_phone]")
    email_field = context.browser.find_element_by_css_selector("[data-qa=client_field_email]")
    note_field = context.browser.find_element_by_css_selector("[data-qa=client_field_note]")
    active_checkbox = context.browser.find_element_by_css_selector(
        "[data-qa=client_checkbox_active]"
    )
    active_label = context.browser.find_element_by_css_selector("[data-qa=client_label_active]")
    # over, ze aktualne zobrazene udaje ve formulari jsou spravne
    if verify_current_data:
        assert (
            context.old_client_name
            == common_helpers.client_full_name(
                firstname_field.get_attribute("value"), surname_field.get_attribute("value")
            )
            and context.old_client_phone
            == common_helpers.shrink_str(phone_field.get_attribute("value"))
            and context.old_client_email == email_field.get_attribute("value")
            and context.old_client_note == note_field.get_attribute("value")
            and context.old_client_activity == active_checkbox.is_selected()
        )
    # smaz vsechny udaje
    firstname_field.clear()
    surname_field.clear()
    phone_field.clear()
    email_field.clear()
    note_field.clear()
    # vloz nove udaje
    firstname_field.send_keys(context.firstname)
    surname_field.send_keys(context.surname)
    phone_field.send_keys(context.phone)
    email_field.send_keys(context.email)
    note_field.send_keys(context.note)
    if (context.active and not active_checkbox.is_selected()) or (
        not context.active and active_checkbox.is_selected()
    ):
        active_label.click()
Пример #4
0
def parse_memberships(memberships_data):
    return [
        common_helpers.client_full_name(membership["client"]["firstname"],
                                        membership["client"]["surname"])
        for membership in memberships_data
    ]