Open mpiot opened 2 years ago
Any insight into what causes this or how to fix it?
Hi, in my case I've do a shell script that handle the execution of phpunit, and override the return code by reading the message of phpunit. This is only a workarround, because don't know why this issue appear.
#/bin/sh
result=$(symfony php vendor/bin/phpunit | tee /dev/stderr)
if echo "$result" | grep -E 'OK \([0-9]+ test'; then
exit 0;
fi
exit 1
I'm not using phpunit... I'm just using Symfony\Component\Panther\Client::createFirefoxClient();
and running things from there. It all works, except for the fatal errors at the end (after everything has finished, so I guess related to the destructor or connection closing).
Maybe we could add some setting on Client to tell it not to call $this->webDriver->close()
from Client::close()
?
Probably related to (or same as): https://github.com/symfony/panther/issues/466
I get around this in my pest tests by doing:
$client = null;
afterEach(function () use (&$client) {
if ($client !== null) {
try {
$client = null;
} catch (\Throwable $e) {
}
}
});
test('some test', function() use (&$client) {
$client = Client::createChromeClient();
...
});
It's odd that I only see this sometimes using panther.
When I run tests using Panther, all check pass, but the return code is not 0 because a fatal error is thrown at the end. When I run it from my machine this error is reached randomly, on CI machines (self-hosted, github-hosted) it's near 100% of the times.