mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-19 08:52:15 +01:00
HittingEscapeOnCloseConfirmationDialogTest: Match dialog by title
This would match the "Close" dialog, by looking for any JDialog on screen. However, in some cases, there could be a second dialog (I have seen a "Install this package to use your xxx board" popup because I happened to have an Arduino Zero connected, presumably an "Updates are available" popup could cause this as well). By matching not just the type of the dialog, but also the title, only one dialog is matched and the testcase runs more reliably.
This commit is contained in:
parent
af8e1e6dc4
commit
7bc6efa27e
@ -30,6 +30,7 @@
|
||||
package processing.app;
|
||||
|
||||
import org.fest.swing.core.KeyPressInfo;
|
||||
import org.fest.swing.core.matcher.DialogMatcher;
|
||||
import org.fest.swing.finder.WindowFinder;
|
||||
import org.fest.swing.fixture.DialogFixture;
|
||||
import org.junit.Test;
|
||||
@ -39,6 +40,7 @@ import javax.swing.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static processing.app.I18n.tr;
|
||||
|
||||
public class HittingEscapeOnCloseConfirmationDialogTest extends AbstractGUITest {
|
||||
|
||||
@ -49,7 +51,8 @@ public class HittingEscapeOnCloseConfirmationDialogTest extends AbstractGUITest
|
||||
|
||||
window.close();
|
||||
|
||||
DialogFixture dialog = WindowFinder.findDialog(JDialog.class).using(window.robot);
|
||||
DialogMatcher matcher = DialogMatcher.withTitle(tr("Close")).andShowing();
|
||||
DialogFixture dialog = WindowFinder.findDialog(matcher).using(window.robot);
|
||||
dialog.pressAndReleaseKey(KeyPressInfo.keyCode(KeyEvent.VK_ESCAPE));
|
||||
|
||||
EditorConsole console = (EditorConsole) window.scrollPane("console").component();
|
||||
|
Loading…
x
Reference in New Issue
Block a user