Example #1
0
def test_proficiency_ogl_pre_pop(player_wizard, browser):  # noqa
    """As a player, if I select from proficiency name field, OGL data
       auto-completes and the remaining fields pre-populate."""
    print(('As a player, if I select from proficiency name field, OGL data '
           'auto-completes and the remaining fields pre-populate.'))

    proficiency_add = proficiency.ProficiencyAddModal(browser)
    proficiency_table = proficiency.ProficiencyTable(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

    proficiency_table.add.click()
    ut.select_from_autocomplete(proficiency_add,
                                'name',
                                browser,
                                has_search_term=False)

    proficiency_add.name.send_keys(Keys.TAB)

    proficiency_add.add.click()

    WebDriverWait(browser,
                  DEFAULT_WAIT_TIME).until(table_has_data(proficiency_table))

    row = ut.get_table_row(proficiency_table, 'table', 1)

    assert row.type.strip() == 'Languages'
    assert row.proficiency.strip() == 'Abyssal'
Example #2
0
def test_delete_proficiency(player_wizard, browser):  # noqa
    """As a player, I can delete a proficiency."""
    print('As a player, I can delete a proficiency.')

    proficiency_add = proficiency.ProficiencyAddModal(browser)
    proficiency_table = proficiency.ProficiencyTable(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

    WebDriverWait(browser, DEFAULT_WAIT_TIME).until(
        EC.element_to_be_clickable((By.ID, proficiency_table.add_id)))

    proficiency_table.add.click()
    ut.select_from_autocomplete(proficiency_add,
                                'name',
                                browser,
                                has_search_term=False)
    proficiency_add.add.click()

    rows = ut.get_table_rows(proficiency_table, 'table', values=False)

    WebDriverWait(browser, DEFAULT_WAIT_TIME).until(modal_finished_closing())

    rows[0][2].find_element_by_tag_name('a').click()
    rows = ut.get_table_rows(proficiency_table, 'table', values=False)

    assert rows[0][0].text.strip() == 'Add a new Proficiency'
Example #3
0
def test_add_proficiency(player_wizard, browser):  # noqa
    """As a player, I can add a proficiency."""
    print('As a player, I can add a proficiency.')

    proficiency_add = proficiency.ProficiencyAddModal(browser)
    proficiency_table = proficiency.ProficiencyTable(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

    proficiency_table.add.click()
    proficiency_add.name = 'Add Name'
    proficiency_add.type_ = 'Add Type'
    proficiency_add.description = 'Add Description'

    assert proficiency_add.name.get_attribute('value').strip() == 'Add Name'
    assert proficiency_add.type_.get_attribute('value').strip() == 'Add Type'
    assert proficiency_add.description.get_attribute(
        'value').strip() == 'Add Description'

    proficiency_add.add.click()

    WebDriverWait(browser,
                  DEFAULT_WAIT_TIME).until(table_has_data(proficiency_table))

    row = ut.get_table_row(proficiency_table, 'table', 1)

    assert row.type.strip() == 'Add Type'
    assert row.proficiency.strip() == 'Add Name'
Example #4
0
def test_edit_proficiency(player_wizard, browser):  # noqa
    """As a player, I can edit a proficiency."""
    print('As a player, I can edit a proficiency.')

    proficiency_add = proficiency.ProficiencyAddModal(browser)
    proficiency_edit = proficiency.ProficiencyEditModal(browser)
    proficiency_table = proficiency.ProficiencyTable(browser)
    proficiency_tabs = proficiency.ProficiencyModalTabs(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

    WebDriverWait(browser, DEFAULT_WAIT_TIME).until(
        EC.element_to_be_clickable((By.ID, proficiency_table.add_id)))

    proficiency_table.add.click()
    ut.select_from_autocomplete(proficiency_add,
                                'name',
                                browser,
                                has_search_term=False)

    proficiency_add.name.send_keys(Keys.TAB)

    proficiency_add.add.click()

    WebDriverWait(browser, DEFAULT_WAIT_TIME).until(modal_finished_closing())

    WebDriverWait(browser,
                  DEFAULT_WAIT_TIME).until(table_has_data(proficiency_table))

    rows = ut.get_table_rows(proficiency_table, 'table', values=False)
    rows[0][0].click()

    WebDriverWait(browser, DEFAULT_WAIT_TIME).until(
        EC.element_to_be_clickable((By.ID, proficiency_tabs.edit_id)))

    proficiency_tabs.edit.click()

    proficiency_edit.name = 'Edited Name'
    proficiency_edit.type_ = 'Edited Type'
    proficiency_edit.description = 'Edited Description'

    assert proficiency_edit.name.get_attribute(
        'value').strip() == 'Edited Name'
    assert proficiency_edit.type_.get_attribute(
        'value').strip() == 'Edited Type'
    assert proficiency_edit.description.get_attribute(
        'value').strip() == 'Edited Description'

    proficiency_edit.done.click()

    WebDriverWait(browser, DEFAULT_WAIT_TIME).until(modal_finished_closing())

    row = ut.get_table_row(proficiency_table, 'table', 1)

    assert row.proficiency.strip() == 'Edited Name'
    assert row.type.strip() == 'Edited Type'
Example #5
0
def test_add_proficiency_open_model_by_row(player_wizard, browser):  # noqa
    """As a player, I can click the first row in proficiency table to open the
       proficiency add modal."""
    print(('As a player, I can click the first row in proficiency table to '
           'open the proficiency add modal.'))

    proficiency_table = proficiency.ProficiencyTable(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

    rows = ut.get_table_rows(proficiency_table, 'table', values=False)

    assert rows[0][0].is_enabled()
    assert rows[0][0].is_displayed()
Example #6
0
def test_autocomplete_proficiency(player_wizard, browser):  # noqa
    """As a player, if I start typing in the name field and class field, I can select suggested items in the dropdown."""
    print(
        'As a player, if I start typing in the name field and type field, I can select suggested items in the dropdown.'
    )

    proficiency_add = proficiency.ProficiencyAddModal(browser)
    proficiency_table = proficiency.ProficiencyTable(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

    proficiency_table.add.click()
    ut.select_from_autocomplete(proficiency_add, 'name', '', browser)
    ut.select_from_autocomplete(proficiency_add, 'type_', '', browser)

    assert proficiency_add.name.get_attribute('value') == 'Abyssal'
    assert proficiency_add.type_.get_attribute('value') == 'Armor'
Example #7
0
def test_delete_proficiency(player_wizard, browser):  # noqa
    """As a player, I can delete a proficiency."""
    print('As a player, I can delete a proficiency.')

    proficiency_add = proficiency.ProficiencyAddModal(browser)
    proficiency_table = proficiency.ProficiencyTable(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

    proficiency_table.add.click()
    ut.select_from_autocomplete(proficiency_add, 'name', '', browser)
    proficiency_add.add.click()

    rows = ut.get_table_rows(proficiency_table, 'table', values=False)
    time.sleep(.3)
    rows[0][2].find_element_by_tag_name('a').click()
    rows = ut.get_table_rows(proficiency_table, 'table', values=False)

    assert rows[0][0].text == 'Add a new Proficiency'
Example #8
0
def test_proficiency_ogl_pre_pop(player_wizard, browser):  # noqa
    """As a player, if I select from proficiency name field, OGL data auto-completes and the remaining fields pre-populate."""
    print(
        'As a player, if I select from proficiency name field, OGL data auto-completes and the remaining fields pre-populate.'
    )

    proficiency_add = proficiency.ProficiencyAddModal(browser)
    proficiency_table = proficiency.ProficiencyTable(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

    proficiency_table.add.click()
    ut.select_from_autocomplete(proficiency_add, 'name', '', browser)
    proficiency_add.add.click()

    row = ut.get_table_row(proficiency_table, 'table', 1)

    assert row.type == 'Languages'
    assert row.proficiency == 'Abyssal'
Example #9
0
def test_edit_proficiency(player_wizard, browser):  # noqa
    """As a player, I can edit a proficiency."""
    print('As a player, I can edit a proficiency.')

    proficiency_add = proficiency.ProficiencyAddModal(browser)
    proficiency_edit = proficiency.ProficiencyEditModal(browser)
    proficiency_table = proficiency.ProficiencyTable(browser)
    proficiency_tabs = proficiency.ProficiencyModalTabs(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

    proficiency_table.add.click()
    ut.select_from_autocomplete(proficiency_add, 'name', '', browser)
    proficiency_add.add.click()

    rows = ut.get_table_rows(proficiency_table, 'table', values=False)
    time.sleep(.3)
    rows[0][0].click()
    time.sleep(.3)
    proficiency_tabs.edit.click()

    proficiency_edit.name.clear()
    proficiency_edit.type_.clear()
    proficiency_edit.description.clear()

    proficiency_edit.name = 'Edited Name'
    proficiency_edit.type_ = 'Edited Type'
    proficiency_edit.description = 'Edited Description'

    assert proficiency_edit.name.get_attribute('value') == 'Edited Name'
    assert proficiency_edit.type_.get_attribute('value') == 'Edited Type'
    assert proficiency_edit.description.get_attribute(
        'value') == 'Edited Description'
    proficiency_edit.done.click()

    rows = ut.get_table_rows(proficiency_table, 'table', values=False)
    time.sleep(.3)

    row = ut.get_table_row(proficiency_table, 'table', 1)
    assert row.proficiency == 'Edited Name'
    assert row.type == 'Edited Type'
Example #10
0
def test_add_proficiency(player_wizard, browser):  # noqa
    """As a player, I can add a proficiency."""
    print('As a player, I can add a proficiency.')

    proficiency_add = proficiency.ProficiencyAddModal(browser)
    proficiency_table = proficiency.ProficiencyTable(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

    proficiency_table.add.click()
    proficiency_add.name = 'Add Name'
    proficiency_add.type_ = 'Add Type'
    proficiency_add.description = 'Add Description'

    assert proficiency_add.name.get_attribute('value') == 'Add Name'
    assert proficiency_add.type_.get_attribute('value') == 'Add Type'
    assert proficiency_add.description.get_attribute(
        'value') == 'Add Description'

    proficiency_add.add.click()

    row = ut.get_table_row(proficiency_table, 'table', 1)
    assert row.type == 'Add Type'
    assert row.proficiency == 'Add Name'
Example #11
0
def test_data_persists(player_wizard, browser):  # noqa
    """As a player, all changes I make to features, feats, traits,
       proficiencies, tracking, and skills persist after I refresh the
       browser."""

    print(('As a player, all changes I make to features, feats, traits, '
           'proficiencies, tracking, and skills persist after I refresh the '
           'browser.'))

    feature = features.FeatureAddModal(browser)
    features_table = features.FeaturesTable(browser)
    feat = feats.FeatAddModal(browser)
    feats_table = feats.FeatsTable(browser)
    trait = traits.TraitAddModal(browser)
    traits_table = traits.TraitsTable(browser)
    tracked_table = tracked.TrackedTable(browser)
    proficiency_add = proficiency.ProficiencyAddModal(browser)
    proficiency_table = proficiency.ProficiencyTable(browser)
    skills_table = skills.SkillsTable(browser)
    skills_edit = skills.SkillsEditModal(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

    features_table.add.click()
    feature.name = 'Add Name'
    feature.class_ = 'Add Class'
    feature.level = 1
    feature.description = 'Add Description'
    feature.tracked.click()
    feature.max_ = 4
    feature.short_rest.click()

    time.sleep(1)

    feature.add.click()

    WebDriverWait(browser, DEFAULT_WAIT_TIME).until(modal_finished_closing())

    feats_table.add.click()
    ut.select_from_autocomplete(feat, 'name', browser, has_search_term=False)

    feat.name.send_keys(Keys.TAB)

    feat.add.click()

    WebDriverWait(browser, DEFAULT_WAIT_TIME).until(modal_finished_closing())

    traits_table.add.click()
    ut.select_from_autocomplete(trait, 'name', browser, has_search_term=False)

    trait.name.send_keys(Keys.TAB)

    trait.add.click()

    WebDriverWait(browser, DEFAULT_WAIT_TIME).until(modal_finished_closing())

    proficiency_table.add.click()
    ut.select_from_autocomplete(proficiency_add,
                                'name',
                                browser,
                                has_search_term=False)

    proficiency_add.name.send_keys(Keys.TAB)

    proficiency_add.add.click()

    WebDriverWait(browser, DEFAULT_WAIT_TIME).until(modal_finished_closing())

    acrobatics = ut.get_table_row(skills_table, 'table', values=False)
    acrobatics[0].click()

    WebDriverWait(browser, DEFAULT_WAIT_TIME).until(
        EC.element_to_be_clickable((By.XPATH, skills_edit.half_xpath)))

    skills_edit.half.click()
    skills_edit.done.click()

    WebDriverWait(browser, DEFAULT_WAIT_TIME).until(modal_finished_closing())

    browser.refresh()

    WebDriverWait(browser,
                  DEFAULT_WAIT_TIME).until(table_has_data(features_table))

    row = ut.get_table_row(features_table, 'table', 1)

    assert tracked_table.tracked1_name.text.strip() == 'Add Name'
    assert tracked_table.tracked1_max.text.strip() == '4'
    assert row.class_.strip() == 'Add Class'
    assert row.feature.strip() == 'Add Name'

    row = ut.get_table_row(feats_table, 'table', 1)

    assert row.feat.strip() == 'Grappler'

    row = ut.get_table_row(traits_table, 'table', 1)

    assert row.race.strip() == 'Dragonborn'
    assert row.trait.strip() == 'Ability Score Increase'

    row = ut.get_table_row(proficiency_table, 'table', 1)

    assert row.type.strip() == 'Languages'
    assert row.proficiency.strip() == 'Abyssal'