def test_org_rep_ctrl_functionality(self, bp: BasePage, op: OrganismPage): """ Tests that the controls for Organism Reproduction work as intended once an organism is loaded into the dish. :return: None. """ # Put ancestor in organism view op.go_to_organism() bp.click_freezer_item("@ancestor") bp.add_org_to_org_view() # Wait for ancestor to be in org view, ensure initial values sensible. op.wait_until_org_controls_enabled() assert op.get_cycle() == 0 # Test that forward and back options work. op.forward_org_rep() assert op.get_cycle() == 1 op.back_org_rep() assert op.get_cycle() == 0 # Test that running works. op.run_org_rep() op.util.sleep(1) assert op.get_cycle() > 0 # Test that pausing works. op.stop_org_rep() cycle = op.get_cycle() op.util.sleep(1) assert op.get_cycle() == cycle # Test that End goes to end of reproduction. op.end_org_rep() assert op.get_cycle() == 189 # Test that Reset goes back to 0. op.reset_org_rep() assert op.get_cycle() == 0
def test_org_rep_stats_functionality(self, bp: BasePage, op: OrganismPage): """ Tests that the controls for Organism Reproduction work as intended when an organism that can perform all functions is added to the dish. :return: None. """ # Put all_functions in organism view op.go_to_organism() bp.click_freezer_item("@all_functions") bp.add_org_to_org_view() # Wait for ancestor to be in org view, ensure initial values sensible. op.wait_until_org_controls_enabled() # Make sure at beginning of reproduction, all stats 0. assert op.get_org_num_not_performed() == 0 assert op.get_org_num_nan_performed() == 0 assert op.get_org_num_and_performed() == 0 assert op.get_org_num_orn_performed() == 0 assert op.get_org_num_oro_performed() == 0 assert op.get_org_num_ant_performed() == 0 assert op.get_org_num_nor_performed() == 0 assert op.get_org_num_xor_performed() == 0 assert op.get_org_num_equ_performed() == 0 # Go to end of reproduction. op.end_org_rep() # Assert that all functions have been performed. assert op.get_org_num_not_performed() == 1 assert op.get_org_num_nan_performed() == 1 assert op.get_org_num_and_performed() == 1 assert op.get_org_num_orn_performed() == 1 assert op.get_org_num_oro_performed() == 1 assert op.get_org_num_ant_performed() == 1 assert op.get_org_num_nor_performed() == 1 assert op.get_org_num_xor_performed() == 1 assert op.get_org_num_equ_performed() == 1