def test_fill_picker_field_no_response(self) -> None: sail_ui_actions_cmf = json.loads(self.sail_ui_actions_response) self.custom_locust.enqueue_response(200, '{}') sail_form = SailUiForm(self.task_set.appian.interactor, sail_ui_actions_cmf, self.process_model_form_uri) label = self.picker_label value = 'You will not find me' with self.assertRaisesRegex(Exception, "No response returned"): sail_form.fill_picker_field(label, value)
def test_fill_picker_field_interaction_no_selection_resp(self) -> None: sail_ui_actions_cmf = json.loads(self.sail_ui_actions_response) picker_widget_suggestions = read_mock_file("picker_widget_suggestions.json") self.custom_locust.enqueue_response(200, picker_widget_suggestions) self.custom_locust.enqueue_response(200, '{}') sail_form = SailUiForm(self.task_set.appian.interactor, sail_ui_actions_cmf, self.process_model_form_uri) label = self.picker_label value = self.picker_value with self.assertRaisesRegex(Exception, 'No response returned'): sail_form.fill_picker_field(label, value)
def test_fill_picker_field_suggestions_identifier_is_code(self) -> None: sail_ui_actions_cmf = json.loads(self.sail_ui_actions_response) picker_widget_suggestions = read_mock_file("picker_widget_suggestions_code.json") picker_widget_selected = read_mock_file("picker_widget_selected.json") self.custom_locust.enqueue_response(200, picker_widget_suggestions) self.custom_locust.enqueue_response(200, picker_widget_selected) sail_form = SailUiForm(self.task_set.appian.interactor, sail_ui_actions_cmf, self.process_model_form_uri) label = self.picker_label value = 'GAC Guyana' sail_form.fill_picker_field(label, value, identifier='code')
def test_fill_picker_field_not_id_or_v(self) -> None: sail_ui_actions_cmf = json.loads(self.sail_ui_actions_response) label = self.picker_label resp = { 'testLabel': f'test-{label}', '#t': 'PickerWidget', 'suggestions': [{'identifier': {'idx': 1}}] } self.custom_locust.enqueue_response(200, json.dumps(resp)) sail_form = SailUiForm(self.task_set.appian.interactor, sail_ui_actions_cmf, self.process_model_form_uri) value = self.picker_value with self.assertRaisesRegex(Exception, "Could not extract picker values"): sail_form.fill_picker_field(label, value)
def test_fill_picker_field_user(self) -> None: sail_ui_actions_cmf = json.loads(self.sail_ui_actions_response) picker_widget_selected = read_mock_file("picker_widget_selected.json") label = '1. Select a Customer' resp = { 'testLabel': f'test-{label}', '#t': 'PickerWidget', 'suggestions': [{'identifier': {'id': 1, "#t": "User"}}], 'saveInto': {}, '_cId': "abc" } self.custom_locust.enqueue_response(200, json.dumps(resp)) self.custom_locust.enqueue_response(200, picker_widget_selected) sail_form = SailUiForm(self.task_set.appian.interactor, sail_ui_actions_cmf, self.process_model_form_uri) value = 'Admin User' sail_form.fill_picker_field(label, value)