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

[PHPUnit_Framework_Exception] Invalid argument supplied for foreach() when use grabTextFrom after leave method #4098

Closed
Dimatrain opened this issue Apr 3, 2017 · 1 comment
Assignees
Labels

Comments

@Dimatrain
Copy link

@Dimatrain Dimatrain commented Apr 3, 2017

This code didn't work since version 2.2.9, but work in 2.2.8 and earlier. Please, fix it.

public function test(AcceptanceTester $I)
    {
        $I->amOnUrl('http://www.google.ru');
        $text = $I->grabTextFrom('.logo-subtext');
        $I->comment($text);
        $friend = $I->haveFriend('friend');
        $friend->does(function (AcceptanceTester $I) {
            $I->amOnUrl('http://www.google.ru');
            $text = $I->grabTextFrom('.logo-subtext');
            $I->comment($text);
        });
        $friend->leave();
        $text = $I->grabTextFrom('.logo-subtext');
        $I->comment($text);
    }

in console
[PHPUnit_Framework_Exception] Invalid argument supplied for foreach()

\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php:197
\vendor\codeception\codeception\src\Codeception\Module\WebDriver.php:2421
\vendor\codeception\codeception\src\Codeception\Module\WebDriver.php:1425
\vendor\codeception\codeception\src\Codeception\Step.php:260
\vendor\codeception\codeception\src\Codeception\Scenario.php:72
\tests_support_generated\AcceptanceTesterActions.php:3362
\tests\acceptance\MyCest.php:36
\vendor\codeception\codeception\src\Codeception\Lib\Di.php:127
\vendor\codeception\codeception\src\Codeception\Test\Cest.php:136
\vendor\codeception\codeception\src\Codeception\Test\Cest.php:148
\vendor\codeception\codeception\src\Codeception\Test\Cest.php:82
\vendor\codeception\codeception\src\Codeception\Test\Test.php:90
\vendor\phpunit\phpunit\src\Framework\TestSuite.php:722
\vendor\codeception\codeception\src\Codeception\PHPUnit\Runner.php:106
\vendor\codeception\codeception\src\Codeception\SuiteManager.php:157 \vendor\codeception\codeception\src\Codeception\Codecept.php:184
\vendor\codeception\codeception\src\Codeception\Codecept.php:175
\vendor\codeception\codeception\src\Codeception\Command\Run.php:288
\vendor\symfony\console\Command\Command.php:265
\vendor\symfony\console\Application.php:826
\vendor\symfony\console\Application.php:189
\vendor\symfony\console\Application.php:120
\vendor\codeception\codeception\src\Codeception\Application.php:103
\vendor\codeception\codeception\codecept:36

Details

  • Codeception version: 2.2.9, 2.2.10
  • PHP Version: 7.1.0
  • Operating System: Windows 8.1, Windows 10
  • Installation type: Composer
@Naktibalda Naktibalda added the WebDriver label Apr 3, 2017
@Naktibalda
Copy link
Member

@Naktibalda Naktibalda commented Apr 4, 2017

This issue was caused by introduction of performOn method: ed549a9

I verified that with git bisect.

Naktibalda added a commit to Naktibalda/Codeception that referenced this issue Apr 4, 2017
DavertMik added a commit that referenced this issue Apr 13, 2017
Fixes #4098
Clearing base element on closing session
@DavertMik DavertMik mentioned this issue Apr 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.