mardi 26 juillet 2016

Debounce function not firing in Cucumber.js & Zombie.js feature test

I have a feature test that tests the following

Given I am on "search" listing
When I search for "31380" by "instance-id"
Then "1" "orders" are shown

The #instance-id input has a debounce function tied to it which after 250ms of no changes runs a function that changes the url.

Problem is that the URL in the Zombie browser never changes.

this.When(/^I search for "([^"]*)" by "([^"]*)"$/, async function(value, input) {
  this.browser.fill('#${input}', value);

  await this.waitForURLChange();

  console.log(this.browser.location.href); // yields http://localhost:3000/search instead of http://localhost:3000/search?ids=31380

  return this.browser.assert.url({ query: { ids: value } });
});

The waitForURLChange function has an interval that checks for a different URL every second for 4 seconds. After that it returns true. So it's safe to say that the URL hasn't changed in 4 seconds after the input was changed.

Why is this happening?

Thanks

Aucun commentaire:

Enregistrer un commentaire