Git Product home page Git Product logo

Comments (6)

DudaGod avatar DudaGod commented on August 16, 2024

Привет.
Похоже что-то на страницу добавляется и скролл реагирует небольшим смещением ниже.

В твоем случае возможно достаточно просто переснять скриншот.

Какие есть варианты решения:

  • не снимать всю страницу, а только необходимый блок или связку блоков
  • выставить опцию screenshotDelay в 600. За 600мс обычно скролл бар успевает скрыться
  • отключить скролл с помощью плагина - https://github.com/gemini-testing/hermione-hide-scrollbars (работает только в хромах с поддержкой CDP)
  • перед снятием скриншота наложить на страницу невидимый элемент со смещением справа на необходимое количество пикселей, т.е. чтобы скроллбар не попадал на страницу.

from hermione.

IrinaDydy avatar IrinaDydy commented on August 16, 2024

Добрый день!

Было замечено, при попытке скрытия скролл бара через 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.

DudaGod avatar DudaGod commented on August 16, 2024

Привет.

Похоже падает при попытке кропнуть изображение. Можешь прислать пример теста на котором такая проблема воспроизводится?

from hermione.

IrinaDydy avatar IrinaDydy commented on August 16, 2024

Тест предельно простой, берём xpath для элемента на странице и делаем this.browser.assertView(${path}, elementXpath), просто что элемент, за частую, не помещается в высоту на страницу (как например лайаут), а снять скрин элемента требуется полностью, по этому использую compositeImage: true и assertViewOpts: { allowViewportOverflow: true }:

from hermione.

DudaGod avatar DudaGod commented on August 16, 2024

На словах должно работать. Но, чтобы понять проблему мне нужен код теста, который я бы мог запустить самостоятельно и понять в чем дело.

from hermione.

DudaGod avatar DudaGod commented on August 16, 2024

Закрываю, так как пример кода теста так и не был предоставлен.

from hermione.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.