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_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'
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'
def test_dexterity_increase(player_wizard, browser): # noqa """When dexterity is increased or decreased, relevant skills, savings throws, initiative, and to hit (finesse weapons) reflect the change.""" print(('When dexterity is increased or decreased, relevant skills, ' 'savings throws, initiative, and to hit (finesse weapons) reflect ' 'the change.')) saving_throw = SavingThrowTable(browser) skills = SkillsTable(browser) ability_scores_table = AbilityScoresTable(browser) ability_scores_edit = AbilityScoresEditModal(browser) weapon_table = WeaponTable(browser) weapon_add = WeaponAddModal(browser) stats = OtherStats(browser) tabs = Tabs(browser) ability_scores_table.table.click() # str needs to be less than dex as we are testing finesse weapon # i.e. the higher of str and dex is used ability_scores_edit.strength = 10 ability_scores_edit.dexterity = 14 ability_scores_edit.done.click() WebDriverWait(browser, DEFAULT_WAIT_TIME).until( table_cell_updated(saving_throw, 'blank2', '+ 2', 'table', 3)) dexterity = ut.get_table_row(saving_throw, 'table', row_number=3) initiative = stats.initiative.text tabs.skills.click() acrobatics = ut.get_table_row(skills, 'table', row_number=1) sleight_of_hand = ut.get_table_row(skills, 'table', row_number=16) stealth = ut.get_table_row(skills, 'table', row_number=17) tabs.equipment.click() weapon_table.add.click() # select a dagger ut.select_from_autocomplete(weapon_add, 'name', browser, has_search_term=False, arrow_down_count=7) weapon_add.add.click() to_hit = ut.get_table_row(weapon_table, 'table').to_hit assert dexterity.blank2.strip() == '+ 2' assert initiative.strip() == '2' assert to_hit.strip() == '+ 4' assert acrobatics.blank2.strip() == '+ 2 (Dex)' assert sleight_of_hand.blank2.strip() == '+ 2 (Dex)' assert stealth.blank2.strip() == '+ 2 (Dex)'