Results 1 to 4 of 4

Thread: Get value out of component and store it globally

  1. #1
    Sencha User oracle7's Avatar
    Join Date
    Jan 2020
    Posts
    21

    Default Answered: Get value out of component and store it globally

    In one test I have to extract value of input component.
    Just need this value from it.

    value.png

    I've been wondering how to extract it in webdriver scenario and pass it to another test (another jasmine.js file)

    var variable = ST.component('tooltiptextfield[name="fullClassification"]').SOME_FUNCTION_I_GUESS_BUT_NOT_SURE_WHICH()

    and where from this point pass it to another test? Somehow to global object at runtime?

    Help pls.

  2. Please try the following:

    Code:
    describe('Get field value', function() {
        it('should set the field value', function() {
            ST.textField('[name="user"]')
                .type('Dan');
        });
        
        it('should get the field value and do something with it', function() {
            ST.textField('[name="user"]')
                .get('value')
                .and(function(future) {
                    // "global" lets you store it globally, so other test suites can see it
                    global.userName = future.data.value;
                });
        });
        
        it('should now do something with the previously obtained field value', function() {
            expect(userName).toEqual('Dan');
        });
    });

  3. #2
    Sencha User oracle7's Avatar
    Join Date
    Jan 2020
    Posts
    21

    Default

    for real, no one?

  4. #3
    Sencha - Sales Team daniel.gallo's Avatar
    Join Date
    Apr 2009
    Location
    London, England
    Posts
    396
    Answers
    75

    Default

    Please try the following:

    Code:
    describe('Get field value', function() {
        it('should set the field value', function() {
            ST.textField('[name="user"]')
                .type('Dan');
        });
        
        it('should get the field value and do something with it', function() {
            ST.textField('[name="user"]')
                .get('value')
                .and(function(future) {
                    // "global" lets you store it globally, so other test suites can see it
                    global.userName = future.data.value;
                });
        });
        
        it('should now do something with the previously obtained field value', function() {
            expect(userName).toEqual('Dan');
        });
    });
    Daniel Gallo

  5. #4
    Sencha User oracle7's Avatar
    Join Date
    Jan 2020
    Posts
    21

    Default

    Bravo! Thank you Daniel!

Posting Permissions

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