@Test public void textfield_usage_through_language_part3() { when(evaluator.componentType(id)).thenReturn(TextField); TextField textField = new TextField(evaluator, id); when(evaluator.maxLength(textField)).thenReturn(255); when(evaluator.label(textField)).thenReturn("myLabel"); when(evaluator.value(textField)).thenReturn(""); enter("SomeData", on(textField)); verify(evaluator, atLeastOnce()).focusOn(textField); verify(evaluator, times(1)).reset(textField); verify(evaluator, times(1)).type("SomeData"); }
@Test public void textfield_usage_through_language_part2() { when(evaluator.componentType(id)).thenReturn(TextField); TextField textField = new TextField(evaluator, id); when(evaluator.maxLength(textField)).thenReturn(255); when(evaluator.label(textField)).thenReturn("myLabel"); when(evaluator.value(textField)).thenReturn("myValue"); assertThat(textField, is(enabled())); and(not(disabled())); and(it(), visible()); clickOn(textField); Mouse.clickOn(textField); type("data_1", into(textField)); verify(evaluator, times(2)).click(textField, Click.left); verify(evaluator, times(2)).focusOn(any(Component.class)); verify(evaluator, times(1)).type("data_1"); }
@Test public void test_keyboard_usage() { when(evaluator.componentType(id)).thenReturn(TextField); TextField textField = new TextField(evaluator, id); when(evaluator.maxLength(textField)).thenReturn(255); when(evaluator.label(textField)).thenReturn("label"); when(evaluator.value(textField)).thenReturn("value"); type("Some Data", on(textField)); Keyboard.type("Other Data"); Keyboard.keyDown(KeyModifier.SHIFT); Keyboard.release(KeyModifier.CONTROL); Keyboard.press(Key.F6); Keyboard.release(); verify(evaluator, atLeastOnce()).focusOn(textField); verify(evaluator, times(1)).type("Some Data"); verify(evaluator, times(1)).type("Other Data"); verify(evaluator, times(1)).keyDown(KeyModifier.SHIFT); verify(evaluator, times(1)).release(KeyModifier.CONTROL); verify(evaluator, times(1)).press(Key.F6); verify(evaluator, times(1)).release(); }