IDEMPIERE-92 Implement Selenium testing framework. Fixed checkbox support.

This commit is contained in:
Heng Sin Low 2013-04-10 12:44:16 +08:00
parent b0cacd74e0
commit 0292ea8629
1 changed files with 23 additions and 2 deletions

View File

@ -15,6 +15,7 @@ import fitlibrary.annotation.SimpleAction;
import fitlibrary.spider.AbstractSpiderFixture;
import fitlibrary.spider.Finder;
import fitlibrary.spider.SpiderFixture;
import fitlibrary.spider.polling.PollForWithError;
/**
* @author hengsin
@ -42,9 +43,29 @@ public class ZkFixture extends SpiderFixture {
@Override
public boolean withSelect(String locator, final boolean select) {
locator = locator + " ~ input";
Widget widget = new Widget(locator);
final WebElement element = widget.$n(webDriver, "real");
if (element.isSelected()) {
if (!select) {
element.click();
}
} else {
if (select) {
element.click();
}
}
return super.withSelect(locator, select);
ensureBecomes(new PollForWithError() {
@Override
public boolean matches() {
return element.isSelected() == select;
}
@Override
public String error() {
return "Not selected correctly";
}
});
return true;
}
// --------- ComboBox ---------