Creating FEST to wait for application loading

I am new to FEST based GUI testing.

MyFrame is the root class for my application.

@Before public void onSetUp() { MyFrame frame = GuiActionRunner.execute(new GuiQuery<MyFrame>() { protected MyFrame executeInEDT() { return new MyFrame(); } }); frame2 = new FrameFixture(robot(), frame); frame2.show(); // shows the frame to test } 

When I run the test case,

 @Test public void testGui() { String rs = frame2.label("hl").text().toString(); assertTrue(rs.equals("First")); } 

The above method does not print the actual line present in the label.

I think the FEST API is not waiting for the application to load.

Are there any methods for deferred search for a GUI element?

+4
source share
2 answers
 //do your clicks fixture.robot.waitForIdle();//give the GUI time to update //do your asserts 

this will pause your code until your GUI is updated. The advantage of Pause is that you do not need to wait longer than you need, passing a large period of time.

+4
source

Perhaps you can use the pause method from org.fest.swing.timing.

Take a look here http://fest.easytesting.org/swing/apidocs/org/fest/swing/timing/Pause.html

+3
source

Source: https://habr.com/ru/post/1390225/


All Articles