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

Fixed the execution of self-executing functions not wrapped in braces #114

Merged
merged 1 commit into from
Feb 5, 2014

Conversation

stof
Copy link
Member

@stof stof commented Feb 5, 2014

No description provided.

@aik099
Copy link
Member

aik099 commented Feb 5, 2014

No such problem for Sahi/Zombie?

@aik099
Copy link
Member

aik099 commented Feb 5, 2014

The Sahi test suite is running terribly slow by the way (compared to Selenium2). Maybe we're setting some kind of script running speed and it's stuck in Sahi settings until all tests are done?

@stof
Copy link
Member Author

stof commented Feb 5, 2014

@aik099 not yet checked.

@stof
Copy link
Member Author

stof commented Feb 5, 2014

and regarding the Sahi speed, this is indeed terrible. However, I don't know sahi enough to know what it could be.
Please open an issue on the SahiDriver repo for this

stof added a commit that referenced this pull request Feb 5, 2014
Fixed the execution of self-executing functions not wrapped in braces
@stof stof merged commit 256bb92 into minkphp:master Feb 5, 2014
@stof stof deleted the execute_script branch February 5, 2014 12:43
@stof
Copy link
Member Author

stof commented Feb 5, 2014

@aik099 Can you run the zombie suite to check it ? I cannot. Installing Zombie on Windows does not work

@aik099
Copy link
Member

aik099 commented Feb 5, 2014

and regarding the Sahi speed, this is indeed terrible. However, I don't know sahi enough to know what it could be.
Please open an issue on the SahiDriver repo for this

Done: https://github.com/Behat/MinkSahiDriver/issues/35

@aik099
Copy link
Member

aik099 commented Feb 5, 2014

@aik099 Can you run the zombie suite to check it ? I cannot. Installing Zombie on Windows does not work

I'm on Mac and have Linux virtual machine. So I can run Zombie in both places. Don't you have virtual machine on Windows to simulate close-to-server environment, @stof?

I've tried to run Zombie tests and it freezes on some test. The output is:

PHPUnit 3.7.28 by Sebastian Bergmann.

Configuration read from .../phpunit.xml

...........SSSSSSSS...S...............

@aik099
Copy link
Member

aik099 commented Feb 5, 2014

I wonder if it would be possible to print test names before running them somehow. Then it's would be obvious which test freezes.

@stof
Copy link
Member Author

stof commented Feb 5, 2014

run them using the --tap output

@aik099
Copy link
Member

aik099 commented Feb 5, 2014

It's testExecuteScript with dataset #0 hanging.

@aik099
Copy link
Member

aik099 commented Feb 5, 2014

And it's freezing because of a bug in that executeScript method of a driver.

Current code (with error):

public function executeScript($script)
{
    $script = json_encode($script);
    $this->server->evalJS("browser.evaluate({$script});");
}

Fixed code (you can send a PR):

public function executeScript($script)
{
    $script = json_encode($script);
    $this->server->evalJS("browser.evaluate({$script});stream.end();");
}

The stream.end() added.


After fixing that locally (in ZombieDriver code) all but 2 tests pass:

1) Tests\Behat\Mink\Driver\ZombieDriverTest::testExecuteScript with data set #2 ('function () {document.querySelector("h1").textContent = "Hello world";}()')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Hello world'
+'Extremely useless page'

...vendor/behat/mink/tests/Behat/Mink/Driver/JavascriptDriverTest.php:310

2) Tests\Behat\Mink\Driver\ZombieDriverTest::testExecuteScript with data set #3 ('function () {document.querySelector("h1").textContent = "Hello world";}();')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Hello world'
+'Extremely useless page'

...vendor/behat/mink/tests/Behat/Mink/Driver/JavascriptDriverTest.php:310

@stof
Copy link
Member Author

stof commented Feb 5, 2014

OK, the fix is the same than for Selenium2DRiver then: it requires the wrapping braces

@stof
Copy link
Member Author

stof commented Feb 5, 2014

and this made us discover that executeScript is broken in ZombieDriver since years

@stof
Copy link
Member Author

stof commented Feb 5, 2014

Can you open the PR fixing MinkZombieDriver ? You are the one doing the debugging after all, so it would be logical that you get the attribution for the fixing commit

@aik099
Copy link
Member

aik099 commented Feb 5, 2014

Can you open the PR fixing MinkZombieDriver ? You are the one doing the debugging after all, so it would be logical that you get the attribution for the fixing commit

I'll do that.

We should really introduce these nice badges, that Symfony community has for amount of contributions been done by a particular user, here at Behat company. :)

@aik099
Copy link
Member

aik099 commented Feb 5, 2014

PR for Zombie created. You can merge it now.

@stof
Copy link
Member Author

stof commented Feb 5, 2014

We should really introduce these nice badges, that Symfony community has for amount of contributions been done by a particular user, here at Behat company.

AFAIK, SensioLabsConnect can generate the contributing page for any project once you register it. I'm not sure they have an easy way to embed it on other websites though, but it could be considered for the new Behat website which should be in progress

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

Successfully merging this pull request may close these issues.

2 participants