Codeception / module-webdriver

WebDriver module for Codeception
MIT License
36 stars 25 forks source link

Problem with date in Function formatLogEntries #102

Closed vansari closed 2 years ago

vansari commented 2 years ago

Hi,

We use the Version 2.0.2 of the webdriver module with the PHPVersion 8.1.7. In Line 701 of WebDriver Class we got an Type Error for Timestamps which should be converted from milliseconds to seconds. See: https://github.com/Codeception/module-webdriver/blob/2.0.2/src/Codeception/Module/WebDriver.php#L701

Error is: date(): Argument #2 ($timestamp) must be of type ?int, float given

Is it possible that we can fix this with the following little snippet:

             // Timestamp is in milliseconds, but date() requires seconds.
            $time = date('H:i:s', (intval($logEntry['timestamp'] / 1000))) .
                // Append the milliseconds to the end of the time string
                '.' . ($logEntry['timestamp'] % 1000);
Naktibalda commented 2 years ago

Please raise pull request

vansari commented 2 years ago

Hi @Naktibalda

I will do it this evening

Thx a lot

macghriogair commented 2 years ago

@Naktibalda please consider this fix: https://github.com/Codeception/module-webdriver/pull/103