assertj / assertj/assertj-swing

Unable to locate JOptionPane in AWT Hierarchy

Abierto
#74 0 comentarios 0 reacciones 0 asignados Ver en GitHub
bug import from fest-swing Major
Lenguaje dominante
Java
Estrellas
121
Forks
52
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

_Issue by **[Bobby](http://jira.codehaus.org/secure/ViewProfile.jspa?name=rbonslat)** from Wed, 11 Aug 2010 14:59:41 -0500_
_Originally opened as http://jira.codehaus.org/browse/FEST-380_

---

I am unable to find JOptionPane when testing a Java swing applet.

Here is the code that executes the swing component from the Swing applet:

int choose = JOptionPane.showOptionDialog(null, "Click Yes to confirm the commit",

"Click Yes to confirm the commit", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options,

options[0]);

// int choose = JOptionPane.showConfirmDialog(null,

// "Click Yes to confirm the commit.", "Click Yes to confirm the commit",

// JOptionPane.YES_NO_OPTION);

// if (choose == JOptionPane.YES_OPTION){

if (choose == YesOption)

{
da.commit();
// cbDraw.log("commit.");
}

Here is my FEST test code that tries to locate it:

JOptionPaneFixture option_pane = m_navigator.optionPane();

public JOptionPaneFixture optionPane()

{
return frame.optionPane();
}

/**

{@inheritDoc} _/

public JOptionPaneFixture optionPane() {
return optionPane(DEFAULT_DIALOG_LOOKUP_TIMEOUT);
}



/_\* {@inheritDoc}

*/

public JOptionPaneFixture optionPane(Timeout timeout)

{
TypeMatcher matcher = new TypeMatcher(JOptionPane.class, requireShowing());
String description = "option pane to be found using matcher " + matcher;
ComponentFoundCondition condition = new ComponentFoundCondition(description, robot.finder(), matcher);
pause(condition, timeout);
return new JOptionPaneFixture(robot, (JOptionPane)condition.found());
}

Here is the error I get:

Error (org.fest.swing.exception.WaitTimedOutError: Timed out waiting for option pane to be found using matcher org.fest.swing.core.TypeMatcher[type=javax.swing.JOptionPane, requireShowing=true])

NOTE 1: Strangely enough though it may seem, I am able to find a JOptionPane only when the Swing applet launches the component like the following unlike the one stated above:

JOptionPane.showMessageDialog((Component) cbDraw, "need to input a numerical value between high and low!");

Not sure if this is of any significance or not but it's worth mentioning.

NOTE 2: Also I'm not certain whether this issue has anything to do with owner less windows (parent less windows) or the AWT hierarchy state. I've also tried a GenericTypeMatcher search as well. The component does not even show up when dumping out the hierarchy in the logs. Please advise.

---

votes (original issue): 1
watches (original issue): 1

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Empieza reproduciendo el caso del applet Swing y compara JOptionPane.showOptionDialog con la llamada funcional showMessageDialog. Inspecciona m_navigator.optionPane(), la búsqueda de TypeMatcher y el volcado de la jerarquía para determinar por qué no se encuentra el panel de opciones. Se considera terminado cuando el diálogo indicado se puede localizar de forma fiable, o cuando la limitación queda documentada con una prueba de regresión específica.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
desktop, testing
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.