Created
March 24, 2017 20:22
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's how it looks in the Sencha Test Studio
Then if you want to run it: