use of de.diedavids.sneferu.screen.InputDialogTestAPI in project jmix-sneferu by mariodavid.
the class GetOpenedInputDialogScreenTest method given_inputDialogIsOpen_when_incorrectlyInteractingWithInputDialog_then_operationResultIsFail.
@Test
void given_inputDialogIsOpen_when_incorrectlyInteractingWithInputDialog_then_operationResultIsFail(Screens screens, UiTestAPI uiTestAPI) {
// given:
storePikachu("025");
// and:
openPetByIdInputDialog(uiTestAPI);
// when:
final InputDialogTestAPI openedInputDialog = uiTestAPI.getOpenedInputDialog();
// and:
openedInputDialog.interact(enter(textInputField("id"), null)).andThenGet(closeInputDialogWith(InputDialog.INPUT_DIALOG_OK_ACTION));
// then:
assertThrows(ScreenNotOpenException.class, () -> uiTestAPI.getOpenedEditorScreen(PetEdit.class));
}
use of de.diedavids.sneferu.screen.InputDialogTestAPI in project jmix-sneferu by mariodavid.
the class GetOpenedInputDialogScreenTest method given_inputDialogIsOpen_when_getOpenedInputDialog_then_inputDialogIsReturned.
@Test
void given_inputDialogIsOpen_when_getOpenedInputDialog_then_inputDialogIsReturned(UiTestAPI uiTestAPI) {
// given:
final String pikachuIdentifier = "025";
final Pet pikachu = storePikachu(pikachuIdentifier);
// and:
openPetByIdInputDialog(uiTestAPI);
// when:
final InputDialogTestAPI openedInputDialog = uiTestAPI.getOpenedInputDialog();
// and:
final OperationResult operationResult = openedInputDialog.interact(enter(textInputField("id"), pikachuIdentifier)).andThenGet(closeInputDialogWith(InputDialog.INPUT_DIALOG_OK_ACTION));
// then:
assertThat(operationResult).isEqualTo(OperationResult.success());
// and: after the input dialog, the Pet editor is opened
final StandardEditorTestAPI<Pet, PetEdit> openedPetEditor = uiTestAPI.getOpenedEditorScreen(PetEdit.class);
final Pet pet = openedPetEditor.get(editedEntity());
assertThat(pet).isEqualTo(pikachu);
}
use of de.diedavids.sneferu.screen.InputDialogTestAPI in project jmix-sneferu by mariodavid.
the class CloseInputDialogInteractionTest method when_interactionIsPerformed_then_inputDialogIsClosedAndSuccessIsReturned.
@Test
void when_interactionIsPerformed_then_inputDialogIsClosedAndSuccessIsReturned(UiTestAPI uiTestAPI) {
// given:
final String pikachuIdentifier = "025";
final Pet pikachu = storePikachu(pikachuIdentifier);
// and:
openPetByIdInputDialog(uiTestAPI);
// when:
final InputDialogTestAPI openedInputDialog = uiTestAPI.getOpenedInputDialog();
// and:
final OperationResult operationResult = openedInputDialog.interact(enter(textInputField("id"), pikachuIdentifier)).andThenGet(closeInputDialogWith(InputDialog.INPUT_DIALOG_OK_ACTION));
// then:
assertThat(operationResult).isEqualTo(OperationResult.success());
// and: after the input dialog, the Pet editor is opened
final StandardEditorTestAPI<Pet, PetEdit> openedPetEditor = uiTestAPI.getOpenedEditorScreen(PetEdit.class);
final Pet pet = openedPetEditor.get(editedEntity());
assertThat(pet).isEqualTo(pikachu);
}
use of de.diedavids.sneferu.screen.InputDialogTestAPI in project jmix-sneferu by mariodavid.
the class CloseInputDialogInteractionTest method when_interactionIsPerformedWithCloseAction_then_inputDialogIsClosedAndSuccessIsReturned.
@Test
void when_interactionIsPerformedWithCloseAction_then_inputDialogIsClosedAndSuccessIsReturned(UiTestAPI uiTestAPI) {
// given:
storePikachu("025");
// and:
openPetByIdInputDialog(uiTestAPI);
// when:
final InputDialogTestAPI openedInputDialog = uiTestAPI.getOpenedInputDialog();
// and:
openedInputDialog.interact(enter(textInputField("id"), null)).andThenGet(closeInputDialogWith(InputDialog.INPUT_DIALOG_OK_ACTION));
// then:
assertThrows(ScreenNotOpenException.class, () -> uiTestAPI.getOpenedEditorScreen(PetEdit.class));
}
Aggregations