Exemple #1
0
def test_ability_scores_persist(player_wizard, browser): # noqa
    """As a player, ability scores persist after page refresh."""
    print('As a player, ability scores persist after page refresh.')
    ability_scores_edit = AbilityScoresEditModal(browser)
    ability_scores_table = AbilityScoresTable(browser)

    tabs = Tabs(browser)
    tabs.stats.click()

    ability_scores_table.table.click()
    ability_scores_edit.strength = 15
    ability_scores_edit.dexterity = 16
    ability_scores_edit.constitution = 17
    ability_scores_edit.intelligence = 16
    ability_scores_edit.wisdom = 15
    ability_scores_edit.charisma = 14

    ability_scores_edit.done.click()

    WebDriverWait(browser, 10).until(
        EC.text_to_be_present_in_element(
            (By.ID, ability_scores_table.strength.get_attribute('id')),
            '15'
        )
    )

    browser.refresh()

    assert ability_scores_table.strength.text == '15'
    assert ability_scores_table.dexterity.text == '16'
    assert ability_scores_table.constitution.text == '17'
    assert ability_scores_table.intelligence.text == '16'
    assert ability_scores_table.wisdom.text == '15'
    assert ability_scores_table.charisma.text == '14'
def test_charisma_increase(player_wizard, browser):  # noqa
    """When charisma is increased or decreased, relevant skills and savings
       throws reflect the change."""

    print(('When charisma is increased or decreased, relevant skills and '
           'savings throws reflect the change.'))

    saving_throw = SavingThrowTable(browser)
    skills = SkillsTable(browser)
    ability_scores_table = AbilityScoresTable(browser)
    ability_scores_edit = AbilityScoresEditModal(browser)
    tabs = Tabs(browser)

    ability_scores_table.table.click()
    ability_scores_edit.charisma = 14
    ability_scores_edit.done.click()

    WebDriverWait(browser, DEFAULT_WAIT_TIME).until(
        table_cell_updated(saving_throw, 'blank2', '+ 2', 'table', 1))

    charisma = ut.get_table_row(saving_throw, 'table', row_number=1)

    tabs.skills.click()

    deception = ut.get_table_row(skills, 'table', row_number=5)
    intimidation = ut.get_table_row(skills, 'table', row_number=8)
    performance = ut.get_table_row(skills, 'table', row_number=13)
    persuasion = ut.get_table_row(skills, 'table', row_number=14)

    assert charisma.blank2.strip() == '+ 2'
    assert deception.blank2.strip() == '+ 2 (Cha)'
    assert intimidation.blank2.strip() == '+ 2 (Cha)'
    assert performance.blank2.strip() == '+ 2 (Cha)'
    assert persuasion.blank2.strip() == '+ 2 (Cha)'
Exemple #3
0
def test_ability_scores_modifiers(player_wizard, browser): # noqa
    """As a player, I can view my ability score modifiers."""
    print('As a player, I can view my ability score modifiers.')
    ability_scores_edit = AbilityScoresEditModal(browser)
    ability_scores_table = AbilityScoresTable(browser)

    tabs = Tabs(browser)
    tabs.stats.click()

    ability_scores_table.table.click()
    ability_scores_edit.strength = 15
    ability_scores_edit.dexterity = 16
    ability_scores_edit.constitution = 17
    ability_scores_edit.intelligence = 16
    ability_scores_edit.wisdom = 15
    ability_scores_edit.charisma = 14

    ability_scores_edit.done.click()

    WebDriverWait(browser, 10).until(
        EC.text_to_be_present_in_element(
            (By.ID, ability_scores_table.strength.get_attribute('id')),
            '15'
        )
    )

    assert ability_scores_table.strength_modifier.text == '+ 2'
    assert ability_scores_table.dexterity_modifier.text == '+ 3'
    assert ability_scores_table.constitution_modifier.text == '+ 3'
    assert ability_scores_table.intelligence_modifier.text == '+ 3'
    assert ability_scores_table.wisdom_modifier.text == '+ 2'
    assert ability_scores_table.charisma_modifier.text == '+ 2'
Exemple #4
0
def test_edit_ability_scores(player_wizard, browser):  # noqa
    """As a player, I can edit my ability scores."""

    print('As a player, I can edit my ability scores.')

    time.sleep(8)

    ability_scores_edit = AbilityScoresEditModal(browser)
    ability_scores_table = AbilityScoresTable(browser)

    ability_scores_table.table.click()
    ability_scores_edit.strength = 15
    ability_scores_edit.dexterity = 16
    ability_scores_edit.constitution = 17
    ability_scores_edit.intelligence = 16
    ability_scores_edit.wisdom = 15
    ability_scores_edit.charisma = 14

    ability_scores_edit.done.click()

    WebDriverWait(browser, DEFAULT_WAIT_TIME).until(
        EC.text_to_be_present_in_element(
            (By.ID, ability_scores_table.strength.get_attribute('id')), '15'))

    assert ability_scores_table.strength.text.strip() == '15'
    assert ability_scores_table.dexterity.text.strip() == '16'
    assert ability_scores_table.constitution.text.strip() == '17'
    assert ability_scores_table.intelligence.text.strip() == '16'
    assert ability_scores_table.wisdom.text.strip() == '15'
    assert ability_scores_table.charisma.text.strip() == '14'