Results 1 to 3 of 3

Thread: How to clear the content of a form's textfield with the event recorder ?

  1. #1
    Sencha User
    Join Date
    Jul 2016
    Posts
    2
    Vote Rating
    0
      0  

    Default Answered: How to clear the content of a form's textfield with the event recorder ?

    Hi,

    I'm testing a user edition scenario, my users are in a table, and when I click on a row and then the button "edit" it open an Ext Window component. And so basically I have a filled form in this window with the selected user's information.

    I'm am doing interface testing, so I'm using the Event recorder, and my problem is that whatever "clear" action I make when recording, it is not reproduced when launching the test.

    I've tried double clicking in the field then backspace.
    I've tried clicking down on the right in the textfield selecting all the content while clicking and then backspace when I released the click and reached the left of the textfield.
    I've tried clicking in the textfield, then ctrl + A, then backspace.
    None of that is reproduced when launching the test case.

    The only option that works is the less "all scenarii" friendly, backspacing an arbitrary high amount of time after clicking in the field.

    So it appears to me that it's when the text is highlighted when recording that is not reproduced when launching the test.

    How to clear all the content of the textfield when using the recorder ? Without backspacing arbitrarily.

    Thanks in advance.

  2. Hi guys.
    For now, Sencha Test has a problem with special keys in inputs, but we work on it!

    I offer hack for it and I know, that it is not clear solution, but it is only idea what I got.

    Code:
    describe('Input value', function() {
         beforeAll(function(){
            var delPanel = Ext.create('Ext.form.Panel', {
                title: 'DELETE, BACKSPACE',
                width: 300,
                bodyPadding: 10,
                renderTo: Ext.getBody(),
                items: [{
                    xtype: 'textfield',
                    name: 'delete',
                    fieldLabel: 'delete',
                    value: 'Cookie'
                }]
            });
        });
    
        it("should delete text and ST should type new one", function() {
            ST.textField('textfield[name=delete]')
                .and(function(txtField){
                    txtField.setValue(''); // delete everything what is in input
                })
                .type('Cookie monster ate it!')
                .and(function(txtField){
                    expect(txtField.getValue()).toBe('Cookie monster ate it!');
                });
        });
    });
    And I recommend use SenchaTest API, code looks better than code from recorder.

    Look at Don's blog article - really great stuff!
    And git with examples


    Feel free to contact me any time.
    Vojt?ch

  3. #2
    Sencha Premium Member
    Join Date
    Sep 2013
    Posts
    9
    Vote Rating
    0
      0  

    Default

    I am having same issue, someone please help.

  4. #3
    Sencha User vojtech.cerveny's Avatar
    Join Date
    Jun 2015
    Location
    Ostrava, Czech republic
    Posts
    52
    Answers
    10
    Vote Rating
    5
      0  

    Default

    Hi guys.
    For now, Sencha Test has a problem with special keys in inputs, but we work on it!

    I offer hack for it and I know, that it is not clear solution, but it is only idea what I got.

    Code:
    describe('Input value', function() {
         beforeAll(function(){
            var delPanel = Ext.create('Ext.form.Panel', {
                title: 'DELETE, BACKSPACE',
                width: 300,
                bodyPadding: 10,
                renderTo: Ext.getBody(),
                items: [{
                    xtype: 'textfield',
                    name: 'delete',
                    fieldLabel: 'delete',
                    value: 'Cookie'
                }]
            });
        });
    
        it("should delete text and ST should type new one", function() {
            ST.textField('textfield[name=delete]')
                .and(function(txtField){
                    txtField.setValue(''); // delete everything what is in input
                })
                .type('Cookie monster ate it!')
                .and(function(txtField){
                    expect(txtField.getValue()).toBe('Cookie monster ate it!');
                });
        });
    });
    And I recommend use SenchaTest API, code looks better than code from recorder.

    Look at Don's blog article - really great stuff!
    And git with examples


    Feel free to contact me any time.
    Vojt?ch

Similar Threads

  1. Event recorder Guide
    By Daniele.Milani in forum Q&A
    Replies: 4
    Last Post: 20 May 2016, 12:57 AM
  2. Replies: 2
    Last Post: 6 May 2016, 8:09 AM
  3. Event Recorder Hangs on Launching
    By ruairioliver in forum Bugs
    Replies: 4
    Last Post: 5 Apr 2016, 6:54 AM
  4. Event recorder
    By mtatsky in forum Bugs
    Replies: 1
    Last Post: 17 Dec 2015, 1:45 PM
  5. Event for TextField's clear?
    By Bucs in forum Sencha Touch 1.x: Discussion
    Replies: 9
    Last Post: 7 Dec 2011, 8:01 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •