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_intelligence_increase(player_wizard, browser): # noqa """When intelligence is increased or decreased, relevant skills reflect the change.""" print(('When intelligence is increased or decreased, relevant skills ' '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.intelligence = 14 ability_scores_edit.done.click() WebDriverWait(browser, DEFAULT_WAIT_TIME).until( table_cell_updated(saving_throw, 'blank2', '+ 2', 'table', 4)) intelligence = ut.get_table_row(saving_throw, 'table', row_number=4) tabs.skills.click() arcana = ut.get_table_row(skills, 'table', row_number=3) history = ut.get_table_row(skills, 'table', row_number=6) investigation = ut.get_table_row(skills, 'table', row_number=9) nature = ut.get_table_row(skills, 'table', row_number=11) religion = ut.get_table_row(skills, 'table', row_number=15) assert intelligence.blank2.strip() == '+ 2' assert arcana.blank2.strip() == '+ 2 (Int)' assert history.blank2.strip() == '+ 2 (Int)' assert investigation.blank2.strip() == '+ 2 (Int)' assert nature.blank2.strip() == '+ 2 (Int)' assert religion.blank2.strip() == '+ 2 (Int)'