def test_armor_sorting(player_wizard, browser): # noqa """As a player, I can sort the armor table by clicking on the sortable columns.""" print( 'As a player, I can sort the armor table by clicking on the sortable columns' ) armor_add = armor.ArmorAddModal(browser) armor_table = armor.ArmorTable(browser) tabs = Tabs(browser) tabs.equipment.click() armor_table.add.click() ut.select_from_autocomplete(armor_add, 'name', '', browser) armor_add.add.click() time.sleep(.3) armor_table.add.click() ut.select_from_autocomplete(armor_add, 'name', '', browser, arrow_down_count=2) armor_add.add.click() time.sleep(.3) armor_table.armor_header.click() time.sleep(.3) rows = ut.get_table_row(armor_table, 'table', values=False) assert rows[1].text.strip() == 'Chain mail' time.sleep(.3) armor_table.type_header.click() time.sleep(.3) rows = ut.get_table_row(armor_table, 'table', values=False) assert rows[2].text.strip() == 'Heavy'
def test_edit_magic_items(player_wizard, browser): # noqa """As a player, I can edit an item in my magic_items.""" print('As a player, I can edit an item in my magic_items.') magic_items_add = magic_items.MagicItemsAddModal(browser) magic_items_edit = magic_items.MagicItemsEditModal(browser) magic_items_table = magic_items.MagicItemsTable(browser) magic_items_tabs = magic_items.MagicItemsModalTabs(browser) tabs = Tabs(browser) tabs.inventory.click() magic_items_table.add.click() ut.select_from_autocomplete(magic_items_add, 'item', '', browser) magic_items_add.add.click() rows = ut.get_table_rows(magic_items_table, 'table', values=False) time.sleep(.3) rows[0][0].click() time.sleep(.3) magic_items_tabs.edit.click() time.sleep(.3) magic_items_edit.item = 'Edit Name' magic_items_edit.type_ = 'Edit Armor' magic_items_edit.rarity = 'Edit Rare' magic_items_edit.max_charges = 3 magic_items_edit.charges = 3 magic_items_edit.weight = 100 magic_items_edit.requires_attunement.click() magic_items_edit.attuned.click() magic_items_edit.description = 'Edit Description' assert magic_items_edit.item.get_attribute('value') == 'Edit Name' assert magic_items_edit.type_.get_attribute('value') == 'Edit Armor' assert magic_items_edit.rarity.get_attribute('value') == 'Edit Rare' assert magic_items_edit.max_charges.get_attribute('value') == '3' assert magic_items_edit.charges.get_attribute('value') == '3' assert magic_items_edit.weight.get_attribute('value') == '100' assert magic_items_edit.requires_attunement.is_selected() assert magic_items_edit.attuned.is_selected() assert magic_items_edit.description.get_attribute( 'value') == 'Edit Description' magic_items_edit.done.click() time.sleep(.3) row = ut.get_table_row(magic_items_table, 'table', 1) assert row.magic_item == 'Edit Name' assert row.charges == '3' assert row.weight == '100 lbs.' assert row.description == 'Edit Description' row = ut.get_table_row(magic_items_table, 'table', 1, values=False) assert row[2].find_element_by_tag_name('input').is_selected()
def test_magic_items_sorting(player_wizard, browser): # noqa """As a player, I can sort the magic_items table by clicking on the sortable columns.""" print( 'As a player, I can sort the magic_items table by clicking on the sortable columns' ) magic_items_add = magic_items.MagicItemsAddModal(browser) magic_items_table = magic_items.MagicItemsTable(browser) tabs = Tabs(browser) tabs.inventory.click() magic_items_table.add.click() ut.select_from_autocomplete(magic_items_add, 'item', '', browser) magic_items_add.weight = 100 magic_items_add.add.click() time.sleep(.3) magic_items_table.add.click() ut.select_from_autocomplete(magic_items_add, 'item', '', browser, arrow_down_count=2) magic_items_add.max_charges = 2 magic_items_add.charges = 1 magic_items_add.add.click() time.sleep(.3) magic_items_table.magic_item_header.click() time.sleep(.3) rows = ut.get_table_row(magic_items_table, 'table', values=False) assert rows[0].text.strip() == 'Amulet of Health' time.sleep(.3) magic_items_table.charges_header.click() time.sleep(.3) rows = ut.get_table_row(magic_items_table, 'table', values=False) assert rows[1].text.strip() == 'N/A' time.sleep(.3) magic_items_table.weight_header.click() time.sleep(.3) rows = ut.get_table_row(magic_items_table, 'table', values=False) assert rows[3].text.strip() == '0 lbs.' time.sleep(.3) magic_items_table.weight_header.click() time.sleep(.3) rows = ut.get_table_row(magic_items_table, 'table', values=False) assert rows[3].text.strip() == '100 lbs.'
def test_weapon_persists(player_wizard, browser): # noqa """As a player, all fields for weapon persist after page refresh.""" print('As a player, all fields for weapon persist after page refresh.') weapon_add = weapon.WeaponAddModal(browser) weapon_edit = weapon.WeaponEditModal(browser) weapon_table = weapon.WeaponTable(browser) weapon_tabs = weapon.WeaponModalTabs(browser) tabs = Tabs(browser) tabs.equipment.click() weapon_table.add.click() ut.select_from_autocomplete(weapon_add, 'name', '', browser) weapon_add.add.click() browser.refresh() row = ut.get_table_row(weapon_table, 'table', 1) assert row.weapon.strip() == 'Battleaxe' assert row.to_hit == '+ 6' assert row.damage == '1d8 or 1d10' assert row.damage_type == 'Slashing' assert row.range == '5 ft.' assert row.property == 'Versatile' assert row.quantity == '1' row = ut.get_table_row(weapon_table, 'table', values=False) time.sleep(.3) row[0].click() time.sleep(.3) weapon_tabs.edit.click() assert weapon_edit.name.get_attribute('value') == 'Battleaxe' assert weapon_edit.damage.get_attribute('value') == '1d8 or 1d10' assert weapon_edit.magical_modifier.get_attribute('value') == '0' assert weapon_edit.to_hit_modifier.get_attribute('value') == '0' assert weapon_edit.type_.get_attribute('value') == 'Melee' assert weapon_edit.handedness.get_attribute('value') == 'One or Two Handed' assert weapon_edit.proficiency.get_attribute('value') == 'Martial' assert weapon_edit.price.get_attribute('value') == '10' assert weapon_edit.currency_denomination.get_attribute('value') == 'GP' assert weapon_edit.weight.get_attribute('value') == '4' assert weapon_edit.range_.get_attribute('value') == '' assert weapon_edit.damage_type.get_attribute('value') == 'Slashing' assert weapon_edit.property_.get_attribute('value') == 'Versatile' assert weapon_edit.quantity.get_attribute('value') == '1' assert weapon_edit.description.get_attribute('value') == ''
def test_add_inventory(player_wizard, browser): # noqa """As a player, I can add an item to my inventory.""" print('As a player, I can add an item to my inventory.') inventory_add = inventory.InventoryAddModal(browser) inventory_table = inventory.InventoryTable(browser) tabs = Tabs(browser) tabs.inventory.click() inventory_table.add.click() inventory_add.name = 'Add Name' inventory_add.weight = 100 inventory_add.quantity = 2 inventory_add.cost = 100 inventory_add.currency_denomination = 'GP' inventory_add.description = 'Add Description' assert inventory_add.name.get_attribute('value') == 'Add Name' assert inventory_add.weight.get_attribute('value') == '100' assert inventory_add.quantity.get_attribute('value') == '2' assert inventory_add.cost.get_attribute('value') == '100' assert inventory_add.currency_denomination.get_attribute('value') == 'GP' assert inventory_add.description.get_attribute( 'value') == 'Add Description' inventory_add.add.click() row = ut.get_table_row(inventory_table, 'table', 1) assert row.item == 'Add Name' assert row.quantity == '2' assert row.weight == '100 lbs.' assert row.cost == '100 GP' assert row.description == 'Add Description'
def test_preview_armor(player_wizard, browser): # noqa """As a player, I can select a row in the armor table and view the item in the preview tab.""" print( 'As a player, I can select a row in the armor table and view the item in the preview tab' ) armor_add = armor.ArmorAddModal(browser) armor_table = armor.ArmorTable(browser) armor_preview = armor.ArmorPreviewModal(browser) tabs = Tabs(browser) tabs.equipment.click() armor_table.add.click() ut.select_from_autocomplete(armor_add, 'name', '', browser) armor_add.add.click() time.sleep(.3) row = ut.get_table_row(armor_table, 'table', values=False) time.sleep(.3) row[0].click() time.sleep(.5) assert armor_preview.name.text == 'Breastplate' assert armor_preview.summary.text == 'AC 14' assert armor_preview.weight.text == 'Weight: 20 lbs.' assert armor_preview.stealth.text == 'Stealth: Normal' assert 'metal chest piece' in armor_preview.description.text
def test_preview_magic_items(player_wizard, browser): # noqa """As a player, I can select a row in the magic_items table and view the item in the preview tab.""" print( 'As a player, I can select a row in the magic_items table and view the item in the preview tab' ) magic_items_add = magic_items.MagicItemsAddModal(browser) magic_items_table = magic_items.MagicItemsTable(browser) magic_items_preview = magic_items.MagicItemsPreviewModal(browser) tabs = Tabs(browser) tabs.inventory.click() magic_items_table.add.click() ut.select_from_autocomplete(magic_items_add, 'item', '', browser) magic_items_add.add.click() time.sleep(.3) row = ut.get_table_row(magic_items_table, 'table', values=False) time.sleep(.3) row[0].click() time.sleep(.5) assert magic_items_preview.item.text == 'Adamantine Armor' assert magic_items_preview.rarity.text == 'Uncommon' assert magic_items_preview.type_.text == 'Type: Armor (medium or heavy but not hide)' assert magic_items_preview.max_charges.text == 'Max Charges: 0' assert magic_items_preview.weight.text == 'Weight: 0 lbs.' assert 'reinforced with adamantine' in magic_items_preview.description.text
def test_preview_inventory(player_wizard, browser): # noqa """As a player, I can select a row in the inventory table and view the item in the preview tab.""" print( 'As a player, I can select a row in the inventory table and view the item in the preview tab' ) inventory_add = inventory.InventoryAddModal(browser) inventory_table = inventory.InventoryTable(browser) inventory_preview = inventory.InventoryPreviewModal(browser) tabs = Tabs(browser) tabs.inventory.click() inventory_table.add.click() ut.select_from_autocomplete(inventory_add, 'name', '', browser) inventory_add.add.click() time.sleep(.3) row = ut.get_table_row(inventory_table, 'table', values=False) time.sleep(.3) row[0].click() time.sleep(.5) assert inventory_preview.name.text == 'Abacus' assert inventory_preview.weight.text == '2 lbs.' assert inventory_preview.quantity.text == '1' assert inventory_preview.cost.text == '2 GP' assert inventory_preview.description.text == 'Add a description via the edit tab.'
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) 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_.clear() trait.max_ = 4 trait.short_rest.click() assert trait.name.get_attribute('value') == 'Add Name' assert trait.race.get_attribute('value') == 'Add Race' assert trait.description.get_attribute('value') == 'Add Description' assert trait.max_.get_attribute('value') == '4' assert 'active' in trait.short_rest.get_attribute('class') trait.add.click() row = ut.get_table_row(traits_table, 'table', 1) assert row.race == 'Add Race' assert row.trait == 'Add Name'
def test_preview_weapon(player_wizard, browser): # noqa """As a player, I can select a row in the weapon table and view the item in the preview tab.""" print( 'As a player, I can select a row in the weapon table and view the item in the preview tab' ) weapon_add = weapon.WeaponAddModal(browser) weapon_table = weapon.WeaponTable(browser) weapon_preview = weapon.WeaponPreviewModal(browser) tabs = Tabs(browser) tabs.equipment.click() weapon_table.add.click() ut.select_from_autocomplete(weapon_add, 'name', '', browser) weapon_add.add.click() time.sleep(.3) row = ut.get_table_row(weapon_table, 'table', values=False) time.sleep(.3) row[0].click() time.sleep(.5) assert weapon_preview.name.text == 'Battleaxe' assert weapon_preview.magical_modifier.text == '' assert weapon_preview.damage.text == '1d8 or 1d10' assert weapon_preview.to_hit_modifier.text == '0' assert weapon_preview.range_.text == '5 ft.' assert weapon_preview.type_.text == 'Melee' assert weapon_preview.proficiency.text == 'Martial' assert weapon_preview.handedness.text == 'One or Two Handed' assert weapon_preview.weight.text == '4 lbs.' assert weapon_preview.range_.text == '5 ft.' assert weapon_preview.damage_type.text == 'Slashing' assert weapon_preview.property_.text == 'Versatile' assert '' in weapon_preview.description.text
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) tabs = Tabs(browser) tabs.skills.click() feats_table.add.click() feat.name = 'Add Name' feat.description = 'Add Description' feat.tracked.click() feat.max_.clear() feat.max_ = 4 feat.short_rest.click() assert feat.name.get_attribute('value') == 'Add Name' assert feat.description.get_attribute('value') == 'Add Description' assert feat.max_.get_attribute('value') == '4' assert 'active' in feat.short_rest.get_attribute('class') feat.add.click() row = ut.get_table_row(feats_table, 'table', 1) assert row.feat == 'Add Name'
def test_magic_items_persists(player_wizard, browser): # noqa """As a player, all fields for magic_items persist after page refresh.""" print( 'As a player, all fields for magic_items persist after page refresh.') magic_items_add = magic_items.MagicItemsAddModal(browser) magic_items_edit = magic_items.MagicItemsEditModal(browser) magic_items_table = magic_items.MagicItemsTable(browser) magic_items_tabs = magic_items.MagicItemsModalTabs(browser) tabs = Tabs(browser) tabs.inventory.click() magic_items_table.add.click() ut.select_from_autocomplete(magic_items_add, 'item', '', browser) magic_items_add.add.click() browser.refresh() row = ut.get_table_row(magic_items_table, 'table', 1) assert row.magic_item.strip() == 'Adamantine Armor' assert row.charges == 'N/A' assert row.weight == '0 lbs.' assert 'with adamantine' in row.description row = ut.get_table_row(magic_items_table, 'table', 1, values=False) assert row[2].find_element_by_tag_name('input').is_displayed() is False row = ut.get_table_row(magic_items_table, 'table', values=False) time.sleep(.3) row[0].click() time.sleep(.3) magic_items_tabs.edit.click() assert magic_items_edit.item.get_attribute('value') == 'Adamantine Armor' assert magic_items_edit.type_.get_attribute( 'value') == 'Armor (medium or heavy but not hide)' assert magic_items_edit.rarity.get_attribute('value') == 'Uncommon' assert magic_items_edit.max_charges.get_attribute('value') == '0' assert magic_items_edit.charges.get_attribute('value') == '0' assert magic_items_edit.weight.get_attribute('value') == '0' assert magic_items_edit.requires_attunement.is_selected() is False assert magic_items_edit.attuned.is_selected() is False assert 'reinforced with adamantine' in magic_items_edit.description.get_attribute( 'value')
def test_inventory_sorting(player_wizard, browser): # noqa """As a player, I can sort the inventory table by clicking on the sortable columns.""" print( 'As a player, I can sort the inventory table by clicking on the sortable columns' ) inventory_add = inventory.InventoryAddModal(browser) inventory_table = inventory.InventoryTable(browser) tabs = Tabs(browser) tabs.inventory.click() inventory_table.add.click() ut.select_from_autocomplete(inventory_add, 'name', '', browser) inventory_add.add.click() time.sleep(.3) inventory_table.add.click() ut.select_from_autocomplete(inventory_add, 'name', '', browser, arrow_down_count=2) inventory_add.add.click() time.sleep(.3) inventory_table.item_header.click() time.sleep(.3) rows = ut.get_table_row(inventory_table, 'table', values=False) assert rows[0].text.strip() == 'Acid (vial)' time.sleep(.3) inventory_table.quantity_header.click() time.sleep(.3) rows = ut.get_table_row(inventory_table, 'table', values=False) assert rows[1].text.strip() == '1' time.sleep(.3) inventory_table.weight_header.click() time.sleep(.3) rows = ut.get_table_row(inventory_table, 'table', values=False) assert rows[2].text.strip() == '1 lbs.'
def test_add_magic_items(player_wizard, browser): # noqa """As a player, I can add an item to my magic_items.""" print('As a player, I can add an item to my magic_items.') magic_items_add = magic_items.MagicItemsAddModal(browser) magic_items_table = magic_items.MagicItemsTable(browser) tabs = Tabs(browser) tabs.inventory.click() magic_items_table.add.click() magic_items_add.item = 'Add Name' magic_items_add.type_ = 'Add Armor' magic_items_add.rarity = 'Add Rare' magic_items_add.max_charges = 3 magic_items_add.charges = 3 magic_items_add.weight = 100 magic_items_add.requires_attunement.click() magic_items_add.attuned.click() magic_items_add.description = 'Add Description' assert magic_items_add.item.get_attribute('value') == 'Add Name' assert magic_items_add.type_.get_attribute('value') == 'Add Armor' assert magic_items_add.rarity.get_attribute('value') == 'Add Rare' assert magic_items_add.max_charges.get_attribute('value') == '3' assert magic_items_add.charges.get_attribute('value') == '3' assert magic_items_add.weight.get_attribute('value') == '100' assert magic_items_add.requires_attunement.is_selected() assert magic_items_add.attuned.is_selected() assert magic_items_add.description.get_attribute( 'value') == 'Add Description' magic_items_add.add.click() row = ut.get_table_row(magic_items_table, 'table', 1) assert row.magic_item == 'Add Name' assert row.charges == '3' assert row.weight == '100 lbs.' assert row.description == 'Add Description' row = ut.get_table_row(magic_items_table, 'table', 1, values=False) assert row[2].find_element_by_tag_name('input').is_selected()
def test_armor_persists(player_wizard, browser): # noqa """As a player, all fields for armor persist after page refresh.""" print('As a player, all fields for armor persist after page refresh.') armor_add = armor.ArmorAddModal(browser) armor_edit = armor.ArmorEditModal(browser) armor_table = armor.ArmorTable(browser) armor_tabs = armor.ArmorModalTabs(browser) tabs = Tabs(browser) tabs.equipment.click() armor_table.add.click() ut.select_from_autocomplete(armor_add, 'name', '', browser) armor_add.add.click() browser.refresh() row = ut.get_table_row(armor_table, 'table', 1) assert row.armor.strip() == 'Breastplate' assert row.armor_class == '14' assert row.type == 'Medium' row = ut.get_table_row(armor_table, 'table', values=False) time.sleep(.3) row[0].click() time.sleep(.3) armor_tabs.edit.click() assert armor_edit.name.get_attribute('value') == 'Breastplate' assert armor_edit.armor_class.get_attribute('value') == '14' assert armor_edit.type_.get_attribute('value') == 'Medium' assert armor_edit.magical_modifier.get_attribute('value') == '0' assert armor_edit.price.get_attribute('value') == '400' assert armor_edit.currency_denomination.get_attribute('value') == 'GP' assert armor_edit.weight.get_attribute('value') == '20' assert armor_edit.armor_class.get_attribute('value') == '14' assert armor_edit.stealth.get_attribute('value') == 'Normal' assert 'armor consists of' in armor_edit.description.get_attribute('value')
def test_add_weapon(player_wizard, browser): # noqa """As a player, I can add a weapon.""" print('As a player, I can add a weapon.') weapon_add = weapon.WeaponAddModal(browser) weapon_table = weapon.WeaponTable(browser) tabs = Tabs(browser) tabs.equipment.click() weapon_table.add.click() weapon_add.name = 'Add Name' weapon_add.damage = 'Add Damage' weapon_add.magical_modifier = 1 weapon_add.to_hit_modifier = 2 weapon_add.type_ = 'Ranged' weapon_add.handedness = 'Add Handedness' weapon_add.proficiency = 'Add Proficiency' weapon_add.price = 200 weapon_add.currency_denomination = 'GP' weapon_add.weight = 100 weapon_add.range_ = '20/40' weapon_add.damage_type = 'Add Damage Type' weapon_add.property_ = 'Add Property' weapon_add.quantity = 2 weapon_add.description = 'Add Description' assert weapon_add.name.get_attribute('value') == 'Add Name' assert weapon_add.damage.get_attribute('value') == 'Add Damage' assert weapon_add.magical_modifier.get_attribute('value') == '1' assert weapon_add.to_hit_modifier.get_attribute('value') == '2' assert weapon_add.handedness.get_attribute('value') == 'Add Handedness' assert weapon_add.proficiency.get_attribute('value') == 'Add Proficiency' assert weapon_add.price.get_attribute('value') == '200' assert weapon_add.currency_denomination.get_attribute('value') == 'GP' assert weapon_add.weight.get_attribute('value') == '100' assert weapon_add.range_.get_attribute('value') == '20/40' assert weapon_add.damage_type.get_attribute('value') == 'Add Damage Type' assert weapon_add.property_.get_attribute('value') == 'Add Property' assert weapon_add.quantity.get_attribute('value') == '2' assert weapon_add.description.get_attribute('value') == 'Add Description' weapon_add.add.click() row = ut.get_table_row(weapon_table, 'table', 1) assert row.weapon == 'Add Name + 1' assert row.to_hit == '+ 9' assert row.damage == 'Add Damage' assert row.damage_type == 'Add Damage Type' assert row.range == '20/40 ft.' assert row.property == 'Add Property' assert row.quantity == '2'
def test_edit_feature(player_wizard, browser): # noqa """As a player, I can edit a feature.""" print('As a player, I can edit a feature.') feature = features.FeatureAddModal(browser) feature_edit = features.FeatureEditModal(browser) features_table = features.FeaturesTable(browser) feature_tabs = features.FeatureModalTabs(browser) tabs = Tabs(browser) tabs.skills.click() features_table.add.click() ut.select_from_autocomplete(feature, 'name', '', browser) feature.add.click() rows = ut.get_table_rows(features_table, 'table', values=False) time.sleep(.3) rows[0][0].click() time.sleep(.3) feature_tabs.edit.click() feature_edit.name.clear() feature_edit.class_.clear() feature_edit.level.clear() feature_edit.description.clear() feature_edit.name = 'Edited Name' feature_edit.class_ = 'Edited Class' feature_edit.level = 1 feature_edit.description = 'Edited Description' feature_edit.tracked.click() feature_edit.max_.clear() feature_edit.max_ = 4 feature_edit.short_rest.click() assert feature_edit.name.get_attribute('value') == 'Edited Name' assert feature_edit.class_.get_attribute('value') == 'Edited Class' assert feature_edit.level.get_attribute('value') == '1' assert feature_edit.description.get_attribute( 'value') == 'Edited Description' assert feature_edit.max_.get_attribute('value') == '4' assert 'active' in feature_edit.short_rest.get_attribute('class') feature_edit.done.click() rows = ut.get_table_rows(features_table, 'table', values=False) time.sleep(.3) row = ut.get_table_row(features_table, 'table', 1) assert row.feature == 'Edited Name' assert row.class_ == 'Edited Class'
def test_inventory_persists(player_wizard, browser): # noqa """As a player, all fields for inventory persist after page refresh.""" print('As a player, all fields for inventory persist after page refresh.') inventory_add = inventory.InventoryAddModal(browser) inventory_edit = inventory.InventoryEditModal(browser) inventory_table = inventory.InventoryTable(browser) inventory_tabs = inventory.InventoryModalTabs(browser) tabs = Tabs(browser) tabs.inventory.click() inventory_table.add.click() ut.select_from_autocomplete(inventory_add, 'name', '', browser) inventory_add.add.click() browser.refresh() row = ut.get_table_row(inventory_table, 'table', 1) assert row.item.strip() == 'Abacus' assert row.weight == '2 lbs.' assert row.quantity == '1' assert row.cost == '2 GP' assert row.description == '' row = ut.get_table_row(inventory_table, 'table', values=False) time.sleep(.3) row[0].click() time.sleep(.3) inventory_tabs.edit.click() assert inventory_edit.name.get_attribute('value') == 'Abacus' assert inventory_edit.weight.get_attribute('value') == '2' assert inventory_edit.quantity.get_attribute('value') == '1' assert inventory_edit.cost.get_attribute('value') == '2' assert inventory_edit.currency_denomination.get_attribute('value') == 'GP' assert inventory_edit.description.get_attribute('value') == ''
def test_edit_armor(player_wizard, browser): # noqa """As a player, I can edit an armor.""" print('As a player, I can edit an armor.') armor_add = armor.ArmorAddModal(browser) armor_edit = armor.ArmorEditModal(browser) armor_table = armor.ArmorTable(browser) armor_tabs = armor.ArmorModalTabs(browser) tabs = Tabs(browser) tabs.equipment.click() armor_table.add.click() ut.select_from_autocomplete(armor_add, 'name', '', browser) armor_add.add.click() rows = ut.get_table_rows(armor_table, 'table', values=False) time.sleep(.3) rows[0][0].click() time.sleep(.3) armor_tabs.edit.click() time.sleep(.3) armor_edit.name = 'Edit Name' armor_edit.type_ = 'Edit Type' armor_edit.magical_modifier = 2 armor_edit.price = 300 armor_edit.currency_denomination = 'EP' armor_edit.weight = 200 armor_edit.armor_class = 16 armor_edit.stealth = 'Advantage\t' armor_edit.doff.click() armor_edit.description = 'Edit Description' assert armor_edit.name.get_attribute('value') == 'Edit Name' assert armor_edit.type_.get_attribute('value') == 'Edit Type' assert armor_edit.magical_modifier.get_attribute('value') == '2' assert armor_edit.price.get_attribute('value') == '300' assert armor_edit.currency_denomination.get_attribute('value') == 'EP' assert armor_edit.weight.get_attribute('value') == '200' assert armor_edit.armor_class.get_attribute('value') == '16' assert armor_edit.stealth.get_attribute('value') == 'Advantage' assert 'active' in armor_add.doff.get_attribute('class') assert armor_edit.description.get_attribute('value') == 'Edit Description' armor_edit.done.click() time.sleep(.3) row = ut.get_table_row(armor_table, 'table', 1) assert row.armor == 'Edit Name + 2' assert row.armor_class == '16' assert row.type == 'Edit Type'
def test_edit_trait(player_wizard, browser): # noqa """As a player, I can edit a trait.""" print('As a player, I can edit a trait.') trait = traits.TraitAddModal(browser) trait_edit = traits.TraitEditModal(browser) traits_table = traits.TraitsTable(browser) trait_tabs = traits.TraitModalTabs(browser) tabs = Tabs(browser) tabs.skills.click() traits_table.add.click() ut.select_from_autocomplete(trait, 'name', '', browser) trait.add.click() rows = ut.get_table_rows(traits_table, 'table', values=False) time.sleep(.3) rows[0][0].click() time.sleep(.3) trait_tabs.edit.click() trait_edit.name.clear() trait_edit.race.clear() trait_edit.description.clear() trait_edit.name = 'Edited Name' trait_edit.race = 'Edited Race' trait_edit.description = 'Edited Description' trait_edit.tracked.click() trait_edit.max_.clear() trait_edit.max_ = 4 trait_edit.short_rest.click() assert trait_edit.name.get_attribute('value') == 'Edited Name' assert trait_edit.race.get_attribute('value') == 'Edited Race' assert trait_edit.description.get_attribute( 'value') == 'Edited Description' assert trait_edit.max_.get_attribute('value') == '4' assert 'active' in trait_edit.short_rest.get_attribute('class') trait_edit.done.click() rows = ut.get_table_rows(traits_table, 'table', values=False) time.sleep(.3) row = ut.get_table_row(traits_table, 'table', 1) assert row.trait == 'Edited Name' assert row.race == 'Edited Race'
def test_edit_inventory(player_wizard, browser): # noqa """As a player, I can edit an item in my inventory.""" print('As a player, I can edit an item in my inventory.') inventory_add = inventory.InventoryAddModal(browser) inventory_edit = inventory.InventoryEditModal(browser) inventory_table = inventory.InventoryTable(browser) inventory_tabs = inventory.InventoryModalTabs(browser) tabs = Tabs(browser) tabs.inventory.click() inventory_table.add.click() ut.select_from_autocomplete(inventory_add, 'name', '', browser) inventory_add.add.click() rows = ut.get_table_rows(inventory_table, 'table', values=False) time.sleep(.3) rows[0][0].click() time.sleep(.3) inventory_tabs.edit.click() time.sleep(.3) inventory_edit.name = 'Edit Name' inventory_edit.weight = 100 inventory_edit.quantity = 2 inventory_edit.cost = 100 inventory_edit.currency_denomination = 'GP' inventory_edit.description = 'Edit Description' assert inventory_edit.name.get_attribute('value') == 'Edit Name' assert inventory_edit.weight.get_attribute('value') == '100' assert inventory_edit.quantity.get_attribute('value') == '2' assert inventory_edit.cost.get_attribute('value') == '100' assert inventory_edit.currency_denomination.get_attribute('value') == 'GP' assert inventory_edit.description.get_attribute( 'value') == 'Edit Description' inventory_edit.done.click() time.sleep(.3) row = ut.get_table_row(inventory_table, 'table', 1) assert row.item == 'Edit Name' assert row.quantity == '2' assert row.weight == '100 lbs.' assert row.cost == '100 GP' assert row.description == 'Edit Description'
def test_feat_ogl_pre_pop(player_wizard, browser): # noqa """As a player, if I select from feat name field, OGL data auto-completes and the remaining fields pre-populate.""" print( 'As a player, if I select from feat name field, OGL data auto-completes and the remaining fields pre-populate.' ) feat = feats.FeatAddModal(browser) feats_table = feats.FeatsTable(browser) tabs = Tabs(browser) tabs.skills.click() feats_table.add.click() ut.select_from_autocomplete(feat, 'name', '', browser) feat.add.click() row = ut.get_table_row(feats_table, 'table', 1) assert row.feat == 'Grappler'
def test_trait_ogl_pre_pop(player_wizard, browser): # noqa """As a player, if I select from trait name field, OGL data auto-completes and the remaining fields pre-populate.""" print( 'As a player, if I select from trait name field, OGL data auto-completes and the remaining fields pre-populate.' ) trait = traits.TraitAddModal(browser) traits_table = traits.TraitsTable(browser) tabs = Tabs(browser) tabs.skills.click() traits_table.add.click() ut.select_from_autocomplete(trait, 'name', '', browser) trait.add.click() row = ut.get_table_row(traits_table, 'table', 1) assert row.race == 'Dragonborn' assert row.trait == 'Ability Score Increase'
def test_proficiency_ogl_pre_pop(player_wizard, browser): # noqa """As a player, if I select from proficiency name field, OGL data auto-completes and the remaining fields pre-populate.""" print( 'As a player, if I select from proficiency name field, OGL data auto-completes and the remaining fields pre-populate.' ) proficiency_add = proficiency.ProficiencyAddModal(browser) proficiency_table = proficiency.ProficiencyTable(browser) tabs = Tabs(browser) tabs.skills.click() proficiency_table.add.click() ut.select_from_autocomplete(proficiency_add, 'name', '', browser) proficiency_add.add.click() row = ut.get_table_row(proficiency_table, 'table', 1) assert row.type == 'Languages' assert row.proficiency == 'Abyssal'
def test_armor_donned(player_wizard, browser): # noqa """As a player, the checkbox appears when armor is donned.""" print('As a player, the checkbox appears when armor is donned.') armor_add = armor.ArmorAddModal(browser) armor_table = armor.ArmorTable(browser) tabs = Tabs(browser) tabs.equipment.click() armor_table.add.click() armor_add.name = 'Add Name' armor_add.don.click() time.sleep(.5) armor_add.add.click() time.sleep(.5) row = ut.get_table_row(armor_table, 'table', 1, values=False) assert 'fa fa-check' in row[0].find_element_by_tag_name( 'span').get_attribute('class')
def test_magical_modifier(player_wizard, browser): # noqa """As a player, if armor is magical, a badge indicating the modifier is present.""" print( 'As a player, if armor is magical, a badge indicating the modifier is present.' ) armor_add = armor.ArmorAddModal(browser) armor_table = armor.ArmorTable(browser) tabs = Tabs(browser) tabs.equipment.click() armor_table.add.click() armor_add.name = 'Add Name' armor_add.magical_modifier = 3 armor_add.add.click() time.sleep(.5) row = ut.get_table_row(armor_table, 'table', 1) assert row.armor == 'Add Name + 3'
def test_armor_ogl_pre_pop(player_wizard, browser): # noqa """As a player, if I select from armor name field, OGL data auto-completes and the remaining fields pre-populate.""" print( 'As a player, if I select from armor name field, OGL data auto-completes and the remaining fields pre-populate.' ) armor_add = armor.ArmorAddModal(browser) armor_table = armor.ArmorTable(browser) tabs = Tabs(browser) tabs.equipment.click() armor_table.add.click() ut.select_from_autocomplete(armor_add, 'name', '', browser) armor_add.add.click() row = ut.get_table_row(armor_table, 'table', 1) assert row.armor.strip() == 'Breastplate' assert row.armor_class == '14' assert row.type == 'Medium'
def test_weapon_magical_modifier(player_wizard, browser): # noqa """As a player, if weapon is magical, a badge indicating the modifier is present.""" print( 'As a player, if weapon is magical, a badge indicating the modifier is present.' ) weapon_add = weapon.WeaponAddModal(browser) weapon_table = weapon.WeaponTable(browser) tabs = Tabs(browser) tabs.equipment.click() weapon_table.add.click() weapon_add.name = 'Add Name' weapon_add.magical_modifier = 3 weapon_add.add.click() time.sleep(.5) row = ut.get_table_row(weapon_table, 'table', 1) assert row.weapon == 'Add Name + 3'
def test_edit_proficiency(player_wizard, browser): # noqa """As a player, I can edit a proficiency.""" print('As a player, I can edit a proficiency.') proficiency_add = proficiency.ProficiencyAddModal(browser) proficiency_edit = proficiency.ProficiencyEditModal(browser) proficiency_table = proficiency.ProficiencyTable(browser) proficiency_tabs = proficiency.ProficiencyModalTabs(browser) tabs = Tabs(browser) tabs.skills.click() proficiency_table.add.click() ut.select_from_autocomplete(proficiency_add, 'name', '', browser) proficiency_add.add.click() rows = ut.get_table_rows(proficiency_table, 'table', values=False) time.sleep(.3) rows[0][0].click() time.sleep(.3) proficiency_tabs.edit.click() proficiency_edit.name.clear() proficiency_edit.type_.clear() proficiency_edit.description.clear() proficiency_edit.name = 'Edited Name' proficiency_edit.type_ = 'Edited Type' proficiency_edit.description = 'Edited Description' assert proficiency_edit.name.get_attribute('value') == 'Edited Name' assert proficiency_edit.type_.get_attribute('value') == 'Edited Type' assert proficiency_edit.description.get_attribute( 'value') == 'Edited Description' proficiency_edit.done.click() rows = ut.get_table_rows(proficiency_table, 'table', values=False) time.sleep(.3) row = ut.get_table_row(proficiency_table, 'table', 1) assert row.proficiency == 'Edited Name' assert row.type == 'Edited Type'
def test_melee_ft(player_wizard, browser): # noqa """As a player, if I add a melee weapon, the range of 5 ft. is assigned after I close the modal.""" print( 'As a player, if I add a melee weapon, the range of 5 ft. is assigned after I close the modal' ) weapon_add = weapon.WeaponAddModal(browser) weapon_table = weapon.WeaponTable(browser) tabs = Tabs(browser) tabs.equipment.click() weapon_table.add.click() weapon_add.name = 'Test name' weapon_add.type_ = 'Melee' time.sleep(.3) weapon_add.add.click() time.sleep(.3) row = ut.get_table_row(weapon_table, 'table', values=False) assert row[4].text == '5 ft.'