giorgiosironi / phpunit-selenium

Selenium RC integration for PHPUnit
http://www.phpunit.de/
Other
601 stars 270 forks source link

Super strange behaviour after upgrade from version 8 (php7.4) to version 9 (php8.0) #454

Closed hofmannjan1 closed 2 years ago

hofmannjan1 commented 3 years ago

I've got some really strange behaviour after upgrading my project to phpunit-selenium 9.0.0 (phpunit 9.5.8, php 8.0) from phpunit-selenium 8.0.0 (phpunit 8.5.8, php 7.4). I have a very simple test case:

    class ChromeTest extends SeleniumTestCase
    {
        protected function setUp(): void
        {
                $this->setBrowser('chrome');
                    $this->setBrowserUrl('http://localhost');
        }

        /** @test */
        public function visit_index_page()
        {
            $this->visit('/')
                ->assertTitle('my project title');
        }
    }

Worked just fine with version 8.0.0, one test passes. With version 9.0.0, all of a sudden, there are three hundred functions that get executed as "tests". I don't know where these functions are even located. I didn't change anything in the source code. Every single one of the failed tests say This test did not perform any assertions.

image

Really don't know what to do here. Since this is a now PHP 8 project I can't go back to phpunit-selenium 8.0.0 again as it only supports PHP 7. Please let me know if you need any more information. Thanks!

EDIT: Minimal example to reproduce: File test/Test.php

<?php

    class Test extends \PHPUnit\Extensions\Selenium2TestCase
    {
        protected function setUp(): void
        {
                $this->setBrowser('chrome');
                    $this->setBrowserUrl('http://localhost');
        }

            /** @test */
            public function test()
            {
                    $this->assertTrue(true);
            }
    }

FIle ./composer.json

{
  "require-dev":{
    "phpunit/phpunit": "9.5.8",
    "phpunit/phpunit-selenium": "9.0.0"
  },
  "config": {
    "disable-tls": true,
    "secure-http": false
  },
  "prefer-stable": true
}

Install dependencies, run tests in ChromeTest.php. image