How do you get Selenium to work with SmartGWT components? - gwt

I'm trying to use Selenium to select a row in a SmartGWT table.
I have tried the following commands to no avail (the click definitely happens but the table widget doesn't respond):
selenium.mouseDownAt("isc_ContactListGrid_0_wrapper", "50,50");
selenium.clickAt("isc_ContactListGrid_0_wrapper", "50,50");

You need to install SmartGWT user extensions and use specific SmartGWT locator (scLocator)
See more here - http://www.rhq-project.org/display/RHQ/Testing+SmartGWT+with+Selenium

Related

How to integrate react-dnd into admin-on-rest?

Has anyone tried to integrate react-dnd or another lib into admin on rest?
I wanted to make datagrid draggable inside a referencearrayfield.
Should i write my own component overriding datagrid or there's a simple way to do it?
Thanks!
You'll have to implement a custom datagrid for that
Although experimental you can have a look on this plugin: https://github.com/marmelab/react-admin/tree/master/packages/ra-tree-ui-materialui
It has as dependency react-dnd and it seems that it is editing the listing. Not sure if it can update a property used for ordering like order for example

Problems while working with Webdriver on HTML 5 and ExtJs

I am working on an application which is developed in ExtJs and is a HTML 5 type.
I an confronting a problem while interacting with button clicks and selecting drop down elements where only one option is present in the DD list.
Is this a problem with my Webdriver Code
Is this a problem with Eclipse (By Kepler)
Or is this a problem of HTML 5 or ExtJs
If driver.findElement(By.something).click(); is not working for you you cant try click through java script:
((JavascriptExecutor)driver).executeScript(script, element);
Example:
WebElement element = driver.findElement(By.id("MainButton"));
((JavascriptExecutor)driver).executeScript("arguments[0].click()", element);
HTML 5, at the time of writing, is not fully supported with Selenium IDE. A good
example of this is elements that have the contentEditable=true attribute. If
you want to see this, you can use the type command to type something into the
html5div element. The test will tell you that it has completed the command but
the UI will not have changed

WebDriver GWT TabPanel Issue

I'm trying to create a WebDriver Test for a GWT application which uses a TabPanel. Clicking on a tab works fine in the IDE (it uses the x-path to find the tab) however I cannot get the tab click working in the JUnit test.
All elements have a debugID including the Tabs (although tab id's do not appear to work even in the IDE) and I'm inheriting com.google.gwt.user.Debug. I've attempted to locate by Xpath which is the IDE default.
genericElement.findElement(By.xpath("//div[#id='gwt-debug-mainTabPanel']/div[2]/div/div[6]/div/div")
I've tried the code outlined in the documentation
genericElement.findElement(By.id("gwt-debug-mainTabPanel-bar-tab6")
I've also attempted a moveToelement(as clickAt is no longer supported) and click but that falls over too(unless I'm misunderstanding it). I'd also like to avoid this as it seems bad practice.
Actions builder = new Actions(driver);
genericElement = driver.findElement(By.id("gwt-debug-mainTabPanel"));
Action action = builder.moveToElement(genericElement,400, 370).click().build();
action.perform();
java.lang.UnsupportedOperationException: Moving to arbitrary X,Y
coordinates not supported.
I know GWT and Webdriver aren't getting along too well - but I feel like this will have a solution. Can anyone offer any help - has anyone implemented a working Webdriver test in which they click a tab in a GWT TabPanel?
EDIT
I've managed to locate the node using Firebug and xpath locators ( you can add /..to move to the parent gwt-TabLayoutPanelTabInner or add /../.. to mover to grandparent gwt-TabLayoutPanelTabInner and it should still work - it does in the IDE)
genericElement = driver.findElement(By.xpath("//div[contains(#class,'gwt-HTML') and contains(text(),'Users')]"));
However not the click doesn't change to the required tab - seems to be a known issue (likely don't need both moveToElement and click(genericElement) - hust giving it a shot)
Actions builder = new Actions(driver);
builder.moveToElement(genericElement).click(genericElement).build().perform();
See section 3 ....This is fun :)

GWT integration with SmartGWT - Cant select text SectionStack->Section->Canvas->HTML

we've used a combination of GWT and smart gwt to add some features to an app we've built.
The problem I have is that we decided to make use of the accordion functionality (SectionStack's) that SmartGWT offers and we are nesting our stock gwt widget inside a canvas and then nesting that inside the section stack. E.G
SectionStack(SmartGWT)->Section(SmartGWT)->Canvas (SmartGWT)->VerticalPanel(GWT) -> Other GWT Widgets (HTML, labels etc)
Before we mixed GWT and SmartGWT it was possible to select text in the standard GWT widgets and then copy and paste etc. Nesting the GWT widgets in the SmartGWT canvas means this is now not possible. Can anyone offer an explanation why this is the case and/or a solution on how to fix it.
I've tried canvas.setCanSelectText(true); but this doesn't seem to do anything either.
We're using GWT 2.1 with SmartGWT 2.2. The demo app using SmartGWT2.2 seems to exhibit the same problem over at http://www.smartclient.com/smartgwt/showcase/#featured_gwt_integration . I've also tried GWT 2.0.x with SmartGWT 2.2
Any help appreciated.
For those interested I've managed to find a bug registered for this at : code.google.com/p/smartgwt/issues/…
Actually it is not an issue. You have to call the setCanSelectText method on the WidgetCanvas wich is wrapping your GWT widget. The WidgetCanvas is created in the addItem(Widget) method. One way to go is to override the addItem method like this:
#Override
public void addItem(Widget widget) {
if (widget instanceof Canvas) {
addItem((Canvas) widget);
} else {
WidgetCanvas wg = new WidgetCanvas(widget);
wg.setCanSelectText(true);
addItem(wg);
}
}

SmartGWT Widgets not displaying properly

I have a basic GWT Maven project going. I added SmartGWT and started playing around with some widgets and nothing displays correctly. The ListGrid seems to somewhat render but things are off and even data isnt showing up (though the rows respond to indicate there is data within the row). Sorting arrows dont appear but are clickable, and filters are wildy off. Whats causing this. I deleted everything in the .css file.
GWT newbie here.
Did you add the following to your host html file?
var isomorphicDir = "MODULE_NAME/sc/";
where MODULE_NAME is the name of your GWT module. ie the name you have in your GWT module xml file.
See http://forums.smartclient.com/showthread.php?t=8159#aImages
fyi the next release of Smart GWT will no longer require users to add the isomorphicDir variable to the host html file.