Home » Eclipse Projects » Remote Application Platform (RAP) » Migrating QFTest support from RAP 2.0 to 3.0: id attribute?
Migrating QFTest support from RAP 2.0 to 3.0: id attribute? [message #1699773] |
Fri, 26 June 2015 13:27 |
Nicolai Czempin Messages: 13 Registered: June 2015 |
Junior Member |
|
|
We are migrating directly from RAP 2.0 to 3.0, skipping 2.2 and 2.3.
I'm a little unsure how I need to get our QFTests (4.x, worked with RAP 2.2) working again, with the changes regarding CUSTOM_WIDGET_ID.
We are using [effectively, not literally] widget.setData("org.eclipse.rap.rwt.customWidgetId", "SomeUniqueId");
In the old application, the SomeUniqueId appears in the id attribute of the div tag of the widget on the JS side, and QFTest uses that to find the widget.
The way they tell you to set the id (https://www.qfs.de/qftest/manual/en/tech_ajax.html#sec_ajax_ids) is how we did it, but this no longer seems to work, the id attribute just seems to get generic ids that are counted up (like "w4", "w5", etc.). I haven't tried their "After applying IDs to components you need to modify your webserver environment and specify following parameter -Dorg.eclipse.rwt.enableUITests=true before launching the webserver." yet as I'm not even sure that the whole suggestion still holds; they use WidgetUtil.CUSTOM_WIDGET_ID, which has been removed.
I read somewhere that we're not supposed to use the id attribute any more, but if not, what changes do I need to make to the QFTests? They claim that RAP 3.0 support is in QFT since their version 3.5.1.
What am I missing?
[Updated on: Mon, 29 June 2015 12:23] Report message to a moderator
|
|
| | | | |
Re: Migrating QFTest support from RAP 2.0 to 3.0: id attribute? [message #1700000 is a reply to message #1699948] |
Mon, 29 June 2015 15:01 |
Tim Buschtoens Messages: 396 Registered: July 2009 |
Senior Member |
|
|
Hi.
Sorry, the answer is a bit complex, so we put off the answer.
Setting the HTML "id" attribute in the old way was disabled a while ago
because it was also changing the id that is used for internally for the
RAP protocol. Assigning the same id twice could cause severe issues.
If you you want to set any HTML attribute, you can do it using the
client JS API [1] (widget.$el.attr). My Blog post on ui-testing[2] links
to a patch[3] that does this with our "controls" demo using this util class:
import static org.eclipse.rap.rwt.lifecycle.WidgetUtil.getId;
import org.eclipse.rap.rwt.RWT;
import org.eclipse.rap.rwt.client.service.JavaScriptExecutor;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Widget;
public class UITestUtil {
private UITestUtil() {
}
static void setTestId( Widget widget, String value ) {
if( !widget.isDisposed() ) {
String $el = widget instanceof Text ? "$input" : "$el";
String id = getId( widget );
exec( "rap.getObject( '", id, "' ).", $el, ".attr( 'test-id', '",
value + "' );" );
}
}
private static void exec( String... strings ) {
StringBuilder builder = new StringBuilder();
builder.append( "try{" );
for( String str : strings ) {
builder.append( str );
}
builder.append( "}catch(e){}" );
JavaScriptExecutor executor = RWT.getClient().getService(
JavaScriptExecutor.class );
executor.execute( builder.toString() );
}
}
This was done for 2.x, but should also work with 3.x.
If you want to do it using widget.setData, that's also possible. If you
need that I can look for the code and upload it somewhere.
Greetings,
Tim
[1]
http://download.eclipse.org/rt/rap/doc/3.0/guide/reference/jsdoc/symbols/Widget.html#$el
[2]
http://eclipsesource.com/blogs/2014/04/29/how-to-write-ui-tests-for-rap-with-selenium-2-0/
[3]
https://github.com/tbuschto/rap-selenium-demo/blob/master/patches/ControlsDemo.patch
Am 29.06.2015 um 14:54 schrieb Nicolai Czempin:
> I seem to be mainly talking to myself here; possibly this is a very old
> issue, since it seems to be part of the "migration from 2.0" rather than
> the "migration to 3.0".
>
> Our custom widgets can read the data, and QF says on their page that
> this is the way you're supposed to do it. You also need to call
> "installToolkitResolver" with the right resolver version. Also remember
> to register any keys. We are doing all that. I am in contact with QF,
> it's possible that it's not an RAP issue (although I have only tested
> custom widgets, whereas the qftest fails with a standard widget, so
> perhaps I'm missing something there)
--
Tim Buschtöns
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
| | | |
Goto Forum:
Current Time: Tue Mar 19 12:43:01 GMT 2024
Powered by FUDForum. Page generated in 0.03098 seconds
|