8191803: [TEST_BUG] : sanity/client/SwingSet/src/ProgressBarDemoTest.java failed with "Wait "greater then 1349" state to be reached
authorakolarkunnu
Wed, 13 Dec 2017 13:27:45 +0530
changeset 48291 093027a037cf
parent 48290 dbfe141b1271
child 48292 191ae61bd1e9
child 48345 4966e9237b88
8191803: [TEST_BUG] : sanity/client/SwingSet/src/ProgressBarDemoTest.java failed with "Wait "greater then 1349" state to be reached Reviewed-by: serb, psadhukhan Contributed-by: abdul.kolarkunnu@oracle.com
test/jdk/sanity/client/SwingSet/src/ProgressBarDemoTest.java
--- a/test/jdk/sanity/client/SwingSet/src/ProgressBarDemoTest.java	Tue Dec 12 15:47:35 2017 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/ProgressBarDemoTest.java	Wed Dec 13 13:27:45 2017 +0530
@@ -29,6 +29,7 @@
 import org.testng.annotations.Test;
 import org.netbeans.jemmy.ClassReference;
 import org.netbeans.jemmy.ComponentChooser;
+import org.netbeans.jemmy.Timeouts;
 import org.netbeans.jemmy.operators.JButtonOperator;
 import org.netbeans.jemmy.operators.JFrameOperator;
 import org.netbeans.jemmy.operators.JProgressBarOperator;
@@ -47,11 +48,13 @@
  *          java.logging
  * @build org.jemmy2ext.JemmyExt
  * @build com.sun.swingset3.demos.progressbar.ProgressBarDemo
- * @run testng ProgressBarDemoTest
+ * @run testng/timeout=240 ProgressBarDemoTest
  */
 @Listeners(GuiTestListener.class)
 public class ProgressBarDemoTest {
 
+    private final static long PROGRESS_BAR_TIMEOUT = 180000;
+
     @Test
     public void test() throws Exception {
 
@@ -147,9 +150,15 @@
 
     // Check progess bar progression and start/stop button disabled/enabled states
     public void checkCompleteProgress(JFrameOperator frame, JButtonOperator startButton, JButtonOperator stopButton, JProgressBarOperator progressBar) throws Exception {
+        Timeouts timeouts = progressBar.getTimeouts();
+        long defaultTimeout = timeouts.getTimeout("ComponentOperator.WaitStateTimeout");
         startButton.pushNoBlock();
 
+        // Set progress bar timeout as 3 minutes as it take long time to reach maximum
+        timeouts.setTimeout("ComponentOperator.WaitStateTimeout", PROGRESS_BAR_TIMEOUT);
         progressBar.waitValue(progressBar.getMaximum());
+        // Reset timeout to default timeout value
+        timeouts.setTimeout("ComponentOperator.WaitStateTimeout", defaultTimeout);
 
         startButton.waitComponentEnabled();