def test_initiative_modifier(player_wizard, browser): # noqa """As a player, I can increase or decrease my calculated initiative via a modifier field and this is reflected in the label.""" print(('As a player, I can increase or decrease my calculated initiative ' 'via a modifier field and this is reflected in the label.')) other_stats = OtherStats(browser) other_stats.initiative_modifier = 1 other_stats.initiative_modifier.send_keys(Keys.TAB) assert other_stats.initiative.text.strip() == '5' other_stats.initiative_modifier = -1 other_stats.initiative_modifier.send_keys(Keys.TAB) assert other_stats.initiative.text.strip() == '3'
def test_data_persists(player_wizard, browser): # noqa """As a player, all changes I make to hit points, hit dice, ability scores, savings throws, and other stats persist after I refresh the browser.""" print(('As a player, all changes I make to hit points, hit dice, ability ' 'scores, savings throws, and other stats persist after I refresh ' ' the browser.')) ability_scores_edit = AbilityScoresEditModal(browser) ability_scores_table = AbilityScoresTable(browser) hp_hd = HitPointHitDice(browser) other_stats = OtherStats(browser) saving_throw = SavingThrowTable(browser) saving_throw_edit = SavingThrowEditModal(browser) ability_scores_table.table.click() ability_scores_edit.strength = 15 ability_scores_edit.done.click() WebDriverWait(browser, DEFAULT_WAIT_TIME).until(modal_finished_closing()) hp_hd.damage_up.click() hp_hd.hitdice1.click() row = ut.get_table_row(saving_throw, 'table', values=False) # open edit modal row[0].click() saving_throw_edit.modifier = 1 saving_throw_edit.proficiency.click() saving_throw_edit.done.click() other_stats.ac_modifier = 1 other_stats.ac_modifier.send_keys(Keys.TAB) other_stats.initiative_modifier = 1 other_stats.initiative_modifier.send_keys(Keys.TAB) other_stats.proficiency_bonus_modifier = 1 other_stats.proficiency_bonus_modifier.send_keys(Keys.TAB) other_stats.speed = 40 other_stats.speed.send_keys(Keys.TAB) other_stats.level = 3 other_stats.level.send_keys(Keys.TAB) other_stats.experience = 2000 other_stats.experience.send_keys(Keys.TAB) browser.refresh() row = ut.get_table_row(saving_throw, 'table', values=False) proficieny = row[0].find_elements(By.TAG_NAME, 'span') charisma = ut.get_table_row(saving_throw, 'table') assert ability_scores_table.strength.text.strip() == '15' assert hp_hd.hit_points_bar_label.text.strip() == 'HP: 9' assert hp_hd.hitdice1.get_attribute('class').strip() == 'dice-empty' assert charisma.blank2.strip() == '+ 8' assert proficieny[0].get_attribute('class').strip() == 'fa fa-check' assert other_stats.initiative.text.strip() == '5' assert other_stats.proficiency_bonus.text.strip() == '3' assert other_stats.speed.get_attribute('value').strip() == '40' assert other_stats.level.get_attribute('value').strip() == '3' assert other_stats.experience.get_attribute('value').strip() == '2000'