Skip to content

Instantly share code, notes, and snippets.

@branflake2267
Created March 24, 2017 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save branflake2267/2ffc5a2ba9053dca1757b72136526d99 to your computer and use it in GitHub Desktop.
Save branflake2267/2ffc5a2ba9053dca1757b72136526d99 to your computer and use it in GitHub Desktop.
Using the Sencha Test Studio to Test my GXT App... Here is a quick example of how to wire up a Suite for Sencha Studio.
public class Gxt4SandboxProjectEntryPoint implements EntryPoint {
private HTML label;
@Override
public void onModuleLoad() {
ContentPanel northWidget = new ContentPanel();
northWidget.add(new HTML("north"));
ContentPanel centerWidget = new ContentPanel();
centerWidget.add(createCenterWidget());
BorderLayoutContainer blc = new BorderLayoutContainer();
blc.setNorthWidget(northWidget);
blc.setWidget(centerWidget);
Viewport viewport = new Viewport();
viewport.add(blc, new MarginData(20));
RootPanel.get().add(viewport);
}
private Widget createCenterWidget() {
label = new HTML("Label");
label.ensureDebugId("center-label");
TextField field = new TextField();
field.ensureDebugId("center-field");
field.addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> event) {
label.setHTML("Label " + event.getValue());
}
});
TextButton button = new TextButton("Button");
button.ensureDebugId("center-button");
VerticalLayoutContainer vlc = new VerticalLayoutContainer();
vlc.add(label);
vlc.add(field);
vlc.add(button);
return vlc;
}
}
describe("Suite", function() {
it("label is updated with field text", function() {
// 1. When I have a field and I focus and type hello, then blur
ST.element('@gwt-debug-center-field')
.element('input')
.focus()
.type('Hello')
.element('@gwt-debug-center-button')
.click(10, 10);
// 3. It will update the label with the field text.
ST.element('@gwt-debug-center-label')
.textLike('Hello');
});
});
@branflake2267
Copy link
Author

branflake2267 commented Mar 24, 2017

Here's how it looks in the Sencha Test Studio
screen shot 2017-03-24 at 1 23 18 pm

Then if you want to run it:
screen shot 2017-03-24 at 1 25 26 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment