JetBrains / intellij-ui-test-robot

The library allows you to write and execute UI tests among IntelliJ IDEA. You can test your Plugin.

Home Page:https://jetbrains-platform.slack.com/archives/C026SVA9MMM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Selecting comboBox items with quotation marks results in a parsing exception

MTSym opened this issue · comments

commented

If you try to select a combo box containing quotation marks you will receive a javascript parsing exception because those quotation marks are not escaped.

Even if the input for comboBox.selectItem is escaped the resulting JS script is unescaped again.

Reproducer:

actionMenu(remoteRobot, "File").click();
actionMenuItem(remoteRobot, "Project Structure...").click();

var comboBox = remoteRobot.find(ComboBoxFixture.class, byXpath("//div[@class='JdkComboBox']"), Duration.ofSeconds(2));
comboBox.selectItem("18  java version \"18\"");
//comboBox.selectItemContains("java version");

Result which get sent:

ctx.get('fixture').selectItem("18  java version "18"")
commented

Tried it with a workaround which seems fine for now.

var comboBox = remoteRobot.find(ComboBoxFixture.class, byXpath("//div[@class='JdkComboBox']"), Duration.ofSeconds(2));
comboBox.click();

var list = remoteRobot.find(JListFixture.class, byXpath("//div[@class='MyList']"), Duration.ofSeconds(2));
list.clickItem("18 ", false);

So instead of using selectItem or selectItemContains from the combobox fixture I click on it and grab the list fixture which appears. By using clickItem which internally uses clickItemAtIndex everything works as expected. Maybe the selectItem of the combobox can be changed to also use the index of the item instead of sending the string as JS