Results 1 to 4 of 4

Thread: Page Object value change

  1. #1
    Sencha User
    Join Date
    Oct 2017
    Posts
    5
    Vote Rating
    0
      0  

    Default Page Object value change

    How would you go about testing a PageObject Text Field after changing its value?

    If the value of the TextField is 'a' on load, then changed to 'b', stpo.PageObject.TextField.expect('value').toBe('b'); actually expects a still.

    Is there any way to test that its value has changed?

  2. #2
    Sencha - Sales Team daniel.gallo's Avatar
    Join Date
    Apr 2009
    Location
    Redwood City, CA
    Posts
    141
    Answers
    12
    Vote Rating
    20
      0  

    Default

    The example below demonstrates a couple of ways you can check a value has changed. I tested this against the Login example in the Ext JS Kitchen Sink:

    Code:
    describe('Login screen', function() {
        it('Should update login name correctly', function() {
            // Check login field value is empty - use the built in "value" API, or a manual expectation
            stpo.Login.login().value('');
            stpo.Login.login().expect('value').toEqual('');
            
            // Update login value
            stpo.Login.login().setValue('dan');
            
            // Check value has updated successfully - use the built in "value" API, or a manual expectation
            stpo.Login.login().value('dan');
            stpo.Login.login().expect('value').toEqual('dan');
        });
    });
    And here is the associated page object:

    Code:
    ST.pageobject.define('Login', {
        _locators: {
            /**
            * @method login
            * @member stpo.Login
            * @return {ST.future.TextField}
            */login: {
                locator: 'textfield[name="user"]',
                name: 'login',
                type: 'textField',
                className: 'ST.future.TextField'
            }
        }
    });
    Daniel Gallo
    Senior Solutions Architect
    Sencha Inc.

  3. #3
    Sencha User
    Join Date
    Oct 2017
    Posts
    5
    Vote Rating
    0
      0  

    Default

    Thank you for the reply Daniel.

    While I understand this functionality my issue was testing the value property after doing things in the application instead of hard coding the setValue in Sencha test. I should have been more detailed in my question.

    When setting the new field there is additional functionality where you are prompted a panel and this value is what I am not getting. In dev tools it is updating the value, but sencha test studio does see the new value.

  4. #4
    Sencha - Sales Team daniel.gallo's Avatar
    Join Date
    Apr 2009
    Location
    Redwood City, CA
    Posts
    141
    Answers
    12
    Vote Rating
    20
      0  

    Default

    I'm unable to replicate this issue - are you sure Sencha Test is referencing the correct field in your application, which is why the value is not coming back?

    Here's another example, which works against the Binding demo in the Kitchen Sink - this test clicks a button, which in-turn updates the text field's value (not being set directly in the test), then we assert that the value has changed:

    Code:
    describe('ValueChange', function() {
        it('Should have an updated value in the text field after clicking the button', function() {
            // Check initial text field value - it should be "The title"
            stpo.BindingExample.titleField().value('The title');
            
            // This button click causes the text field's value to update in the app
            stpo.BindingExample.button().click();
    
    
            // Text field value should have changed to a random value.
            // Two methods:
            stpo.BindingExample.titleField().expect('value').not.toEqual('The title');
            stpo.BindingExample.titleField().valueNotLike('The title');
        });
    });
    And the associated page object:

    Code:
    ST.pageobject.define('BindingExample', {
        _locators: {
            /**
            * @method button
            * @member stpo.BindingExample
            * @return {ST.future.Button}
            */button: {
                locator: 'button[text="Random Title"]',
                name: 'button',
                type: 'button',
                className: 'ST.future.Button'
            },
            /**
            * @method titleField
            * @member stpo.BindingExample
            * @return {ST.future.TextField}
            */titleField: {
                locator: 'textfield[fieldLabel="Title"]',
                name: 'titleField',
                type: 'textField',
                className: 'ST.future.TextField'
            }
        }
    });
    Daniel Gallo
    Senior Solutions Architect
    Sencha Inc.

Similar Threads

  1. display pb for several Ext object on same jsp page
    By jhgfd69 in forum Ext: Discussion
    Replies: 1
    Last Post: 28 Jun 2012, 8:46 AM
  2. Ext.data.proxy Change page initial value for first page
    By NicMic in forum Sencha Touch 2.x: Q&A
    Replies: 2
    Last Post: 22 Feb 2012, 2:32 AM
  3. EXTJS: How to pass the userinfo object from login page to actual js page
    By balaji1_1 in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 18 Aug 2010, 12:02 PM
  4. change the page property of <jsp:include page="..."> in javascript
    By ruralclimber in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 10 Sep 2009, 9:56 AM

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
  •