Coder Social home page Coder Social logo

minkzombiedriver's People

Contributors

alexpott avatar arithmetric avatar b00gizm avatar bartfeenstra avatar berliner avatar ecentinela avatar everzet avatar faceleg avatar gimler avatar jasonlfunk avatar linclark avatar lotyrin avatar mnapoli avatar olleolleolle avatar stof avatar swestcott avatar underq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minkzombiedriver's Issues

"I should see" does not work after form is submitted

Hi there I am working with Behat + Mink + ZombieJS to test POST forms. I have such scenario:

@mink:zombie
Scenario: User logs in to the application using valid credentials.
    Given I am on "/"
      And I should see "Login to Application"
     When I fill in "username" with "user1"
      And I fill in "password" with "password1"
      And I press "Login"
     Then I should see "welcome"

When I run it using Selenium driver, everything works as expected (the page that user lands on after logging in contains welcome text).

Using ZombieDriver - it does not.

Using default Symfony2 behavior (no @mink tag) - it works.

I can't find the reason why it's not working with Zombie.js. I have noticed that the content of getPage()->getContent() differs from getPage()->getText() and the difference is not only strip_tags.

Broken symfony/process dependency

$ cat composer.json
{
    "require": {
        "behat/mink-zombie-driver":  "*"
    }
}
$ composer.phar install
Installing dependencies
Your requirements could not be solved to an installable set of packages.

  Problem 1
    - Installation request for behat/mink-zombie-driver * -> satisfiable by behat/mink-zombie-driver v1.0.0.
    - behat/mink-zombie-driver v1.0.0 requires symfony/process >=2.1.0,<2.2.0-dev -> no matching package found.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion for more details.

According to http://packagist.org/packages/symfony/process, 2.1 stable doesn't exist.

A decent full up-to-date working example of Zombie / MinkZombieDriver / Behat

Hi guys. I doubt this really the correct place to post this, but I couldn't really find a a better place - apologies.

I have had 2 aborted attempts recently to set up BDD for 2 projects trying to get Zombie and Behat to play nicely together. All example I have come across seem to be different / incomplete / out of date or simply broken - including a missing 'new' keyword on the sample on this repo's README.

I am working on the edge of my knowledge - I have almost no experience with Node, so solving cryptic Node issues is beyond me :( (eg Error: getaddrinfo ENOENT, Error: listen EADDRINUSE). I simply wants to use Behat / Zombie for testing.

My colleague had similar experiences trying to use the same technologies, he advised me to not even try - I would love to prove him wrong.

I am using PHP 5.4, it's built in server and fresh versions of Node, Behat, Zombie (I understand this is wrong, but I couldn't find correct version information), ZombieDriver. I installed using NPM and Composer.

I would love a up-to-date step by step guide with a really simple site (including Javascript), Behat, Zombie / ZombieDriver including installation.

Any takers?

Thanks.

Steven.

The constructor signature should be more explicit

The constructor supports 2 signatures: __construct(ZombieServer $server) and __construct($host, $port).

The implementation should be refactored to use real arguments rather than using func_get_args() to make it clear. Note that MinkExtension was passing 2 extra unused argument since years for instance (using new ZombieDriver($server, $connection, $autostart)``. The current implementation is totally unreadable

Click/Press hangs in Zombie 2.0.x and returns iterations error in 0.13

So this is really a bit of a thorn in my side atm. First and foremost - I'm glad someone is doing this and trying to make it work, unfortunately it appears to be a while off usable.

I followed the tutorials and tried running with zombie 0.13 (max version stated in readme). We get this error as a result:

Error while clicking button: ["Error: 10 $digest() iterations reached. Aborting!\nWatchers fired in the last 5 iterations: [[\"fn: $locationWatch; newVal: 8; oldVal: 7\"],[\"fn: $locationWatch; newVal: 9; oldVal: 8\"],[\"fn: $locationWatch; newVal: 10; oldVal: 9\"],[\"fn: $locationWatch; newVal: 11; oldVal: 10\"],[\"fn: $locationWatch; newVal: 12; oldVal: 11\"]]\n    at Error (unknown source)\n    at Object.$digest (/js/angular.js:7729:19)\n    at Object.$apply (/js/angular.js:7894:24)\n    at done (/js/angular.js:8883:20)\n    at completeRequest (/js/angular.js:9023:7)\n    at [object Object].onreadystatechange (/js/angular.js:8993:11)\n    in http://lishium.local/dashboard/insertion-orders/"]

What's interesting, is that the URL shown, is actually the URL after login (/dashboard/insertion-orders). So, click itself isn't an issue, but something is definitely going on as a result of that action. Press gets the same response.

If I upgrade to Zombie 2.0.x - I actually get a completely hung test suite - so I prefer 0.13 issue, but library definitely needs to be updated for 2.0.x. Willing to help if you want :)

Ensure that "change" event is fired only once per "setValue" call

Current results:

  • selectOption for radio: fires 2 times (no manual code, we just call .choose( method, maybe bug in Zombie)
  • check : fires 2 times (no manual code, we just call .check( method, maybe bug in Zombie)
  • uncheck : fires 2 times (no manual code, we just call .uncheck( method, maybe bug in Zombie)

To be on the safe side I've executed these tests on the PhantomJS and they fail the same way as for Selenium2. So it's something in Zombie that causes change to fired twice. Reported in assaf/zombie#675

Tests added in Behat/Mink#495

None of the versions work

I have been trying to move from Sahi to Zombie, but apparently there is no way to make it work.

I tried all the versions. With zombie <= 1.4.1 (as required by MinkZombieDriver's stable versions) I get the connection refused 111 error message.

With zombie 2.0.0-alpha31 and "behat/mink": "dev-2-architecture-changes", "behat/mink-zombie-driver": "dev-2.x-experimental" I can't get any pages with visit(), they are always this when I print getContent():

<html><head></head><body>queryA ENOTFOUND</body></html>

I copy/pasted the visit() code to echo the evalJS() return value and I got this, I hope it helps:

Error: queryA ENOTFOUND\n    at errnoException (dns.js:41:10)\n    at Object.onresolve [as oncomplete] (dns.js:145:19)

Keep in mind that Sahi worked fine, and Goutte also returns the page correctly.

Tests broken

While running tests I'm getting following error:

Failed asserting that exception of type "RuntimeException" matches expected exception "Behat\Mink\Exception\UnsupportedDriverActionException". Message was: "Server process has been terminated: (8) [
module.js:340
    throw err;
          ^
Error: Cannot find module 'zombie'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/mnt/hd/tmp/mink_nodejs_serverIjgY7l:2:16)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
]".

I'm sure I've installed zombie module as described.

No exception thrown when `visit` method fails

If a problem occurs (TCP/IP related) on Zombie side when trying to open a given url using MinkZombieDriver::visit method then no exception is thrown. This leads to obscure errors down the road when tests try to access the data of the page, that was never loaded.

The PHPDoc of the visit method suggests that it will throw the DriverException in case of error, but it never happens.

Kill running Node server on start

Provide an option to force ZombieServer to kill a running NodeJS server on $server->start()

This is required in cases where a script does not complete execution - on next run, as the NodeJS server hasn't been stopped, therefore Zombie Driver can't start another one.

$server = new ZombieServer('localhost', 8124, '/usr/bin/node', null, 2000000, '/usr/lib/node_modules/');
$driver = new ZombieDriver($server);
$this->session = new Session($driver);
$destroyExisting = true;
$this->session->start($destroyExisting); // Stop an existing server & start another

"Given I go to" and page 404 or 403.

Hi,

I found a bug when I exec this feature :

Given I go to "/authentification/1/1"
Could not load resource for URL 'http://localhost/authentification/1/1'
Then the response status code should be 403

When MinkZombieDriver visit() a page which return 403 or 404 error it throw an exception and Behat passes to the next feature without checking the "Then the response status code should be"

I don't know if this is an error from my part or if it's a real bug

ZombieServer::evalJS() hangs up infinitely

Hi everybody. Since ZombieJS seems to ignore the /etc/hosts file, I was trying to use DNS masking to map some "fake" domain names to my localhost. This works correctly when running it straight from the node console:

zombie.dns.localhost('*.example.com');

which means that every request to example.com and subdomains will be routed to my localhost.

If I try the same in one of my tests:

$session = $this->getMink()->getSession('zombie');
$session->getDriver()->getServer()->evalJS("zombie.dns.localhost('*.example.com');");

The test hangs up there and the phpunit process has to be killed. The problem seems to be in Behat\Mink\Driver\NodeJS\Connection::socketSend(), line 91:
while ($o = socket_read($socket, 2048)) {

The weirdest thing is that, when the same function is called (for example) via the ZombieDriver::visit(), the socket doesn't hang up and everything works as intended.

This is the sockets situation while the test hangs:

netstat -an | grep 8124
tcp        0      0 127.0.0.1:8124              0.0.0.0:*                   LISTEN      
tcp        0      0 127.0.0.1:8124              127.0.0.1:46252             CLOSE_WAIT  
tcp        0      0 127.0.0.1:46252             127.0.0.1:8124              FIN_WAIT2

I'm currently running the mink drivers at the latest master (b6a4b33), PHP 5.5.9, nodeJS v0.10.25, [email protected]. OS is CentOS 6.5.

Does anybody have any idea why this is happening? Is it a configuration problem or a possible bug?

zombie 2.0.0-alpha31 version is not compatible with this driver

Hi, I got v1.1.0 with zombie.js 2.0.0-alpha31 and always get Your zombie.js version is not compatible with this driver. Please use a version <= 1.4.1, but your write in the README.md please use version 2.0.0-alpha1 or higher.

Which version combination should I use?

Extra 'exec' in a Server.php

Driver didn't work for me untill i remove 'exec' parameter in start method of MinkZombieDriver's Server.php.

/**
     * Starts the server process
     *
     * @param   Symfony\Component\Process\Process  $process  A process object
     *
     * @throws  \RuntimeException
     */
    public function start(Process $process = null)
    {
        // Check if the server script exists at given path
        if (false === $this->serverPath || false === is_file($this->serverPath)) {
            throw new \RuntimeException(sprintf(
                "Could not find server script at path '%s'", $this->serverPath
            ));
        }

        // Create process object if neccessary
        if (null === $process) {
            $processBuilder = new ProcessBuilder(array(
 //               'exec',
                $this->nodeBin,
                $this->serverPath,
            ));
            $process = $processBuilder->getProcess();
        }
        $this->process = $process;

        // Start server process
        $this->process->start();
        $this->connection = null;

        // Wait for the server to start up
        $time = 0;
        $successString = sprintf("server started on %s:%s", $this->host, $this->port);
        while ($this->process->isRunning() && $time < $this->threshold) {
            if ($successString == trim($this->process->getOutput())) {
                $this->connection = new Connection($this->host, $this->port);
                break;
            }
            usleep(1000);
            $time += 1000;
        }

        // Make sure the server is ready or throw an exception otherwise
        $this->checkAvailability();
    }

Error i had before:

Server process has been terminated: (127) [sh: 1: exec: exec: not found]

The "getResponseHeaders" method creates JavaScript error

The "getResponseHeaders" method creates JavaScript error instead of returning response headers:

1) Tests\Behat\Mink\Driver\ZombieDriverTest::testResponseHeaders
Behat\Mink\Exception\DriverException: Executing of browser.lastResponse.headers code failed with error: Cannot read property 'headers' of undefined

Doesn't work with newer versions of Node.

Newer versions of Node require local versions of packages regardless of if they're installed globally or not. This means that the require('zombie') call will always fail.

Misc test failures

I've having these various test failures that needs to be addressed:

1) Behat\Mink\Tests\Driver\Form\RadioTest::testSelectOption
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'updated'
+'set'

.../vendor/behat/mink/driver-testsuite/tests/Form/RadioTest.php:40

2) Behat\Mink\Tests\Driver\Form\RadioTest::testSetValue
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'updated'
+'set'

.../vendor/behat/mink/driver-testsuite/tests/Form/RadioTest.php:56

3) Behat\Mink\Tests\Driver\Form\RadioTest::testSameNameInMultipleForms
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'test3'
+'test2'

.../vendor/behat/mink/driver-testsuite/tests/Form/RadioTest.php:69

4) Behat\Mink\Tests\Driver\Form\SelectTest::testMultiselect
Failed asserting that Array &0 (
    0 => '2'
    1 => '3'
) is identical to Array &0 (
    0 => '2'
).

.../vendor/behat/mink/driver-testsuite/tests/Form/SelectTest.php:36

5) Behat\Mink\Tests\Driver\Form\SelectTest::testOptionWithoutValue
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Two'
+'none selected'

.../vendor/behat/mink/driver-testsuite/tests/Form/SelectTest.php:114

6) Behat\Mink\Tests\Driver\Js\ChangeEventTest::testIssue178
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'foo'
+''

.../vendor/behat/mink/driver-testsuite/tests/Js/ChangeEventTest.php:31

Bundle ZombieJS with ZombieDriver

There are some BC issues with newer versions of ZombieJS (as of today >= 0.13.0).

It seems to be a good idea to have a Composer post-install hook which triggers NPM to install the most recent working version of ZombieJS locally.

problem loading a tagit widget

I'm not sure if the issue is driver's fault or fault of zombie's itself, but I post it here and let's see.

I have a page with a select box and a tagit widget in it http://aehlke.github.com/tag-it/
The page uses the jquery library.
The widget is loaded on document ready, and when I select a value on the select box, the word representing the selected option is created in the widget.
In one test I want to check the content of the widget.

The scenario looks like this

  @mink:zombie
  Scenario: Selecting an option in the select box, the word representing the option appears in the tagit widget
    Given I am on "/page"
    When I select "hello" from "word_selector"
    Then I should see "hello" tag appear in the tagit widget ".tagit .tagit-choice .tagit-label"

All the steps are MinkContext steps except the last one which looks like this

    /**
     * @Given /^I should see "([^"]*)" tag appear in the tagit widget "([^"]*)"$/
     */
    public function iShouldSeeTagAppearInTheTagitWidget($tag, $widget)
    {
        $this->assertSession()->elementTextContains('css', $widget, $this->fixStepArgument($tag));
    }

If I run the scenario with @mink:sahi, it works fine, but with @mink:zombie the tagit widget is not found

Element matching css ".tagit .tagit-choice .tagit-label" not found.

I've checked the last response before the final step, and widget is there but with errors, which explains why the selector fails.

I guess zombie has some issue on the creation of the widget but I have no idea how to debug that to narrow the problem.
Any idea would be appreciated.

Thanks

Versions:
sahi: install_sahi_v35_20110719.jar
zombie: [email protected]
jquery: 1.7.1
jquery UI: 1.8.18
tag-it: v2.0 (06/2011)

Inconsistent 'setValue' behavior

The setValue method in other drivers does this:

  • changes value of input
  • change value of textarea
  • changes value of select

For this driver it does this:

  • changes value of input
  • change value of textarea
  • checks/unchecks checkboxes
  • selects radio buttons

I think that setValue for every driver must do all of mentioned.

Related to Behat/Mink#519.

Zombie return <html><head></head><body></body></html>

Hi,

When I run my tests with zombie, my tests failed and return :

<html><head></head><body></body></html>

I tried without zombie and it work perfectly but when I use zombie I have this.

Here my behat.yml :

# behat.yml
default:
  extensions:
    Behat\MinkExtension\Extension:
      base_url: http://192.168.33.120/
      javascript_session: zombie
      goutte:
        guzzle_parameters:
          curl.options:
            CURLOPT_HTTPHEADER: ["Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4;"]
      selenium2: ~
      zombie: ~

Create exception wrapper for NodeJS process

How the driver works:

  1. NodeJS process is created which listens on a port
  2. Driver connects to a port and sends a command and gets back the result

Due fact, that Zombie doesn't wrap exceptions of underlying libraries (e.g. Net) with it's own ones we have crashed NodeJS process in case if one of Driver sent commands ends up with Exception that Zombie haven't caught.

For example https://travis-ci.org/Behat/MinkZombieDriver/jobs/24094609 a single failed test results in all subsequent tests to fail.

We either need to have a try/catch block for every command that we send to Zombie on Driver side or somehow process that inside NodeJS process so the PHP exception is correctly thrown instead of NodeJS exception.

How to use with Behat.yml...?

How does one get Behat to use Zombie instead of Goutte or Selenium2?

I see the example usage code in the README.md, however I don't see how this can be used to configure Behat to use Zombie, and am not sure where to put it. I tried FeatureContext.php, although I am pretty sure that is not right.

I also tried specifying zombie and default_session in behat.yml with no luck:

default:
  extensions:
    Behat\MinkExtension\Extension:
      zombie: ~
      default_session: 'zombie'

Capturing output from node.js and zombie.js into Behat

When using the Goutette driver, I am able to do a JavaScript evaluation with a return something statement in it, and Behat captures the output. I am not being able to do so with the Zombie.js driver. Is there a specific way that this needs to be done with node.js? Or is it simply not supported by the driver? I know that with Gouette, for example it will not capture output from anonymous functions, so any return statements need to be done at the global level.

using $element->click() results in Fatal error: Wrong parameters for Exception

Here is a small test that results in a fatal error:

<?php

require '/path/to/mink.phar';

$driver = new \Behat\Mink\Driver\ZombieDriver('127.0.0.1');
$session = new \Behat\Mink\Session($driver);
$session->start();

$session->visit('http://mink.behat.org/');
$page = $session->getPage();
$link = $page->findLink('GitHub');

var_dump($link->getHtml());
// output:
//      string 'GitHub' (length=6)
// so the link is found correctly

$link->click();
// dies:
//  Fatal error: Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]])
//  in phar:///path/to/mink.phar/src/Behat/Mink/Exception/Exception.php on line 36

Cannot call method browser.location.toString

I do not understand what could be wrong, when I call:

MinkSession::visit('http://localhost/some/path.php');

I got error:

1) App\Tests\Behaviour\ProductCartTest
RuntimeException: Server process has been terminated: (8) [
undefined:1
stream.end(JSON.stringify(browser.location.toString()))
                                           ^
TypeError: Cannot call method 'toString' of undefined
    at Socket.eval (eval at <anonymous> (/tmp/mink_nodejs_server3Rdx9k:121:10), <anonymous>:1:44)
    at Socket.<anonymous> (/tmp/mink_nodejs_server3Rdx9k:121:5)
    at Socket.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)
]

Config zombie driver:

'zombie' => array(
    'host' => '127.0.0.1',
    'port' => 8124,
    'nodeBinary' => 'node',
)

What other information can I provide? Thanks.

[Suggestion] Extracting the JS business logic to reduce duplication

Currently, each method of the ZombieDriver needs to provide its JS business logic. This leads to code duplication. See for instance #103 which needs to be able to select a value for a radio button in 2 different methods.

My suggestion would be to move the business logic to a bunch of functions defined in the script running the zombie server itself. Then, the ZombieDriver would just have to use these functions when needed. This way, we could reuse some code by defining helper functions used by other functions, just like we do in MinkSelenium2Driver with a bunch of private methods in PHP for instance.
what do you think about this approach @aik099 ?

If we go this way, my suggestion would be to do the 1.2 release first (after fixing the tests), and then do the refactoring in a 1.3 release (to let us the time to ensure we don't introduce issues)

Node modules path is not used

If one does not specify serverPath in the constructor (line 75 of Server), then createTemporaryServer is called to set it. This occurs before nodeModulesPath is set. Also means that using setNodeModulesPath after instantiating a new Server object is pointless.

I would create a pull request to fix this, but you wouldn't use it.

Issue with SELF_SIGNED_CERT_IN_CHAIN

Hi,

I'm trying to use this driver for zombie, but I did encounter some error while connecting to https page with self signed certificate. When I try to get page content from session i got:

<html><head></head><body>SELF_SIGNED_CERT_IN_CHAIN</body></html>

When I switch from zombie to goutte I'm getting normal page which is expected.

Can you advise how can i configure this driver to work with ssl with self signed certificate?

Jakub.

Connection refused

Hi, I have been trying to get the Zombie driver to work, but I get this error:

RuntimeException: Could not establish connection: No connection could be made because the target machine actively refused it.
 (10061)

C:\work\modules\xmod-auth\vendor\behat\mink-zombie-driver\src\Behat\Mink\Driver\NodeJS\Connection.php:75
C:\work\modules\xmod-auth\vendor\behat\mink-zombie-driver\src\Behat\Mink\Driver\NodeJS\Server\ZombieServer.php:18
C:\work\modules\xmod-auth\vendor\behat\mink-zombie-driver\src\Behat\Mink\Driver\NodeJS\Server.php:367
C:\work\modules\xmod-auth\vendor\behat\mink-zombie-driver\src\Behat\Mink\Driver\ZombieDriver.php:327
C:\work\modules\xmod-auth\vendor\behat\mink\src\Behat\Mink\Element\DocumentElement.php:37

I totally disabled my firewall and have tried a basic NodeJS server, which works fine:

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(8124, '127.0.0.1');
console.log('Server running at http://127.0.0.1:8124/');

Current "setValue" implementation doesn't honor SELECTs

I'm getting following errors during test suite run, which happens because SELECTs are not being processed by setValue method of a driver:

1) Behat\Mink\Tests\Driver\Form\SelectTest::testSetValueSingleSelect
Behat\Mink\Exception\DriverException: Error "No INPUT matching '[ SELECT ]'" while executing code: var node = pointers[0],
    type = node.getAttribute('type');
if (type == 'checkbox') {
  "10" ? browser.check(node) : browser.uncheck(node);
} else if (type == 'radio') {
  browser.choose(node);
} else {
  browser.fill(node, "10");
}
stream.end();

.../src/Behat/Mink/Driver/NodeJS/Server/ZombieServer.php:44
.../src/Behat/Mink/Driver/NodeJS/Server.php:366
.../src/Behat/Mink/Driver/ZombieDriver.php:482
.../vendor/behat/mink/src/Behat/Mink/Element/NodeElement.php:105
.../vendor/behat/mink/driver-testsuite/tests/Form/SelectTest.php:91

2) Behat\Mink\Tests\Driver\Form\SelectTest::testSetValueMultiSelect
Behat\Mink\Exception\DriverException: Error "No INPUT matching '[ SELECT ]'" while executing code: var node = pointers[0],
    type = node.getAttribute('type');
if (type == 'checkbox') {
  ["1","2"] ? browser.check(node) : browser.uncheck(node);
} else if (type == 'radio') {
  browser.choose(node);
} else {
  browser.fill(node, ["1","2"]);
}
stream.end();

.../src/Behat/Mink/Driver/NodeJS/Server/ZombieServer.php:44
.../src/Behat/Mink/Driver/NodeJS/Server.php:366
.../src/Behat/Mink/Driver/ZombieDriver.php:482
.../vendor/behat/mink/src/Behat/Mink/Element/NodeElement.php:105
.../vendor/behat/mink/driver-testsuite/tests/Form/SelectTest.php:101

3) Behat\Mink\Tests\Driver\Js\ChangeEventTest::testSetValueChangeEvent with data set "select" ('the-select', '30')
Behat\Mink\Exception\DriverException: Error "No INPUT matching '[ SELECT#the-select ]'" while executing code: var node = pointers[0],
    type = node.getAttribute('type');
if (type == 'checkbox') {
  "30" ? browser.check(node) : browser.uncheck(node);
} else if (type == 'radio') {
  browser.choose(node);
} else {
  browser.fill(node, "30");
}
stream.end();

.../src/Behat/Mink/Driver/NodeJS/Server/ZombieServer.php:44
.../src/Behat/Mink/Driver/NodeJS/Server.php:366
.../src/Behat/Mink/Driver/ZombieDriver.php:482
.../vendor/behat/mink/src/Behat/Mink/Element/NodeElement.php:105
.../vendor/behat/mink/driver-testsuite/tests/Js/ChangeEventTest.php:47

Curl option with mink-zombie-driver

Hi,

I have a problem with zombie. To access to my website I have to set some curl options. When I use behat without javascript I use goutte and I set curl options on guzzle_parameters. But with Zombie I don't know how set some curl options and I can't access to my website. It only return :

<html><head></head><body></body></html>

Zombie driver does not wait for XHR/triggers

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 :)

symfony/process 2.1.2 incompatibility

Changes in the 2.1.2 version of symfony/process seems to break mink-zombie-driver.
with the news version, when we launch our tests, we have this error : "Server process has been terminated: (2) [exec: 1: exec: not found"

If we remove/comment line 244 ('exec') in src/Behat/Mink/Driver/NodeJS/Server.php, it's solve our problem.

Related symfony/process changes : symfony/symfony@8cb1ff3

Seb

PS: sorry for my poor english/report

->setBasicAuth() not working with Zombie.js 1.4.1

Hi,

the requirements of the ZombieServer state that Zombie.js <= 1.4.1 is required. I installed zombie.js 1.4.1 via npm and cannot get basic authentication to work with it. It seems like the zombie browser does not send any credentials to the server.
I did some research and found out that newer version of zombie have a new API for basic authentication:

browser.authenticate().basic('user', 'password');

The source code of zombie 1.4.1 marks the old way (setting browser.credentials) as deprecated and doesn't seem to care for the property browser.credentials. When I use this new API in ZombieDriver::setBasicAuth everything works just fine. However, I don't think that it'd a good idea to implement it this way in MinkZombieDriver because older versions of zombie have to be supported, too. Or could we maybe use a more sophisticated approach that includes testing for the presence of browser.authenticate?

public function setBasicAuth($user, $password)
{
    $js = <<<JS
        if ('function' === typeof browser.authenticate) {
            browser.authenticate().basic('{$user}', '{$password}');
        } else {
            browser.credentials = { credentials: { schema: 'basic', username: '{$user}', password: '{$password}'}};
        }
        stream.end();
JS;

    $this->server->evalJS($js);
}

I'd really appreciate your help. Attached, find a simple PR providing the suggested change.

Cheers,
Paul

Fails with latest zombie

Previously I had a testsuite that was running smooth under zombie-2alpha31 and dev-master of driver
However after update to most recent zombie-2.0.4 I get tons of this:

     [exec]     And I wait for element "..." to appear  # path to step definition
     [exec]       Error "Cannot call method 'then' of undefined" while executing code: (function () {
     [exec]         var checkCondition = function () {
     [exec]           return browser.evaluate("(jQuery('#selector').length > 0)");
     [exec]         };
     [exec]       
     [exec]         browser.waitDuration = '10s';
     [exec]         browser.wait(checkCondition).then(function () {
     [exec]           stream.end(JSON.stringify(checkCondition()));
     [exec]         });
     [exec]       }()); (Behat\Mink\Exception\DriverException)

More Zombie2.0 incompatibilities

Just a note really for anyone else who starts looking to get things going with more recent versions of Zombie, it seems Zombie (maybe indirectly through their use of touch-cookie), are working to a more recent cookie spec than PHP does.

$this->getSession()->setCookie('srvr_cookie', 'client cookie set')

Will result in Zombie sending

Cookie: srvr_cookie="client cookie set"

Which is reasonable, but PHP will produce:

<?php 

var_dump($_COOKIE['srvr_cookie']);
// string(19) ""client cookie set""

I wrote small Flask and Express apps to test their behaviour, they both interpret the cookie as you would expect.

This may not be a show stopper, but it will definitely prevent the ZombieDriver from passing all of the integration tests.

See:

Failing "Basic\ContentTest::testHtmlDecodingNotPerformed" test

I've tried to run tests against latest Zombie 2.0.1 and I've got only 1 failed test:

1) Behat\Mink\Tests\Driver\Basic\ContentTest::testHtmlDecodingNotPerformed
Behat\Mink\Exception\DriverException: Error "Cannot call method 'toLowerCase' of null" while executing code: var node = pointers[1],
    tagName = node.tagName.toLowerCase(),
    value = null;
if (tagName == "input") {
  var type = node.getAttribute('type').toLowerCase();
  if (type == "checkbox") {
    value = node.checked ? node.value : null;
  } else if (type == "radio") {
    if (node.checked) {
      value = node.value;
    } else {
      var name = node.getAttribute('name');
      if (name) {
        var formElements = node.form.elements,
            element;
        for (var i = 0; i < formElements.length; i++) {
          element = formElements[i];
          if (element.type == 'radio' && element.getAttribute('name') === name && element.checked) {
            value = element.value;
            break;
          }
        }
      }
    }
  } else {
    value = node.value;
  }
} else if (tagName == "textarea") {
  value = node.value;
} else if (tagName == "select") {
  if (node.getAttribute('multiple')) {
    value = [];
    for (var i = 0; i < node.options.length; i++) {
      if (node.options[ i ].selected) {
        value.push(node.options[ i ].value);
      }
    }
  } else {
    var idx = node.selectedIndex;
    if (idx >= 0) {
      value = node.options.item(idx).value;
    } else {
      value = null;
    }
  }
} else {
  value = node.value;
}
stream.end(JSON.stringify(value));

.../src/Behat/Mink/Driver/NodeJS/Server/ZombieServer.php:44
.../src/Behat/Mink/Driver/NodeJS/Server.php:366
.../src/Behat/Mink/Driver/ZombieDriver.php:467
.../vendor/behat/mink/src/Behat/Mink/Element/NodeElement.php:91
.../vendor/behat/mink/driver-testsuite/tests/Basic/ContentTest.php:72

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.