arunoda / laika

testing framework for meteor
http://arunoda.github.io/laika/
MIT License
241 stars 38 forks source link

Laika testing really slow #70

Open rickihastings opened 10 years ago

rickihastings commented 10 years ago

Hi, I'm getting really slow test times, no idea whats causing it. My code runs instantly in meteor. I'm pretty sure I'm doing these right (well hopefully I am) but my tests are posted below.

var assert = require('assert');

suite('Client user forms', function() {
    test('register a user through signup form', function(done, server, client) {
        client.eval(function() {
            var homeModule = Object.create(HomeModule);
                homeModule.init();

            homeModule.signupFormSubmit({
                'your-name': 'John Smith',
                'irc-nickname': 'john',
                'email-address': 'john.smith@aol.com',
                'password': '123456',
                'confirm-password': '123456'
            }, function() {
                emit('ready', Session.get('signup.errors'));
            });

        }).once('ready', function(errors) {
            assert.equal(errors, '');
            done();
        });
    });

    test('register a user on the server and attempt to login through form', function(done, server, client) {
        server.eval(function() {
            var output = Meteor.call('registerUser', 'John Smith', 'john', 'john.smith@aol.com', '123456', '123456');
        });

        client.eval(function() {
            var homeModule = Object.create(HomeModule);
                homeModule.init();

            homeModule.loginFormSubmit({'login-email': 'john.smith@aol.com', 'login-password': '123456'}, function() {
                emit('ready', Session.get('login.errors'));
            });

        }).once('ready', function(errors) {
            assert.equal(errors, '');
            done();
        });
    });
});

You can see the homeModule in question here https://github.com/ircanywhere/ircanywhere/blob/0.2.0/client/js/home/module.js if necessary.

arunoda commented 10 years ago

Tell me more about the slowness. It is acceptable to take 800ms - 2000ms. But if more than that, your app initializing db at startup or downloading something (webfonts or something similar)