@@ -91,27 +91,38 @@ void test(final String module, final long waitTime) throws Exception {
91
91
status = getResultElementText (webdriver );
92
92
}
93
93
94
- Thread .sleep (Duration .ofSeconds (1 ).toMillis ()); // to make tests a bit more stable
95
- final WebElement output = webdriver .findElement (By .id ("logBody" ));
96
- final List <WebElement > lines = output .findElements (By .xpath (".//div" ));
97
-
98
- final StringBuilder result = new StringBuilder ();
99
- for (final WebElement webElement : lines ) {
100
- final String text = webElement .getText ();
101
- if (StringUtils .isNotBlank (text )) {
102
- result .append (text );
103
- result .append ("\n " );
104
- }
105
- }
94
+ for (int i = 0 ; i < 10 ; i ++) {
95
+ try {
96
+ Thread .sleep (100 );
97
+
98
+ final WebElement output = webdriver .findElement (By .id ("logBody" ));
99
+ final List <WebElement > lines = output .findElements (By .xpath (".//div" ));
100
+
101
+ final StringBuilder result = new StringBuilder ();
102
+ for (final WebElement webElement : lines ) {
103
+ final String text = webElement .getText ();
104
+ if (StringUtils .isNotBlank (text )) {
105
+ result .append (text );
106
+ result .append ("\n " );
107
+ }
108
+ }
109
+
110
+ String expFileName = StringUtils .replace (module , "." , "" );
111
+ expFileName = StringUtils .replace (expFileName , "_" , "" );
112
+ expFileName = StringUtils .replace (expFileName , "/" , "_" );
113
+ String expected = loadExpectation (expFileName );
114
+ expected = StringUtils .replace (expected , "\r \n " , "\n " );
106
115
107
- String expFileName = StringUtils .replace (module , "." , "" );
108
- expFileName = StringUtils .replace (expFileName , "_" , "" );
109
- expFileName = StringUtils .replace (expFileName , "/" , "_" );
110
- String expected = loadExpectation (expFileName );
111
- expected = StringUtils .replace (expected , "\r \n " , "\n " );
116
+ assertEquals (normalize (expected ), normalize (result .toString ()));
117
+ // assertEquals(expected, result.toString());
112
118
113
- assertEquals (normalize (expected ), normalize (result .toString ()));
114
- // assertEquals(expected, result.toString());
119
+ // success
120
+ break ;
121
+ }
122
+ catch (AssertionError ignored ) {
123
+ // fails, give it another try
124
+ }
125
+ }
115
126
}
116
127
catch (final Exception e ) {
117
128
e .printStackTrace ();
0 commit comments