assert is not defined

627 views
Skip to first unread message

visal...@honestbee.com

unread,
May 26, 2015, 5:39:20 AM5/26/15
to bust...@googlegroups.com
Hi I am new to busterjs and I was writing a simple test case using the buster-functional extension
However, whenever I try to assert, I always get errors, here is my code:

var testCase = buster.testCase("Simple tests", {
    setUp: function(done)
    {
      console.log('kjaslkdjfaslkdf');
      this.load("/index").waitForVar('$', done);
    },

    "Click on available postal code with no input": function(done)
    {
        this.type('.form-control', '228396');
        this.click('.btn.btn-primary', function()
            { 
              assert('true');
            done();
       });
    }
});



I tried using different versions eg this.assert('true')     or     assert.contains(this.$('.error-msg.alert-zone-error-msg').text(), 'Enter your postal code');
But none of these work

I get the following exception: 

Uncaught exception: ./test/simpleTest-test.js:53 Uncaught ReferenceError: assertUncaught exception in [object Object]:


  UncaughtError: ./test/simpleTest-test.js:53 Uncaught ReferenceError: assert is not defined

So is there any suggestion on what I might be doing wrong?

Message has been deleted

Garrick Cheung

unread,
May 26, 2015, 11:30:47 PM5/26/15
to bust...@googlegroups.com
Try adding th following above your testCase code:

var assert = buster.assert;

visal...@honestbee.com

unread,
May 27, 2015, 2:36:11 AM5/27/15
to bust...@googlegroups.com
Yup, with using the following line, the assert error is gone, but I am still unable to use 'assert.contains'

Having this line:  assert.contains(this.$('label.error-msg.alert-zone-error-msg-home').text(), 'Enter your 6-digit postal code');
I get this error: 

Uncaught exception: ./buster/bundle-0.7.js:8694 Uncaught AssertionError: [assert.containsUncaught exception in [object Object]:


  UncaughtError: ./buster/bundle-0.7.js:8694 Uncaught AssertionError: [assert.contains] Expected [] to contain Enter your 6-digit postal code

Reply all
Reply to author
Forward
0 new messages