mardi 25 juillet 2017

Jasmine 2.6.4 Unit Testing with SetTimeout for Ajax Calls

I tried a lot and there are a lot of questions about this topic, but it didn't work:

describe('Search Expectations',function () {
    it('1 Result found!', function () {
        $("input[name='name']").val("Marina");
        $(".search_btn").click();

        //now wait til Result is loaded:
        setTimeout(function (){
            var results = $(".searchQuery").text();
            expect(results).toBe("1 Result!");
        }, 100);

    });
});

this gives me:

Search Expectations SPEC HAS NO EXPECTATIONS 1 Result found!

How can I make Jasmine 2.6.4 wait for the results and then test?

Aucun commentaire:

Enregistrer un commentaire