< prev index next >

test/jdk/sanity/client/SwingSet/src/ProgressBarDemoTest.java

Print this page

        

@@ -27,10 +27,11 @@
 import java.awt.Component;
 import static org.testng.AssertJUnit.*;
 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;
 import org.testng.annotations.Listeners;
 

@@ -45,15 +46,17 @@
  * @library /sanity/client/lib/SwingSet3/src
  * @modules java.desktop
  *          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 {
 
         new ClassReference(ProgressBarDemo.class.getCanonicalName()).startApplication();
 

@@ -145,13 +148,19 @@
         assertFalse("Stop Button Disabled", stopButton.isEnabled());
     }
 
     // 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();
 
         assertEquals("Complete Progress", progressBar.getMaximum(), progressBar.getValue());
         assertTrue("Start Button Enabled", startButton.isEnabled());
< prev index next >