How to test popup functionality?

Answered

Hi,

My Plugin opens up an actionGroupPopup. Now iam trying to run a test on this.

Here is how i open the popup:

var editor = actionEvent.getRequiredData(CommonDataKeys.EDITOR);

var popup = JBPopupFactory.getInstance()
.createActionGroupPopup(null, actionGroup, actionEvent.getDataContext(), SPEEDSEARCH, false);

popup.showInBestPositionFor(editor);

Here is how my test is (currently) looking:

public class MyTestClass extends LightJavaCodeInsightFixtureTestCase {

@Test
public void test() throws Exception {
setUp();
myFixture.configureByFiles(inputFiles);
myFixture.testAction(new TestAction());
myFixture.checkResultByFile(resultFile));
}
}

 

The problem i have is that i run into this exception:

java.lang.Throwable: Assertion failed: dataContext has no component for new ListPopupStep

A breakpoint at this line shows that my light fixture is setting up the dataContext and i have no control over it. Is there anything i can do?

 

Please sign in to leave a comment.