Support Forum
I am using the type() method to simulate a user entering text. However, I do not see a way to simulate the user pressing the caps-lock (or shift) key.
My test case is a password field that displays a warning message if it detects that the user is entering text with the caps lock on.
If this is already possible, please let me know. Thank you.
My test case is a password field that displays a warning message if it detects that the user is entering text with the caps lock on.
If this is already possible, please let me know. Thank you.
We are planning to add native events simulation (using Java applet). It will support pressing any keys (I think). Applet won't work on mobile though..
Read the API documentation
@mats
Ok - I finally got the Tab key to work. The problem was because in speed run mode, the combo would not auto-complete before the field was tabbed. When I switched speed run off in the UI, then the test passed. Can speed run be disabled per test? It appears like the Harness.configure option does not take precedence over the UI dropdown menu "Speed run" check item. If I have speedRun:false in the configure object but the UI is true, the tests still run fast. Can you clarify?
I don't see this special syntax (e.g. '[TAB]') mentioned in the docs for t.type. Are the supported keys listed somewhere else?
Here is my code:
Thanks!
Ok - I finally got the Tab key to work. The problem was because in speed run mode, the combo would not auto-complete before the field was tabbed. When I switched speed run off in the UI, then the test passed. Can speed run be disabled per test? It appears like the Harness.configure option does not take precedence over the UI dropdown menu "Speed run" check item. If I have speedRun:false in the configure object but the UI is true, the tests still run fast. Can you clarify?
I don't see this special syntax (e.g. '[TAB]') mentioned in the docs for t.type. Are the supported keys listed somewhere else?
Here is my code:
StartTest(function(t) {
t.diag('Combo field');
var store = Ext.create('Ext.data.ArrayStore',{
fields: ['text'],
data: [
['Form'],
['Grid'],
['Dirty']
]
});
var cmp = Ext.create('Ext.form.field.ComboBox',{
fieldLabel: 'Combo',
allowBlank: false,
displayField: 'text',
editable: true,
forceSelection: true,
queryMode: 'local',
selectOnFocus: true,
store: store,
typeAhead: true,
valueField: 'text',
renderTo: Ext.getBody()
});
t.pass('Rendered');
var el = cmp.inputEl;
t.click(el, function(){
//simulate tab key for auto-complete
t.type(el, 'Dir[TAB]', function(){ //type partial match
t.is(cmp.getValue(), 'Dirty', 'Correct value in field');
});
});
});
Updated the docs of `type` method (mentioned the support for some advanced keys) and listed all keys.
Btw, there's no need to manually extract the "inputEl" from field - Siesta can do that for you (for Ext.form.Field). If you will pass Ext.Component it will use its `getEl` method to get the DOM element.
About the `speedRun` issue - indeed, `speedRun` should not affect the outcome of the test. However in this particular case it does, because Ext has the "typeAheadDelay" parameter and the auto-suggestion will appear only after slight delay.
This works for me in speed run:
Btw, there's no need to manually extract the "inputEl" from field - Siesta can do that for you (for Ext.form.Field). If you will pass Ext.Component it will use its `getEl` method to get the DOM element.
About the `speedRun` issue - indeed, `speedRun` should not affect the outcome of the test. However in this particular case it does, because Ext has the "typeAheadDelay" parameter and the auto-suggestion will appear only after slight delay.
This works for me in speed run:
StartTest(function(t) {
t.diag('Combo field');
var store = Ext.create('Ext.data.ArrayStore',{
fields: ['text'],
data: [
['Form'],
['Grid'],
['Dirty']
]
});
var cmp = Ext.create('Ext.form.field.ComboBox',{
fieldLabel : 'Combo',
allowBlank : false,
displayField : 'text',
editable : true,
forceSelection : true,
queryMode : 'local',
selectOnFocus : true,
store : store,
typeAhead : true,
valueField : 'text',
renderTo : Ext.getBody()
});
t.pass('Rendered');
t.click(cmp, function(){
//Siesta makes a small pause after each action, like "type"
t.type(cmp, 'Dir', function(){ //type partial match
//simulate tab key for auto-complete
t.type(cmp, '[TAB]', function(){ //type partial match
t.is(cmp.getValue(), 'Dirty', 'Correct value in field');
});
});
});
});
Read the API documentation
Implemented this in the trunk - you can specify it in the test descriptor now. See the attached trial.zombeerose wrote: Can speed run be disabled per test?
Yes, thats intended, the idea is that you can temporarily change various options (like "transparentEx" is very useful for debugging) and keep their values after page refresh, w/o the need to modify the sources.zombeerose wrote: It appears like the Harness.configure option does not take precedence over the UI dropdown menu "Speed run" check item. If I have speedRun:false in the configure object but the UI is true, the tests still run fast. Can you clarify?
- Attachments
-
- siesta-1.0.3-trial.zip
- (3.32 MiB) Downloaded 510 times
Read the API documentation