Questions tagged [chai-as-promised]

Chai as Promised is an extension for the Chai assertion library which adds the capability for assertions about promises.

Chai as Promised is an extension for the Chai assertion library which adds the capability for assertions about promises. It is compatible with any promises which follow the Promises/A+ specification.

116 questions
0
votes
1 answer

How do i check a count value in chai-as-promised?

I use cucumber and chai-as-promised as assertion library. What is the right way to check the count value. I use equal but it works only after converting string to integer.Is there a way to assert a integer value directly? this.Then(/^the list should…
meteor
  • 2,518
  • 4
  • 38
  • 52
0
votes
1 answer

Functional testing with grunt-webdriver, mocha and chai-as-promised

I'm trying to build a functional testing system to verify our web site is behaving correctly for our users. I have cobbled together a bunch of Node.js modules and helpers in an attempt to get a framework that provides simple, concise tests without a…
Waddles
  • 197
  • 1
  • 5
0
votes
1 answer

verifying contents of a resolved promise via function call with chai-as-promised

I'm using chai-as-promised in conjunction with sinonjs and I'm unable to work out how to verify a changed password. I have something like the following code: it('changes password if old password is valid', function(){ var u = new User({id:…
Peter Whitfield
  • 495
  • 1
  • 5
  • 13
0
votes
1 answer

Catching errors with chai and promises

I would like to know how to stop the console from printing stack dumps on test with promises that throw errors. doCallTest = function() { var p = new Promise(function(resolve, reject) { reject(new Error('Nooooo')); }).catch(function(err)…
cyberwombat
  • 38,105
  • 35
  • 175
  • 251
0
votes
2 answers

How to use Webdriver.io with Chai as Promised to verify css property

Currently using Webdriver.io with Mocha, Chai, and Chai-as-Promised however I am struggling to get the promise to validate when trying to validate a CSS property: The code: 'use strict'; var chai = require('chai'), chaiAsPromised =…
Matt
  • 2,803
  • 9
  • 33
  • 57
0
votes
2 answers

How do I test for non-nullness of a property in Chai-as-Promised

How do I test that an object retrieved from a fulfilled promise has a non-null property? I have a promise that returns an object similar to the following: { id: 1, aDate: 2015-02-12T11:50:00.511Z } I need to check that the aDate property is…
Kallja
  • 5,362
  • 3
  • 23
  • 33
0
votes
2 answers

Chai-as-promised, Promised array must be loosely-equal

Is there a way to assert that a promise array equals your gold standard, minus ordering? Deep equal fails because the ordering isn't guaranteed - the array is being built asynchronously. As far as I can tell, CaP doesn't include a…
Ledivin
  • 637
  • 5
  • 18
-1
votes
1 answer

what is the best approach to handle promises with chai-as-promised?

I just want to know that whether this approach is good or not while using chai-as-promised with mocha and protractor? let options = customers.all(by.tagName('option')); options.then(function (items){ for(let i=0 ;…
Zohaib Sohail
  • 310
  • 3
  • 14
-1
votes
1 answer

Is using Promise a better solution instead of using timeout for API testing - mocha

Is using Promise a better solution instead of using timeout for API testing using mocha/chai? I am getting error like this below for lot of tests and want to prevent those errors. Error: timeout of 2000ms exceeded. Ensure the done() callback is…
RajKon
  • 420
  • 1
  • 8
  • 20
-1
votes
2 answers

Chai as promised not waiting for promise to be fulfilled

An output of my console. Note that the console logs are out of order (1,3,4,2 instead of 1,2,3,4) Code here it('can store file', () => { console.log('1) file storage start') return filestore.store.q(file).then(() => { …
A F
  • 7,424
  • 8
  • 40
  • 52
-1
votes
1 answer

Selenium-Webdriver w/ Chai as Promised and Mocha failing to wait

I've got a simple coffeescript test w/ Selenium-Webdriver using Chai-as-Promised and Mocha which is supposed to test a web page that I have that uses an AJAX call to do authentication once a login button is pressed: selenium = require…
Simon
  • 1,819
  • 3
  • 18
  • 26
1 2 3 4 5 6 7
8