def test_tracked_reset(player_wizard, browser): # noqa """As a player, I can reset a tracked ability by clicking on the reset icon.""" print(('As a player, I can reset a tracked ability by clicking on the ' 'reset icon.')) feature = features.FeatureAddModal(browser) features_table = features.FeaturesTable(browser) tracked_table = tracked.TrackedTable(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() feature.add.click() tracked_table.tracked1_used_up.click() assert tracked_table.tracked1_used.text.strip() == '1' tracked_table.tracked1_refresh.click() assert tracked_table.tracked1_used.text.strip() == '0'
def test_tracked_increase_decrease(player_wizard, browser): # noqa """As a player, I can increase or decrease tracked abilities with the stepper widget and the bar reflects these changes.""" print(('As a player, I can increase or decrease tracked abilities with ' 'the stepper widget and the bar reflects these changes.')) feature = features.FeatureAddModal(browser) features_table = features.FeaturesTable(browser) tracked_table = tracked.TrackedTable(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() feature.add.click() tracked_table.tracked1_used_up.click() assert tracked_table.tracked1_used.text.strip() == '1' tracked_table.tracked1_used_down.click() assert tracked_table.tracked1_used.text.strip() == '0'
def test_add_feat(player_wizard, browser): # noqa """As a player, I can add a feat.""" print('As a player, I can add a feat.') feat = feats.FeatAddModal(browser) feats_table = feats.FeatsTable(browser) tracked_table = tracked.TrackedTable(browser) tabs = Tabs(browser) tabs.skills.click() feats_table.add.click() feat.name = 'Add Name' feat.description = 'Add Description' feat.tracked.click() feat.max_ = 4 feat.short_rest.click() assert feat.name.get_attribute('value').strip() == 'Add Name' assert feat.description.get_attribute('value').strip() == 'Add Description' assert feat.max_.get_attribute('value').strip() == '4' assert 'active' in feat.short_rest.get_attribute('class').strip() feat.add.click() WebDriverWait(browser, DEFAULT_WAIT_TIME).until(table_has_data(feats_table)) row = ut.get_table_row(feats_table, 'table', 1) assert tracked_table.tracked1_name.text.strip() == 'Add Name' assert tracked_table.tracked1_max.text.strip() == '4' assert row.feat.strip() == 'Add Name'
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() 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'
def test_add_feature(player_wizard, browser): # noqa """As a player, I can add a feature.""" print('As a player, I can add a feature.') feature = features.FeatureAddModal(browser) features_table = features.FeaturesTable(browser) tracked_table = tracked.TrackedTable(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() assert feature.name.get_attribute('value').strip() == 'Add Name' assert feature.class_.get_attribute('value').strip() == 'Add Class' assert feature.level.get_attribute('value').strip() == '1' assert feature.description.get_attribute( 'value').strip() == 'Add Description' assert feature.max_.get_attribute('value').strip() == '4' assert 'active' in feature.short_rest.get_attribute('class').strip() feature.add.click() 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'
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'