Skip to content

Commit 834d22b

Browse files
koehnleinggiak
authored andcommitted
Improve for codeception 5 and PHP 8.1 (#3)
* Enable multi session test * Update for PHP 8.1
1 parent f91dc69 commit 834d22b

3 files changed

Lines changed: 35 additions & 3 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
.settings/
55
vendor/
66
tests/integration/tests/_log/
7-
tests/integration/tests/_helpers/
7+
tests/integration/tests/_helpers/*
8+
!tests/integration/tests/_helpers/WebGuy.php
89
tests/integration/tests/_data/VisualCeption/SimpleCept.SimpleBlock.png

src/Codeception/Module/VisualCeption.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ private function createScreenshot($identifier, array $coords, array $excludeElem
495495
$fullShot->writeImage($elementPath);
496496

497497
if ($this->config["fullScreenShot"] !== true) {
498-
$fullShot->cropImage($coords['width'], $coords['height'], $coords['offset_x'], $coords['offset_y']);
498+
$fullShot->cropImage((int)$coords['width'], (int)$coords['height'], (int)$coords['offset_x'], (int)$coords['offset_y']);
499499
}
500500
$fullShot->writeImage($elementPath);
501501

@@ -505,7 +505,7 @@ private function createScreenshot($identifier, array $coords, array $excludeElem
505505
$screenshotBinary = $this->webDriver->takeScreenshot();
506506

507507
$screenShotImage->readimageblob($screenshotBinary);
508-
$screenShotImage->cropImage($coords['width'], $coords['height'], $coords['offset_x'], $coords['offset_y']);
508+
$screenShotImage->cropImage((int)$coords['width'], (int)$coords['height'], (int)$coords['offset_x'], (int)$coords['offset_y']);
509509
$screenShotImage->writeImage($elementPath);
510510
}
511511

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
6+
/**
7+
* Inherited Methods
8+
* @method void wantTo($text)
9+
* @method void wantToTest($text)
10+
* @method void execute($callable)
11+
* @method void expectTo($prediction)
12+
* @method void expect($prediction)
13+
* @method void amGoingTo($argumentation)
14+
* @method void am($role)
15+
* @method void lookForwardTo($achieveValue)
16+
* @method void comment($description)
17+
* @method void pause($vars = [])
18+
*
19+
* @SuppressWarnings(PHPMD)
20+
*/
21+
class WebGuy extends \Codeception\Actor
22+
{
23+
use _generated\WebGuyActions;
24+
25+
/**
26+
* Define custom actions here
27+
*/
28+
29+
// multi session testing needs to be explicitly enabled since codeception 3, see https://codeception.com/04-24-2019/codeception-3.0.html
30+
use \Codeception\Lib\Actor\Shared\Friend;
31+
}

0 commit comments

Comments
 (0)