Skip to content

Fix elements hiding behavior for full screen shot #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docker/php.docker
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN docker-php-ext-configure zip --with-libzip=/usr/include \
&& docker-php-ext-install zip

# composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& /usr/local/bin/composer global require hirak/prestissimo \
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --version=1.0.0 --filename=composer \
&& /usr/local/bin/composer global require hirak/prestissimo "0.3.10" \
&& rm -rf /root/.composer/cache/*

6 changes: 4 additions & 2 deletions module/VisualCeption.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,8 @@ private function createScreenshot($identifier, array $coords, array $excludeElem
$elementPath = $this->getScreenshotPath($identifier);
$screenShotImage = new \Imagick();

$this->hideElementsForScreenshot($excludeElements);

if ($this->config["fullScreenShot"] == true) {
$height = $this->webDriver->executeScript("var ele=document.querySelector('html'); return ele.scrollHeight;");
list($viewportHeight, $devicePixelRatio) = $this->webDriver->executeScript("return [window.innerHeight, window.devicePixelRatio]");
Expand All @@ -408,15 +410,15 @@ private function createScreenshot($identifier, array $coords, array $excludeElem
$fullShot->writeImage($elementPath);

} else {
$this->hideElementsForScreenshot($excludeElements);
$screenshotBinary = $this->webDriver->takeScreenshot();
$this->resetHideElementsForScreenshot($excludeElements);

$screenShotImage->readimageblob($screenshotBinary);
$screenShotImage->cropImage($coords['width'], $coords['height'], $coords['offset_x'], $coords['offset_y']);
$screenShotImage->writeImage($elementPath);
}

$this->resetHideElementsForScreenshot($excludeElements);

return $elementPath;
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.