def test_2_confirm_no_network(): print( colored('Running: test_2_confirm_no_network - estimate: 40s', 'yellow')) prompt_to_disable_network() for i in range(3): print(colored('\trandom account ' + str(i + 1), 'magenta')) active_user_row = get_random_row_in_account_table() active_user_cols = active_user_row.find_elements_by_tag_name('td') click_action_button(active_user_cols) browser.find_element_by_id('delete-button').send_keys(Keys.ENTER) sleep(SLEEP_INTERVAL) browser.switch_to_alert().accept() sleep(9 + SLEEP_INTERVAL) print( colored( '\ttest_2_confirm_no_network: deletion failed - asserting...', 'blue')) confirmation = browser.switch_to_alert() assert 'Error occurred while deleting account' in confirmation.text confirmation.accept() browser.find_element_by_id('cancel-button').send_keys(Keys.ENTER) sleep(SLEEP_INTERVAL) print(colored('\ttest_2_confirm_no_network: passed.', 'cyan')) prompt_to_enable_network_and_setup(browser, 'Administration/ManageUser')
def test_2_delete_confirm_no_network(): print( colored( 'Running: test_2_delete_confirm_no_network - estimate: 27s', 'yellow')) prompt_to_disable_network() for i in range(2): print(colored('\trandom node ' + str(i + 1), 'magenta')) deleted_hex = get_random_node_and_delete() sleep(9 + SLEEP_INTERVAL) confirmation = browser.switch_to_alert() print( colored( '\ttest_2_delete_confirm_no_network: confirm delete no network - asserting...', 'blue')) assert "The device with Hex. Address " + deleted_hex + " will be lost permanently. Continue?" in confirmation.text confirmation.accept() sleep(2 * SLEEP_INTERVAL) deletion_result = browser.switch_to_alert() print( colored( '\ttest_2_delete_confirm_no_network: confirm delete no network - asserting...', 'blue')) assert "Error occurred while deleting device" in deletion_result.text confirmation.accept() sleep(SLEEP_INTERVAL) close_modal() print(colored('\ttest_2_delete_confirm_no_network: passed.', 'cyan')) prompt_to_enable_network_and_setup(browser, 'Factory/ManageDevice')
def test_2_delete_confirm_no_network(): print( colored( 'Running: test_2_delete_confirm_no_network - estimate: 13s', 'yellow')) prompt_to_disable_network() command = get_random_command_and_delete() confirmation = browser.switch_to_alert() print( colored( '\ttest_2_delete_confirm_no_network: confirm delete no network - asserting...', 'blue')) assert "The command " + command + " will be lost permanently. Continue?" in confirmation.text confirmation.accept() sleep(9 + SLEEP_INTERVAL) deletion_result = browser.switch_to_alert() print( colored( '\ttest_2_delete_confirm_no_network: confirm delete no network - asserting...', 'blue')) assert "Error occurred while deleting command" in deletion_result.text confirmation.accept() sleep(SLEEP_INTERVAL) close_modal() print(colored('\ttest_2_delete_confirm_no_network: passed.', 'cyan')) prompt_to_enable_network_and_setup(browser, 'Administration/GatewayCommand')
def test_2_confirm_no_network(): print( colored('Running: test_2_confirm_no_network - estimate: 40s', 'yellow')) prompt_to_disable_network() inactive_user_row = get_random_row_in_account_table(active=False) inactive_user_cols = inactive_user_row.find_elements_by_tag_name('td') click_action_button(inactive_user_cols) sleep(SLEEP_INTERVAL) browser.switch_to_alert().accept() sleep(9 + SLEEP_INTERVAL) print( colored( '\ttest_2_confirm_no_network: revival failed - asserting...', 'blue')) confirmation = browser.switch_to_alert() assert 'Error occurred while reviving account' in confirmation.text confirmation.accept() print(colored('\ttest_2_confirm_no_network: passed.', 'cyan')) prompt_to_enable_network_and_setup(browser, 'Administration/ManageUser')
def test_2_delete_confirm_no_network(): print( colored( 'Running: test_2_delete_confirm_no_network - estimate: 13s', 'yellow')) deleted_imei = get_random_gateway() prompt_to_disable_network() click_delete_button() confirmation = browser.switch_to_alert() print( colored( '\ttest_2_delete_confirm_no_network: confirm delete no network - asserting...', 'blue')) assert "The gateway with Imei " + deleted_imei + " will be lost permanently. Continue?" in confirmation.text confirmation.accept() sleep(9 + SLEEP_INTERVAL) deletion_result = browser.switch_to_alert() print( colored( '\ttest_2_delete_confirm_no_network: confirm delete no network - asserting...', 'blue')) assert "Error occurred while deleting gateway" in deletion_result.text confirmation.accept() sleep(SLEEP_INTERVAL) close_modal() print(colored('\ttest_2_delete_confirm_no_network: passed.', 'cyan')) prompt_to_enable_network_and_setup(browser, 'Factory/ManageGateways')
def test_5_no_network(self): print(colored('Running: test_5_no_network - estimate: 11s', 'yellow')) prompt_to_disable_network() active_user_row = get_random_row_in_account_table() click_action_button(active_user_row.find_elements_by_tag_name('td')) sleep(9+SLEEP_INTERVAL) print(colored('\ttest_5_no_network: no account form - asserting...', 'blue')) self.assertFalse(check_existence('//div[@class="MuiFormControl-root MuiFormControl-fullWidth"]', is_id=False)) self.assertTrue(check_existence('//div[@class="inform"]', is_id=False)) print(colored('\ttest_5_no_network: passed.', 'cyan'))
def test_1_commands_list_no_network(self): print(colored('Running: test_1_commands_list_no_network - estimate: 27s', 'yellow')) prompt_to_disable_network() browser.refresh() Root.navigate_to(browser, 'Administration/GatewayCommand') sleep(2*SLEEP_INTERVAL) print(colored('\ttest_1_commands_list_no_network: commands list no network - asserting...', 'blue')) self.assertTrue(check_existence('//div[@class="inform"]', is_id=False)) self.assertFalse(check_existence('//tbody[@class="MuiTableBody-root"]', is_id=False)) print(colored('\ttest_1_commands_list_no_network: passed.', 'cyan')) prompt_to_enable_network_and_setup(browser, 'Administration/GatewayCommand')
def test_1_no_network(): print(colored('Running: test_1_no_network - estimate: 11s', 'yellow')) prompt_to_disable_network() browser.find_element_by_id('save-button').send_keys(Keys.ENTER) sleep(9 + SLEEP_INTERVAL) confirmation = browser.switch_to_alert() print( colored('\ttest_1_no_network: create failed - asserting...', 'blue')) assert 'Error occurred while creating new account' in confirmation.text confirmation.accept() print(colored('\ttest_1_no_network: passed.', 'cyan')) prompt_to_enable_network_and_setup(browser, 'Administration/ManageUser')
def test_1_no_network(): print(colored('Running: test_1_no_network - estimate: 48s', 'yellow')) prompt_to_disable_network() click_fab_button() click_save_button() sleep(9 + SLEEP_INTERVAL) confirmation = browser.switch_to_alert() print( colored('\ttest_1_no_network: confirmation dialog - asserting...', 'blue')) assert "Error occurred while saving gateway" in confirmation.text confirmation.accept() print(colored('\ttest_1_no_network: passed.', 'cyan')) browser.refresh() prompt_to_enable_network_and_setup(browser, 'Factory/ManageGateways')
def test_1_no_network(): print(colored('Running: test_1_no_network - estimate: 27s', 'yellow')) prompt_to_disable_network() for i in range(2): print(colored('\trandom command ' + str(i + 1), 'magenta')) get_random_command() click_update_button() sleep(9+SLEEP_INTERVAL) confirmation = browser.switch_to_alert() print(colored('\ttest_1_no_network: confirmation dialog - asserting...', 'blue')) assert "Error occurred while updating command" in confirmation.text confirmation.accept() close_modal() print(colored('\ttest_1_no_network: passed.', 'cyan')) prompt_to_enable_network_and_setup(browser, 'Administration/GatewayCommand')
def test_1_detail_no_network(self): print( colored('Running: test_1_detail_no_network - estimate: 24s', 'yellow')) prompt_to_disable_network() gateway_row = get_random_table_row() gateway_cols = gateway_row.find_elements_by_tag_name('td') click_action_button(gateway_cols) sleep(3 * SLEEP_INTERVAL) print( colored( '\ttest_1_detail_no_network: inform existence - asserting...', 'blue')) self.assertTrue(check_existence('//div[@class="inform"]', is_id=False)) print(colored('\ttest_1_detail_no_network: passed.', 'cyan')) browser.refresh() prompt_to_enable_network_and_setup(browser, 'Factory/ManageGateways')
def test_1_no_network(self): print(colored('Running: test_1_no_network - estimate: 11s', 'yellow')) prompt_to_disable_network() browser.refresh() Root.navigate_to(browser, 'Administration/ManageUser') sleep(9 + SLEEP_INTERVAL) print(colored('\ttest_1_no_network: no network - asserting...', 'blue')) self.assertEqual(check_existence('account_lists'), False) self.assertEqual( check_existence('//div[@class="inform"]', is_id=False), True) self.assertEqual( check_existence( '//div[@class="MuiFormControl-root MuiFormControl-fullWidth"]', is_id=False), True) print(colored('\ttest_1_no_network: passed.', 'cyan')) prompt_to_enable_network_and_setup(browser, 'Administration/ManageUser')
def test_1_no_network(): print(colored('Running: test_1_no_network - estimate: 27s', 'yellow')) prompt_to_disable_network() for i in range(3): print(colored('\trandom node ' + str(i + 1), 'magenta')) get_random_node() click_update_button() confirmation = browser.switch_to_alert() print( colored( '\ttest_1_no_network: confirmation dialog - asserting...', 'blue')) assert "Error occurred while updating device" in confirmation.text confirmation.accept() close_modal() print(colored('\ttest_1_no_network: passed.', 'cyan')) prompt_to_enable_network_and_setup(browser, 'Factory/ManageDevice')
def test_1_gateways_list_no_network(self): print( colored('Running: test_1_gateways_list_no_network - estimate: 27s', 'yellow')) prompt_to_disable_network() browser.refresh() Root.navigate_to(browser, 'Factory/ManageGateways') sleep(9 + SLEEP_INTERVAL) print( colored( '\ttest_1_gateways_list_no_network: gateways list no network - asserting...', 'blue')) self.assertTrue(check_existence('//div[@class="inform"]', is_id=False)) self.assertFalse( check_existence('//tbody[@class="MuiTableBody-root"]', is_id=False)) self.assertFalse(check_existence('gateway-search-form')) print(colored('\ttest_1_gateways_list_no_network: passed.', 'cyan')) prompt_to_enable_network_and_setup(browser, 'Factory/ManageGateways')
def test_1_no_network(): print(colored('Running: test_1_no_network - estimate: 3s', 'yellow')) active_user_row = get_random_row_in_account_table() active_user_cols = active_user_row.find_elements_by_tag_name('td') click_action_button(active_user_cols) sleep(2*SLEEP_INTERVAL) browser.find_element_by_id('account-password').send_keys('testing') browser.find_element_by_id('confirm-password').send_keys('testing') prompt_to_disable_network() browser.find_element_by_id('save-button').send_keys(Keys.ENTER) sleep(9+SLEEP_INTERVAL) confirmation = browser.switch_to_alert() print(colored('\ttest_1_no_network: create failed - asserting...', 'blue')) assert 'Error occurred while updating account' in confirmation.text confirmation.accept() print(colored('\ttest_1_no_network: passed.', 'cyan')) prompt_to_enable_network_and_setup(browser, 'Administration/ManageUser')
def test_1_no_network(): print(colored('Running: test_1_no_network - estimate: 45s', 'yellow')) prompt_to_disable_network() for i in range(3): print(colored('\tnew meter ' + str(i + 1), 'magenta')) click_fab_button() click_save_button() sleep(3 * SLEEP_INTERVAL) confirmation = browser.switch_to_alert() print( colored( '\ttest_1_no_network: confirmation dialog - asserting...', 'blue')) assert "Error occurred while saving meter" in confirmation.text confirmation.accept() close_modal() sleep(2 * SLEEP_INTERVAL) print(colored('\ttest_1_no_network: passed.', 'cyan')) prompt_to_enable_network_and_setup(browser, 'Factory/ManageMeter')