-
Notifications
You must be signed in to change notification settings - Fork 49
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
Support zombie.js options #154
Conversation
* | ||
* @return array | ||
*/ | ||
public function getOptions() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at order of existing setters/getters shows that all getters are grouped into one group, and all setters are grouped into another group. Could you please move your setter/getter to comply with that?
Also if you can create some tests for changed code, this would be great. You can manually create ZombieServer and talk to it without using driver class as well. |
/** | ||
* Set options array. | ||
*/ | ||
public function setOptions($options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update example in README.md to show that it's now possible to set Zombie options.
While we're at it you can send PR's to MinkExtension and PHPUnit-Mink to update Zombie integration to allow specifying Zombie options in there as well.
That would be a great addition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than updating the readme, it would be better to update the docs repo though
@robballou , any updates? |
I might have some leeway this week to work on it. Thanks |
/** | ||
* Set a single option. | ||
*/ | ||
public function setOption($option, $value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please inline this method (after fixing other snuff), because it will complicate things down the road.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I follow what this means. I just posted some other changes, so let me know and I'll get that in there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline means:
- put body the method (
setOption
in this case) inside the method, that calls it (setOptions
in this case) - remove original method (
setOption
in this case)
* | ||
* @return mixed The option value or default value if it is not set. | ||
*/ | ||
public function getOption($option, $default_value = NULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this method.
I don't see any potential use of this method, because the only consumer of this options is Zombie itself. Nobody wants to introspect what options current server has.
foreach ($options as $key => $value) { | ||
$this->options[$key] = $value; | ||
} | ||
$this->serverPath = $this->createTemporaryServer(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add empty line above. If you have any automated code style checks in place for PSR2 standard then this should have been reported as error by them. Also the Scrutinizer CI should have picked that as well.
Turns out there is a test case covering changed class. @robballou , please also add relevant tests. |
This should be updated to rely on an environment variable containing a json string |
I might have some time this week to work on this. Taking a look at tests right now. |
I'm having trouble getting tests to run (just trying in Thanks, Rob |
What is the specific error you're having when running |
Looks like there is an issue with the JS side of things, attaching the phpunit output: I'm using node 5.9.1. |
To summarize the error you're getting from most (if not all) tests is:
What is Zombie version you're using? I'm on 4.x something. Not sure how to determine which exactly. Try installing 4.0.0 version of Zombie and see if tests pass then. |
And if you're on Windows then you might also get that error. |
@robballou , any update? |
Last time I tried, I still had issues running tests but I haven't been able to work on it since April :( |
For reference, the list of available options is defined at https://github.com/assaf/zombie/blob/v4.3.0/src/index.js#L30 |
Will this options include timeout? 5 seconds is just too little |
All options will be passed to Zombie as-as (we won't be storing local copies of allowed options in the driver). So if in Zombie docs there is such options it will be passed. |
What is needed in order to merge this? I can help if you need me to do something (though I'm really new to Zombie in general, been using it for maximum 1 month) |
You need to:
|
Since this PR was created the JS server code was moved to https://github.com/minkphp/MinkZombieDriver/blob/master/bin/mink-zombie-server.js file, that reads server settings from enviroment variables, that are set in MinkZombieDriver/src/NodeJS/Server.php Lines 319 to 324 in 614cfc8
|
@chris-fa , you plan on sending PR any time soon? |
@aik099 I'm trying to set up some free time, maybe in the holiday; but I'm not sure whether I might be able to do it quickly, I haven't contributed before to this repo, so I'm not really familiarized with the source code; I'm willing to provide any help I can, but can't guarantee a fast time, sorry :( |
Any help any time is appreciated. Thanks upfront. |
Is anybody maintaining this PR? |
@chris-fa , what do you mean by maintaining? The PR author abandoned this PR more than half a year ago. You told couple of month ago that you might continuing development of this PR and disappeared from the radar as well. So I guess nobody is writing code for this PR at the moment. |
@aik099 I just realized I wrote on this PR my bad 😂 |
I would work on this as I need to be able to specify some options for zombiejs. I'm a little bit confused about where to do that though. Finally I need to have this feature in https://github.com/Behat/MinkZombieDriver which is behind https://github.com/minkphp/MinkZombieDriver by 64 commits at the time of this comment. Also, there are needed changes in the ZombieFactory of the Behat/MinkExtension, so I suppose that I need to issue a separate PR there? What I got so far is this: In order to proceed I'd need the following information:
Sorry if any of this is too obvious to you, but I rather ask. I already spent a lot of time figuring out why my tests just don't succeed, digging through pretty cryptic error messages and trying to get my head around on how to pass on zombiejs options when going through mink. The documentation is looking very good, but is actually rather thin for anything that is slightly special. |
@berliner you don't need this in the https://github.com/Behat/MinkZombieDriver repo, as this is a legacy repo (from the time where download links were not redirected by github and so we forked back the repo after moving it). the source of the |
@stof Thanks for clarifying. It would be good to put a note to that effect on the repo page. It really confused me. |
Since Zombie is headless driver you only need to do
You'll need to create another PR to MinkExtension so that zombie options can be defined in |
@aik099 Thanks for your answers, I need a clarification though: Also, I created a PR for MinkExtension: Behat/MinkExtension#284 |
What you see on GitHub is result of running
Nothing needs to be fixed. I've responded in that PR as well with more details. |
@aik099 Thanks, that's been sufficiently clear. I am able to run the tests now using phpspec. |
PhpSpec? I thought mink tests are written in PHPUnit, but Behat tests (and possible MinkExtension tests) are written in PhpSpec. |
Sorry to confuse you. I was looking at MinkExtension at the moment, which uses phpspec. Your previous answer made it clear for me that I simply needed to look at the travis logs to find out how to run the tests for the project, which is what I did for MinkExtension as I have an PR open there. I'll be looking at MinkZombieDriver next, which seems to be using phpunit as you said. |
Replaced by #183. |
Here is the start of this functionality. I opted to add this as a last parameter rather than allowing the params or an array just for clarity of the interface. Also I added some "validation" of the options per what is in Zombie's BROWSER_OPTIONS settings.