{
@@ -151,8 +149,8 @@ private void sendUsernameWithSyncWait() throws Exception {
awaitSync();
}
- private List buildUsernameField() {
- return Collections.singletonList(new CoordInput(new Position(2, 1), USERNAME));
+ private Input buildUsernameField() {
+ return new CoordInput(new Position(2, 1), USERNAME);
}
@Test
@@ -231,8 +229,8 @@ public void shouldThrowTimeoutExceptionWhenSyncWaitAndSlowResponse() throws Exce
awaitSync();
}
- private void sendEnterAttentionKey(List inputs) throws RteIOException {
- client.send(inputs, AttentionKey.ENTER, 0);
+ private void sendEnterAttentionKey(Input... inputs) throws RteIOException {
+ client.send(Arrays.asList(inputs), AttentionKey.ENTER, 0);
}
@Test(expected = TimeoutException.class)
@@ -261,13 +259,7 @@ public void shouldThrowTimeoutExceptionWhenTextWaitWithNoMatchingRegex()
loadLoginFlow();
connectToVirtualService();
sendEnterAttentionKey(buildUsernameField());
- client.await(Collections
- .singletonList(new TextWaitCondition(new Perl5Compiler().compile("testing-wait-text"),
- new Perl5Matcher(),
- Area.fromTopLeftBottomRight(1, 1, Position.UNSPECIFIED_INDEX,
- Position.UNSPECIFIED_INDEX),
- TIMEOUT_MILLIS,
- STABLE_TIMEOUT_MILLIS)));
+ awaitText("testing-wait-text");
}
@Test
@@ -294,7 +286,7 @@ public void shouldThrowUnsupportedOperationExceptionWhenSelectAttentionKeyUnsupp
throws Exception {
loadFlow("login.yml");
connectToVirtualService();
- client.send(buildUsernameField(), AttentionKey.ROLL_UP, 0);
+ client.send(Collections.singletonList(buildUsernameField()), AttentionKey.ROLL_UP, 0);
}
@Test
@@ -371,8 +363,12 @@ public void shouldThrowTimeoutExceptionWhenMatchedScreenChangedBeforeStablePerio
loadFlow("login-with-multiple-flash-screen.yml");
client.connect(VIRTUAL_SERVER_HOST, server.getPort(), SSLType.NONE, getDefaultTerminalType(),
TIMEOUT_MILLIS);
+ awaitText("AAAAA");
+ }
- client.await(Collections.singletonList(new TextWaitCondition(JMeterUtils.getPattern("AAAAA"),
+ private void awaitText(String text)
+ throws InterruptedException, TimeoutException, RteIOException {
+ client.await(Collections.singletonList(new TextWaitCondition(JMeterUtils.getPattern(text),
JMeterUtils.getMatcher(),
Area.fromTopLeftBottomRight(1, 1, Position.UNSPECIFIED_INDEX, Position.UNSPECIFIED_INDEX),
TIMEOUT_MILLIS, STABLE_TIMEOUT_MILLIS)));
@@ -382,14 +378,22 @@ public void shouldThrowTimeoutExceptionWhenMatchedScreenChangedBeforeStablePerio
public void shouldGetUserMenuScreenWhenSendUserNameWithArrows() throws Exception {
loadFlow("login.yml");
connectToVirtualService();
- List inputs = Arrays.asList(
- new NavigationInput(1, NavigationType.DOWN, ""),
+ sendEnterAttentionKey(new NavigationInput(1, NavigationType.DOWN, ""),
new NavigationInput(27, NavigationType.RIGHT, ""),
new NavigationInput(2, NavigationType.UP, ""),
new NavigationInput(1, NavigationType.LEFT, "testusr"));
- sendEnterAttentionKey(inputs);
awaitSync();
assertThat(client.getScreen().withInvisibleCharsToSpaces())
.isEqualTo(buildScreenFromHtmlFile("user-menu-screen.html"));
}
+
+ @Test
+ public void shouldValidateTextOnScreeWhenScreenBuiltFromPlainTextAndFields() throws Exception {
+ loadFlow("login-mixed-fields-and-plain-text.yml");
+ connectExtendedProtocolClientToVirtualService();
+ sendEnterAttentionKey(new NavigationInput(0, NavigationType.TAB, "TESTUSR "),
+ new NavigationInput(1, NavigationType.TAB,
+ "TESTPSW" + IntStream.range(0, 35).mapToObj(i -> " ").collect(Collectors.joining())));
+ awaitText("Ready");
+ }
}
diff --git a/src/test/java/com/blazemeter/jmeter/rte/recorder/emulator/Xtn5250TerminalEmulatorIT.java b/src/test/java/com/blazemeter/jmeter/rte/recorder/emulator/Xtn5250TerminalEmulatorIT.java
index 04347e66..64b884f9 100644
--- a/src/test/java/com/blazemeter/jmeter/rte/recorder/emulator/Xtn5250TerminalEmulatorIT.java
+++ b/src/test/java/com/blazemeter/jmeter/rte/recorder/emulator/Xtn5250TerminalEmulatorIT.java
@@ -119,7 +119,6 @@ public class Xtn5250TerminalEmulatorIT {
@Mock
private TerminalEmulatorListener listener;
- private String samplerName;
private static Screen buildScreen(String text, boolean withFields) {
Dimension screenSize = new Dimension(80, 24);
@@ -315,10 +314,14 @@ public void shouldCallTheListenerWhenPressAnyAttentionKey() {
xtn5250TerminalEmulator.addTerminalEmulatorListener(listener);
sendKeyWithCursorUpdate(KeyEvent.VK_F1, 0, 2, 2);
verify(listener, timeout(PAUSE_TIMEOUT)).onAttentionKey(AttentionKey.F1,
- Collections.singletonList(new CoordInput(new Position(2,2), "")),
+ Collections.singletonList(buildCoordInput(2, 2)),
"");
}
+ private static CoordInput buildCoordInput(int row, int col) {
+ return new CoordInput(new Position(row, col), "");
+ }
+
@Test
public void shouldCallTheListenerWhenPressControlAttentionKey() {
setScreen("");
@@ -326,7 +329,7 @@ public void shouldCallTheListenerWhenPressControlAttentionKey() {
sendKeyWithCursorUpdate(KeyEvent.VK_CONTROL, KeyEvent.CTRL_MASK, 2, 2);
verify(listener, timeout(PAUSE_TIMEOUT))
.onAttentionKey(AttentionKey.RESET,
- Collections.singletonList(new CoordInput(new Position(2, 2), "")), "");
+ Collections.singletonList(buildCoordInput(2, 2)), "");
}
@Test
@@ -433,7 +436,7 @@ public void shouldSendInputByLabelThroughListenerWhenInputByLabel() {
sendKeyWithCursorUpdate(KeyEvent.VK_ENTER, 0, 2, 5);
List inputs = new ArrayList<>();
inputs.add(new LabelInput(CHUNK_OF_SCREEN, input));
- inputs.add(new CoordInput(new Position(2, 5), ""));
+ inputs.add(buildCoordInput(2, 5));
verify(listener).onAttentionKey(AttentionKey.ENTER, inputs, "");
}
@@ -539,7 +542,7 @@ public void shouldNotifyListenerWhenInputInhibitedOnSampleName() {
setSampleName(CONNECTING_LITERAL);
sendKeyWithCursorUpdate(KeyEvent.VK_ENTER, 0, 2, 1);
verify(listener).onAttentionKey(AttentionKey.ENTER,
- Collections.singletonList(new CoordInput(new Position(2, 1), "")),
+ Collections.singletonList(buildCoordInput(2, 1)),
CONNECTING_LITERAL);
}
@@ -568,6 +571,19 @@ public void shouldSwitchCredentialVisibilityIconWhenClickIcon() {
assertThat(((ImageIcon) actual).getImage().equals(expected.getImage()));
}
+ @Test
+ public void shouldSendTabInputWithoutRepetitionWhenCursorJumpsToNextField() throws Exception {
+ setScreenWithUserNameAndPasswordFields();
+ xtn5250TerminalEmulator.addTerminalEmulatorListener(listener);
+ sendNavigationKey(KeyEvent.VK_TAB, 0);
+ sendNavigationKey(KeyEvent.VK_T, 0);
+ sendNavigationKey(KeyEvent.VK_T, 0);
+ sendNavigationKey(KeyEvent.VK_ENTER, 0);
+ verify(listener).onAttentionKey(AttentionKey.ENTER,
+ Arrays.asList(new NavigationInput(0, NavigationType.TAB, "T"), new NavigationInput(0,
+ NavigationType.TAB, "T"), buildCoordInput(1, 14)), "");
+ }
+
@Test
public void shouldProperBuildInputsWithTabsWhenSendCredentialsUsingVT() {
updateCharacterBasedWelcomeScreen();
@@ -635,7 +651,6 @@ private void setupCharacterEmulator(boolean interactive) {
xtn5250TerminalEmulator.addTerminalEmulatorListener(listener);
xtn5250TerminalEmulator.setScreenSize(COLUMNS, ROWS);
xtn5250TerminalEmulator.setScreen(screen);
- xtn5250TerminalEmulator.setScreenName(samplerName);
characterBasedEmulator.setKeyboardStatus(true);
characterBasedEmulator.screenChanged(screen.getText());
if (interactive) {
@@ -998,7 +1013,7 @@ public void shouldProperBuildMixedInputsWhenFirstPositionIsMiddleField() throws
sendKeyWithCursorUpdate(KeyEvent.VK_Y, 0, 2, 18);
assertThat(xtn5250TerminalEmulator.getInputs()).isEqualTo(Arrays.asList(new NavigationInput(0
, NavigationType.TAB, "y"), new LabelInput("Insert Name", "t"),
- new CoordInput(new Position(1, 14), "")));
+ buildCoordInput(1, 14)));
}
@@ -1057,7 +1072,7 @@ public void shouldSendAttentionKeyWhenScreenNotConstitutedByFields() {
xtn5250TerminalEmulator.addTerminalEmulatorListener(listener);
sendKeyWithCursorUpdate(KeyEvent.VK_ENTER, 0, 2, 1);
verify(listener).onAttentionKey(AttentionKey.ENTER,
- Collections.singletonList(new CoordInput(new Position(2, 1), "")),
+ Collections.singletonList(buildCoordInput(2, 1)),
"sample-name");
}
@@ -1067,7 +1082,7 @@ public void shouldSendAttentionKeyAtDesiredPositionWhenSendingAttentionKeyAndScr
xtn5250TerminalEmulator.addTerminalEmulatorListener(listener);
sendKeyWithCursorUpdate(KeyEvent.VK_ENTER, 0, 2, 18);
verify(listener).onAttentionKey(AttentionKey.ENTER,
- Collections.singletonList(new CoordInput(new Position(2, 18), "")), "");
+ Collections.singletonList(buildCoordInput(2, 18)), "");
}
-
+
}
diff --git a/src/test/resources/com/blazemeter/jmeter/rte/protocols/tn3270/login-mixed-fields-and-plain-text.yml b/src/test/resources/com/blazemeter/jmeter/rte/protocols/tn3270/login-mixed-fields-and-plain-text.yml
new file mode 100644
index 00000000..551cea5a
--- /dev/null
+++ b/src/test/resources/com/blazemeter/jmeter/rte/protocols/tn3270/login-mixed-fields-and-plain-text.yml
@@ -0,0 +1,29 @@
+- !server { data: FFFD28 }
+- !client { data: FFFB28 }
+- !server { data: FFFA280802FFF0 }
+- !client { data: FFFA28020749424D2D333237382D322D45FFF0 }
+- !server { data: FFFE28FFFD18 }
+- !client { data: FFFB18 }
+- !server { data: FFFA1801FFF0 }
+- !client { data: FFFA180049424D2D333237382D322D45FFF0 }
+- !server { data: FFFD19FFFB19FFFD00FFFB00 }
+- !client { data: FFFB19 }
+- !client { data: FFFD19 }
+- !client { data: FFFB00 }
+- !client { data: FFFD00 }
+- !server { data: FFFD00FFFB001100064000F1C2000501FFFF02FFEF }
+# Client capabilities
+- !client { data: 8800268186001000F4F1F1F2F2F3F3F4F4F5F5F6F6F7F7F8F8F9F9FAFAFBFBFCFCFDFDFEFEFFFFFFFF000F81870500F0F1F1F2F2F4F4F8F8001781810100005000180100D30320009E0258070C0780001181A600000B0100005000180050001800078188000102001B81858200070C000000000700000002B904170100F103C30136FFEF }
+- !server { data: 05C7115D6B1D60D9E4D5D5C9D5C7404040E4E2C9D3C4C1E5E540401DE8A961E5D440D6D5D3C9D5C51D60110051404040404040404040404040404040404040404040402842F140404040404083838340404040404040404040402842F44040404040404040404040404040404040404040404040404040404040401100A1404040404040404040404040404040404040404040402842F1404040408383834040404040404040404040402842F4404040404040404040404040404040404040404040404040404040404040401100F1404040404040404040404040404040404040404040402842F14040404040404040404040404040404040402842F44040404040404040404040404040404040404040404040404040404040404040110141404040404040404040404040404040404040404040402842F1404040404040404040404040404040404040402842F440404040404040404040404040404040404040404040404040404040404040110191404040404040404040404040404040404040404040402842F140404040404040404040404040404040404040402842F44040404040404040404040404040814040404040404040404040404040401101E1404040404040404040404040404040404040404040402842F140404040404040404040404040404040404040402842F4404040404040404040404040404040404040404040404040404040404040110231404040404040404040404040404040404040404040402842F140404040404040404040404040404040404040402842F44040404040404040404040404040812842F740D381A2404040404040404011028140404040404040404040402842F6A961E5D440F74BF14BF0402842F14040404040404040404040404040404040402842F440404040404040404040404040404040812842F740E5858781A26BD5E51102D140404040404040404040402842F640D9E2E440F2F0F0F140402842F140404040404040404040404040404040402842F44040404040404040404040404040404081812842F740E2A8A2A3859460E5110321404040404040404040404040404040404040404040402842F1404040404040404040404040404040402842F440404040404040404040404040404040404040404040404040404040404040404040110371404040404040404040404040404040404040404040402842F1404040404040404040404040404040402842F4404040404040404040404040404040404040812842F240C1404040404040404040401103C1404040404040404040404040404040404040404040402842F1404040404040404040404040404040402842F4404040404040404040404040404040404040812842F2404e385a2a38995874004040110411404040404040404040404040404040404040404040402842F1404040404040404040404040404040402842F4404040404040404040404040404040404040812842F240C39694978195A840404040110461404040404040404040404040404040404040404040402842F140404040404040404040404040404040402842F44040404040404040404040404040404040814040404040404040404040404040401104B1404040404040404040404040404040404040404040402842F14040404040404040404040404040404040402842F44040404040404040404040404040404081404040404040404040404040404040110501404040404040404040404040404040404040404040402842F140404040404040404040404040404040404040402842F44040404040404040404040404040408128427F40404040404040404040401105501DF8C689939340899540A896A49940E4E2C5D9C9C44081958440D7C1E2E2E6D6D9C44081958440979985A2A240C5D5E3C5D90000000000000000001105A01DF84DE896A499409781A2A2A696998440A6899393409596A34081979785819940A688859540A896A440A3A897854089A35D0000000000000000001105F01DF8E4E2C5D9C9C44040407E7E7E6E1D401300000000000000001D70000000000000000000000000000000000000000000000000000000000000001106401DF8D7C1E2E2E6D6D9C4407E7E7E6E1D4C0000000000000000000000000000000000000000000000000000000000000000000000000000000000001106901D700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001106E01DF8C3D6D4D4C1D5C440407E7E7E6E1D40000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFEF }
+# Send TESTUSR and TESTPSW then press ENTER key
+- !client { data: 7DD9D611D77Fe3c5e2e3e4e2d94011D94Fe3c5e2e3d7e2e64040404040404040404040404040404040404040404040404040404040404040404040FFEF }
+# Plain text screen with some fields. Considered as special screen, due to the fact
+# that some fields don't have fields attributes
+- !server { data: 01C2115B5F05133C5D6B0011077F1D60115B5F290342004100C0C1115D6B2903 }
+- !server { data: 42004100C060D9E4D5D5C9D5C7404040E4E2C9D3C4C1E5E51D60FFEF }
+- !server { data: 01C21101E0284100284200C228000011077F1D60115B5F290342004100C0C111 }
+- !server { data: 5D6B290342004100C060D9E4D5D5C9D5C7404040E4E2C9D3C4C1E5E51D60FFEF }
+- !server { data: 01C2110230284100284200D9858184A85E28000011077F1D60115B5F29034200 }
+- !server { data: 4100C0C1115D6B290342004100C060D9E4D5D5C9D5C7404040E4E2C9D3C4C1E5 }
+- !server { data: E51D60FFEF }
+- !client { data: FFFF }
diff --git a/src/test/resources/com/blazemeter/jmeter/rte/protocols/tn3270/login-success-screen.html b/src/test/resources/com/blazemeter/jmeter/rte/protocols/tn3270/login-success-screen.html
index 988df5d3..7df36d6f 100644
--- a/src/test/resources/com/blazemeter/jmeter/rte/protocols/tn3270/login-success-screen.html
+++ b/src/test/resources/com/blazemeter/jmeter/rte/protocols/tn3270/login-success-screen.html
@@ -1,5 +1,4 @@
-
- TSS7000I TESTUSR Last-Used 05 Apr 18 16:12 System=XE49 Facility=TSO
+ TSS7000I TESTUSR Last-Used 05 Apr 18 16:12 System=XE49 Facility=TSO
TSS7001I Count=00003 Mode=Fail Locktime=None Name=TESTING USER1
IKJ56455I TESTUSR LOGON IN PROGRESS AT 16:17:45 ON APRIL 5, 2018
**************************************************************
@@ -23,5 +22,4 @@
READY
-
-
+
\ No newline at end of file
diff --git a/src/test/resources/com/blazemeter/jmeter/rte/protocols/tn3270/login-welcome-screen.html b/src/test/resources/com/blazemeter/jmeter/rte/protocols/tn3270/login-welcome-screen.html
index 30dd3074..ca76876e 100644
--- a/src/test/resources/com/blazemeter/jmeter/rte/protocols/tn3270/login-welcome-screen.html
+++ b/src/test/resources/com/blazemeter/jmeter/rte/protocols/tn3270/login-welcome-screen.html
@@ -1,5 +1,4 @@
-
- AAAAAAAAA ENTER USERID -
+ AAAAAAAAA ENTER USERID -
@@ -23,5 +22,4 @@
-
-
+
\ No newline at end of file
diff --git a/src/test/resources/com/blazemeter/jmeter/rte/protocols/tn3270/user-menu-screen.html b/src/test/resources/com/blazemeter/jmeter/rte/protocols/tn3270/user-menu-screen.html
index 3bb800bc..fde3d1a2 100644
--- a/src/test/resources/com/blazemeter/jmeter/rte/protocols/tn3270/user-menu-screen.html
+++ b/src/test/resources/com/blazemeter/jmeter/rte/protocols/tn3270/user-menu-screen.html
@@ -1,27 +1,25 @@
-
- ------------------------------- TSO/E LOGON -----------------------------------
-
-
- Enter LOGON parameters below: RACF LOGON parameters:
+ ------------------------------- TSO/E LOGON -----------------------------------
- Userid ===> TESTUSR
- Password ===> New Password ===>
+ Enter LOGON parameters below: RACF LOGON parameters:
- Procedure ===> PROC394 Group Ident ===>
+ Userid ===> TESTUSR
- Acct Nmbr ===> 1000000
+ Password ===> New Password ===>
- Size ===> 4096
+ Procedure ===> PROC394 Group Ident ===>
- Perform ===>
+ Acct Nmbr ===> 1000000
- Command ===>
+ Size ===> 4096
+
+ Perform ===>
+
+ Command ===>
- Enter an 'S' before each option desired below:
- -Nomail -Nonotice -Reconnect -OIDcard
+ Enter an 'S' before each option desired below:
+ -Nomail -Nonotice -Reconnect -OIDcard
- PF1/PF13 ==> Help PF3/PF15 ==> Logoff PA1 ==> Attention PA2 ==> Reshow
- You may request specific help information by entering a '?' in any entry field
-
-
+ PF1/PF13 ==> Help PF3/PF15 ==> Logoff PA1 ==> Attention PA2 ==> Reshow
+ You may request specific help information by entering a '?' in any entry field
+
\ No newline at end of file