Created
December 10, 2018 12:33
-
-
Save mrunkel/6ab93be3e4115267b9a74e910ecc7a52 to your computer and use it in GitHub Desktop.
PHP method to take full screenshots in codeception
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Inherited Methods | |
* @method void wantToTest($text) | |
* @method void wantTo($text) | |
* @method void execute($callable) | |
* @method void expectTo($prediction) | |
* @method void expect($prediction) | |
* @method void amGoingTo($argumentation) | |
* @method void am($role) | |
* @method void lookForwardTo($achieveValue) | |
* @method void comment($description) | |
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) | |
* | |
* @SuppressWarnings(PHPMD) | |
*/ | |
class AcceptanceTester extends \Codeception\Actor | |
{ | |
use _generated\AcceptanceTesterActions; | |
/** | |
* Define custom actions here | |
*/ | |
public function makeFullScreenshot($name = null) | |
{ | |
// set the width appropriately (to calc the height) | |
$this->resizeWindow(1920, 2000); | |
$docHeight = $this->executeJS('return document.body.scrollHeight'); | |
// now reset the height to what's needed. | |
$this->resizeWindow(1920, $docHeight); | |
$this->makeScreenshot($name); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment