Giter Site home page Giter Site logo

Comments (7)

esalman-sfdc avatar esalman-sfdc commented on August 16, 2024

I wonder if its timing issue as the callback passed to $A.createComponent() inside generateOrderForm() is async. May be try waiting (e.g. $T.waitFor(..)) for body length to change.

from lightningtestingservice.

tylerzika avatar tylerzika commented on August 16, 2024

@esalman-sfdc like this?

$T.createComponent("c:pageContainer", {}, true)
.then(function(component){  
    $T.waitFor( function() {
        return component.get("v.body").length == 1;
    }, "component has loaded", 15000);

    $T.run(function () {
        expect(component.get("v.body").length).toBe(1);
    });
    done();
}).catch(function(e) {
    done.fail(e);
});

If so, doesn't work.

from lightningtestingservice.

esalman-sfdc avatar esalman-sfdc commented on August 16, 2024

I don't think thats correct usage. See,

Method Signature here
Sample Usage here

from lightningtestingservice.

tylerzika avatar tylerzika commented on August 16, 2024

Like this?

            $T.createComponent("c:pageContainer", {}, true)
            .then(function(component){ 
                return $T.waitFor(function(){
                    return component.get("v.body").length === 1;
                })
                expect(component.get("v.body").length).toBe(1);
                done();
            }).catch(function(e) {
                done.fail(e);
            });

from lightningtestingservice.

esalman-sfdc avatar esalman-sfdc commented on August 16, 2024

waitFor returns a promise, so you'd need to chain it,

            $T.createComponent("c:pageContainer", {}, true)
            .then(function(component){ 
                return $T.waitFor(function(){
                    return component.get("v.body").length === 1;
                })
            }).then(function() {
                done();
            }).catch(function(e) {
                done.fail(e);
            });       

from lightningtestingservice.

tylerzika avatar tylerzika commented on August 16, 2024

this is for writing a jasmine test, correct?

from lightningtestingservice.

esalman-sfdc avatar esalman-sfdc commented on August 16, 2024

Pattern should work for both jasmine and mocha. If you are having trouble, feel free to link a gist/repo/unmanaged-package and I can have a closer look.

from lightningtestingservice.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.