Fix issues with create screenshot#75
Conversation
…tes being outside window dimensions
|
@buresmi7 any thoughts on when you can address this? |
|
@paulmskim thanks for your PR ;) new option looks good! it would be nice have some test for it. |
|
@buresmi7 I tried adding tests but the webdriver I'm using on my project (https://packagist.org/packages/codeception/module-webdriver#1.4.0) runs differently from the webdriver for the tests (the facebook webdriver does not respect the window size option when taking a screenshot, which is the problem here, and I can't run a test to show the issue). One option is to update webdriver to a non-abandoned package, and maybe codeception too. Any other thoughts on how to test this? |
#78 updates codeception, webdriver & php version. |
|
@paulmskim any updates on this ? |
|
@ggiak I've done some simple testing within the module, but not enough within other projects to be happy with this. I will say that jumping directly from php >=5.4 to >=8.0 is a bit extreme. There are also no incremental versions that follow codeception, webdriver, and other module releases. Projects that are still running on php 7.4 or older codeception versions, like the one I'm working on, cannot use this. I'll keep this PR open, but will leave it to you and @buresmi7 to merge or close as you see fit. |
|
|
||
| $screenShotImage->resetIterator(); | ||
| $fullShot = $screenShotImage->appendImages(true); | ||
| $fullShot->writeImage($elementPath); |
There was a problem hiding this comment.
if you decide to close this, at the least remove this (double writeImage)
Hey @paulmskim, from my point of view we "jumped" so much in order support codeception version 5, not php8. Unfortunately, codeception 5 requires php8 as seen here: https://github.com/Codeception/Codeception/blob/5.0/composer.json#L17 hence the huge refactoring. But you are right, Perhaps we should write something relevant to the readme |
This PR fixes a couple issues with the
createScreenshot()method:fullScreenShotconfig totrue, a blank image is generated. To fix this, I've added a new configforceFullScreenShotconfig to capture the full screen to allow cropping to occur when the element position is outside the initial window dimensions.fullScreenShotconfig istrue, all of the screenshots after the first image returns a repeated image of the last iterated image. To fix this, I've added a script for the webdriver to set the window position back to0, 0.Not sure if the
forceFullScreenShotconfig is the best way to do this, but the other option is to capture the full screen in all cases.