Comments (6)
Привет.
Похоже что-то на страницу добавляется и скролл реагирует небольшим смещением ниже.
В твоем случае возможно достаточно просто переснять скриншот.
Какие есть варианты решения:
- не снимать всю страницу, а только необходимый блок или связку блоков
- выставить опцию screenshotDelay в 600. За 600мс обычно скролл бар успевает скрыться
- отключить скролл с помощью плагина - https://github.com/gemini-testing/hermione-hide-scrollbars (работает только в хромах с поддержкой CDP)
- перед снятием скриншота наложить на страницу невидимый элемент со смещением справа на необходимое количество пикселей, т.е. чтобы скроллбар не попадал на страницу.
from hermione.
Добрый день!
Было замечено, при попытке скрытия скролл бара через css:
var styleElement = document.createElement('style');
styleElement.id = 'remove-scroll-style';
styleElement.textContent = 'html{overflow:auto}' +
'body::-webkit-scrollbar{display:none !important;}' +
'body{overflow-y: scroll;overflow-x: hidden;}';
document.body.appendChild(styleElement);
В частности, при добавлении html{overflow:auto} и с настройками
compositeImage: true и assertViewOpts: { allowViewportOverflow: true }:
Тест выдаёт ошибку при снятии скриншота:
Error: Out of the bounds
at PngImg.crop (C:\Repos\ForHermione\Autotests\KL.CIWD.Autotests.Hermione\node_modules\png-img\index.js:71:19)
at Image.crop (C:\Repos\ForHermione\Autotests\KL.CIWD.Autotests.Hermione\node_modules\gemini-core\lib\image\index.js:23:19)
at Camera._cropToViewport (C:\Repos\ForHermione\Autotests\KL.CIWD.Autotests.Hermione\node_modules\gemini-core\lib\browser\camera\index.js:54:22)
at C:\Repos\ForHermione\Autotests\KL.CIWD.Autotests.Hermione\node_modules\gemini-core\lib\browser\camera\index.js:25:35
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Browser. (C:\Repos\ForHermione\Autotests\KL.CIWD.Autotests.Hermione\node_modules\hermione\lib\browser\commands\assert-view\index.js:56:29)
at async Browser.wrapCommandFn (C:\Repos\ForHermione\Autotests\KL.CIWD.Autotests.Hermione\node_modules@wdio\utils\build\shim.js:137:29)
from hermione.
Привет.
Похоже падает при попытке кропнуть изображение. Можешь прислать пример теста на котором такая проблема воспроизводится?
from hermione.
Тест предельно простой, берём xpath для элемента на странице и делаем this.browser.assertView(${path}
, elementXpath), просто что элемент, за частую, не помещается в высоту на страницу (как например лайаут), а снять скрин элемента требуется полностью, по этому использую compositeImage: true и assertViewOpts: { allowViewportOverflow: true }:
from hermione.
На словах должно работать. Но, чтобы понять проблему мне нужен код теста, который я бы мог запустить самостоятельно и понять в чем дело.
from hermione.
Закрываю, так как пример кода теста так и не был предоставлен.
from hermione.
Related Issues (20)
- Некорректный тип browser.executionContext.hermioneCtx HOT 2
- Option resetCursor moves the cursor to the center of the screen HOT 2
- Methods of the object stored in hermione.ctx are not passed to the test HOT 9
- Некорректный тип функции `it(` HOT 4
- v9.0.0: Breaking changes HOT 1
- Use Chrome's new Headless mode HOT 3
- Отсутствуют типы для метода moveCursorTo HOT 1
- Тесты на типы HOT 2
- Perform preliminary research and develop a solution for automatic API reference generation or typings
- moveCursorTo не идентичен moveTo в hermione 7 (move target out of bounds) HOT 5
- hermione.ctx нельзя типизировать HOT 4
- Not clear how to create wrapper and fail test with browser.mock HOT 2
- Add a handy way to screenshot the viewport HOT 1
- В тесте недоступно поле browserId HOT 5
- Пропала типизация describe/it и т.п. HOT 2
- Preload the element completely before taking a screenshot
- Implement throttling of test commands
- Add ability to rerun all failed tests HOT 1
- Update webdriverio package HOT 1
- Вытащить наружу методы по работе с браузером HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hermione.