Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zombie driver does not wait for XHR/triggers #2

Closed
michelsalib opened this issue Jun 18, 2012 · 18 comments
Closed

Zombie driver does not wait for XHR/triggers #2

michelsalib opened this issue Jun 18, 2012 · 18 comments
Labels

Comments

@michelsalib
Copy link

I am currently testing some stuffs with XHR requests. Everything is working fine with selenium because I can manually wait for the XHR to end.

  1. Is it a good practice ? I don't feel good about manually waiting for a predefined amount of time for the end of my XHR
  2. How to properly wait with zombie ?

Thanks :)

@b00gizm
Copy link
Contributor

b00gizm commented Jun 18, 2012

The ZombieDriver::wait() method triggers Zombie.JS' browser.wait() method which should fire a callback after every resource is loaded and every XHR request is completed.

Could you provide some sample code for me to check?

Cheers,
Pascal

@michelsalib
Copy link
Author

Providing an example would not be easy, but I could provide one soon.

Currently, calling wait does not change a thing... And if I reproduce the same test on selenium driver, the XHR goes correctly... So my guess it must come from zombie.

@b00gizm
Copy link
Contributor

b00gizm commented Jun 18, 2012

Which version of ZombieJS is installed on your machine?

@michelsalib
Copy link
Author

$ npm list -g
/usr/local/lib
├── less@1.3.0 
├─┬ npm@1.0.106 
│ ├── abbrev@1.0.3 
│ ├── graceful-fs@1.1.8 
│ ├── ini@1.0.2 
│ ├─┬ minimatch@0.2.5 
│ │ └── lru-cache@1.1.0 
│ ├── node-uuid@1.2.0 
│ ├── nopt@1.0.10 
│ ├── proto-list@1.0.0 
│ ├── request@2.1.1 
│ ├── rimraf@1.0.9 
│ ├── semver@1.0.14 
│ ├── slide@1.1.3 
│ └── which@1.0.5 
└─┬ zombie@0.12.15
  ├── coffee-script@1.2.0 
  ├─┬ jsdom@0.2.10 
  │ ├── contextify@0.0.7 
  │ ├── cssom@0.2.3 
  │ ├── htmlparser@1.7.6 
  │ └── request@2.9.202 
  ├── mime@1.2.5 
  └─┬ ws@0.4.18 
    ├── commander@0.5.2 
    ├── options@0.0.3 
    └── tinycolor@0.0.1

@michelsalib
Copy link
Author

I am way outdated, node and zombie... let me update!

@michelsalib
Copy link
Author

Ok, I am with zombie 1.3.1. But now it looks like my javascript files are not fetched. I had matched routes in my logs before, and not anymore.

@b00gizm
Copy link
Contributor

b00gizm commented Jun 18, 2012

For now, please stick with ZombieJS 0.12.x

There are some compatibility problems with newer versions, but I didn't find time yet to investigate.

I'll push a fix for the wait method in a couple of minutes :) Stay tuned.

@michelsalib
Copy link
Author

Ok, I'll wait for it :)

b00gizm added a commit that referenced this issue Jun 18, 2012
New implementation for ZombieDriver::wait() since newer versions of ZombieJS provide support for timeout / conditional execution while waiting.
@b00gizm
Copy link
Contributor

b00gizm commented Jun 18, 2012

Update pushed :) Please try again.

@ghost ghost assigned b00gizm Jun 18, 2012
@michelsalib
Copy link
Author

I am now on zombie 1.3.1. I cannot get my page to load with this ugly error:

exception 'Behat\Mink\Exception\DriverException' with message 'Could not load resource for URL 'http://localhost/app_test.php/fr/category/smartphones'' in vendor/behat/mink-zombie-driver/src/Behat/Mink/Driver/ZombieDriver.php:174

@b00gizm
Copy link
Contributor

b00gizm commented Jun 18, 2012

Like I said: Please downgrade to ZombieJS 0.12.x since there are some BC issues with newer versions.

But besides, it seems like it can not load the given URL. Are you sure it is correct? Can you access it in your browser?

@michelsalib
Copy link
Author

I just downgraded to zombie@0.12.15. And my page loads again (btw it always ran with selenium).

XHR are not successfully executed, because I don't have any trace in my test.log file. Here is my scenario:

Scenario: I can fill compare basket
    When I am on "/fr/category/smartphones"
     And I follow "Comparer"
     And I wait
    Then the url should match "/fr/category/smartphones"
     And I should see "iPhone" in the ".basket" element

@michelsalib
Copy link
Author

I looks like I am a victim of this issue: assaf/zombie#181.

So I whould need to upgrade zombie after all.

@b00gizm what do you think ?

@b00gizm
Copy link
Contributor

b00gizm commented Jun 18, 2012

What is the implementation of your "And I wait" step?

And maybe you could work around this issue with ZombieDriver::triggerBrowserEvent()?

I'm sorry, but the investigation of the issues I ran into with ZombieJS >= 0.13.0 will take some time, I think. I definitely wanted to look into it this weeks, but I can't promise :-/

@b00gizm
Copy link
Contributor

b00gizm commented Jun 18, 2012

Since I don't know the code for your site, I fear that I'm not able to help you at the moment :(

But I would appreciate, if you could provide a PR with a failing unit test for this case, so I could look into this issue.

@michelsalib
Copy link
Author

My implementation: $this->getSession()->wait(5000);

I wont go further with the triggerBrowserEvent method as long as I am running late on other issues and it really looks like an issue of zombie.

I think we mostly need to make the driver compatible with the last version of zombie. If you need any help for review or test purpose don't hesitate :)

@aik099
Copy link
Member

aik099 commented Nov 30, 2013

I've made driver compatible with latest Zombie version (2.0-alpha24). Can you please update to @dev versions of both Mink and MinkZombieDriver and test all things work now on your side?

@aik099
Copy link
Member

aik099 commented May 1, 2014

Closing because of no activity for 2 years.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants