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_input_mut_over_thousand(self, bp: BasePage, pp: PopulationPage): """ Tests that crashes and unexpected behavior do not occur if bad input is given to the population mutation rate boxes. :return: None. """ # Edit pop mutation rate with value over 1000. pp.show_env_settings() pp.edit_mut_rate("5000") pp.hide_env_settings() assert pp.check_mutation_rate_error() # Add an organism to the dish and try to run it. bp.click_freezer_item("@ancestor") bp.add_org_to_exp() pp.run_from_pop() # Wait a short period so that response to run attempt occurs. bp.util.sleep(3)
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