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

    trait = traits.TraitAddModal(browser)
    traits_table = traits.TraitsTable(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

    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(table_has_data(traits_table))

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

    assert row.race.strip() == 'Dragonborn'
    assert row.trait.strip() == 'Ability Score Increase'
Exemplo n.º 2
0
def test_delete_trait(player_wizard, browser):  # noqa
    """As a player, I can delete a trait."""
    print('As a player, I can delete a trait.')

    trait = traits.TraitAddModal(browser)
    traits_table = traits.TraitsTable(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

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

    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())

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

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

    WebDriverWait(browser,
                  DEFAULT_WAIT_TIME).until(table_is_empty(traits_table))

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

    assert rows[0][0].text.strip() == 'Add a new Trait'
Exemplo n.º 3
0
def test_add_trait(player_wizard, browser):  # noqa
    """As a player, I can add a trait."""
    print('As a player, I can add a trait.')

    trait = traits.TraitAddModal(browser)
    traits_table = traits.TraitsTable(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

    traits_table.add.click()
    trait.name = 'Add Name'
    trait.race = 'Add Race'
    trait.description = 'Add Description'
    trait.tracked.click()
    trait.max_.clear()
    trait.max_ = 4
    trait.short_rest.click()

    assert trait.name.get_attribute('value') == 'Add Name'
    assert trait.race.get_attribute('value') == 'Add Race'
    assert trait.description.get_attribute('value') == 'Add Description'
    assert trait.max_.get_attribute('value') == '4'
    assert 'active' in trait.short_rest.get_attribute('class')

    trait.add.click()

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

    assert row.race == 'Add Race'
    assert row.trait == 'Add Name'
Exemplo n.º 4
0
def test_edit_trait(player_wizard, browser):  # noqa
    """As a player, I can edit a trait."""
    print('As a player, I can edit a trait.')

    trait = traits.TraitAddModal(browser)
    trait_edit = traits.TraitEditModal(browser)
    traits_table = traits.TraitsTable(browser)
    trait_tabs = traits.TraitModalTabs(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

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

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

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

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

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

    trait_tabs.edit.click()

    WebDriverWait(browser, DEFAULT_WAIT_TIME).until(
        EC.presence_of_element_located((By.ID, trait_edit.name_id)))

    trait_edit.name = 'Edited Name'
    trait_edit.race = 'Edited Race'
    trait_edit.description = 'Edited Description'
    trait_edit.tracked.click()
    trait_edit.max_ = 4
    trait_edit.short_rest.click()

    assert trait_edit.name.get_attribute('value').strip() == 'Edited Name'
    assert trait_edit.race.get_attribute('value').strip() == 'Edited Race'
    assert trait_edit.description.get_attribute(
        'value').strip() == 'Edited Description'
    assert trait_edit.max_.get_attribute('value').strip() == '4'
    assert 'active' in trait_edit.short_rest.get_attribute('class').strip()

    trait_edit.done.click()

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

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

    WebDriverWait(browser, DEFAULT_WAIT_TIME).until(
        table_cell_updated(traits_table, 'trait', 'Edited Name', 'table', 1))

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

    assert row.trait.strip() == 'Edited Name'
    assert row.race.strip() == 'Edited Race'
Exemplo n.º 5
0
def test_edit_trait(player_wizard, browser):  # noqa
    """As a player, I can edit a trait."""
    print('As a player, I can edit a trait.')

    trait = traits.TraitAddModal(browser)
    trait_edit = traits.TraitEditModal(browser)
    traits_table = traits.TraitsTable(browser)
    trait_tabs = traits.TraitModalTabs(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

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

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

    trait_edit.name.clear()
    trait_edit.race.clear()
    trait_edit.description.clear()

    trait_edit.name = 'Edited Name'
    trait_edit.race = 'Edited Race'
    trait_edit.description = 'Edited Description'
    trait_edit.tracked.click()
    trait_edit.max_.clear()
    trait_edit.max_ = 4
    trait_edit.short_rest.click()

    assert trait_edit.name.get_attribute('value') == 'Edited Name'
    assert trait_edit.race.get_attribute('value') == 'Edited Race'
    assert trait_edit.description.get_attribute(
        'value') == 'Edited Description'
    assert trait_edit.max_.get_attribute('value') == '4'
    assert 'active' in trait_edit.short_rest.get_attribute('class')
    trait_edit.done.click()

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

    row = ut.get_table_row(traits_table, 'table', 1)
    assert row.trait == 'Edited Name'
    assert row.race == 'Edited Race'
Exemplo n.º 6
0
def test_add_autocomplete_trait(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 class field, I can select suggested items in the dropdown.'
    )

    trait = traits.TraitAddModal(browser)
    traits_table = traits.TraitsTable(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

    traits_table.add.click()
    ut.select_from_autocomplete(trait, 'name', '', browser)
    ut.select_from_autocomplete(trait, 'race', '', browser)

    assert trait.name.get_attribute(
        'value') == 'Ability Score Increase (Dragonborn)'
    assert trait.race.get_attribute('value') == 'Dwarf'
Exemplo n.º 7
0
def test_delete_trait(player_wizard, browser):  # noqa
    """As a player, I can delete a trait."""
    print('As a player, I can delete a trait.')

    trait = traits.TraitAddModal(browser)
    traits_table = traits.TraitsTable(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

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

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

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

    trait = traits.TraitAddModal(browser)
    traits_table = traits.TraitsTable(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

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

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

    assert row.race == 'Dragonborn'
    assert row.trait == 'Ability Score Increase'
Exemplo n.º 9
0
def test_add_trait(player_wizard, browser):  # noqa
    """As a player, I can add a trait."""
    print('As a player, I can add a trait.')

    trait = traits.TraitAddModal(browser)
    traits_table = traits.TraitsTable(browser)
    tracked_table = tracked.TrackedTable(browser)
    tabs = Tabs(browser)
    tabs.skills.click()

    traits_table.add.click()
    trait.name = 'Add Name'
    trait.race = 'Add Race'
    trait.description = 'Add Description'
    trait.tracked.click()
    trait.max_ = 4
    trait.short_rest.click()

    assert trait.name.get_attribute('value').strip() == 'Add Name'
    assert trait.race.get_attribute('value').strip() == 'Add Race'
    assert trait.description.get_attribute(
        'value').strip() == 'Add Description'
    assert trait.max_.get_attribute('value').strip() == '4'
    assert 'active' in trait.short_rest.get_attribute('class').strip()

    trait.add.click()

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

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

    assert tracked_table.tracked1_name.text.strip() == 'Add Name'
    assert tracked_table.tracked1_max.text.strip() == '4'
    assert row.race.strip() == 'Add Race'
    assert row.trait.strip() == 'Add Name'
Exemplo n.º 10
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'