Return-Path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=profusion-mobi.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=UVRiSLdYcfrh+uMjPqcTPeK01vs6YXZpKywH1Bj1tn4=; b=bqz4N5NjY5jwd7UF9pfWtUe763JFq0sFD6ZOwMtOsM5YipDlPnArDoIwxX5juZJQKJ 70YFKxjQY3gl+Q4rZ37DAO+dwKUROKN/NG0R9aCnpm5PkIh1BbW8F7FcaSyGW1hgGAAR ZbaVuITwrM6znfE/16Dv3YZFbclGE75wpdWjiduVF1yooi4tbknGUxAbHbjJYW/9xbbL BYNJkijbNBRbxZB5k/w9+bHWpo5pzT0mETLsKrI7OfP1INOEyPE6SkQ9/gqu4aLoW594 Af66fMjZ8/sgQ0XeW0M0mtIolNLa9wh4dX4/8Ee1pBbwMBjL7B6zbgacRMVVWDlr406w 2shQ== From: Guilherme Campos Camargo Date: Tue, 24 Apr 2018 14:24:37 -0300 Message-Id: <20180424172451.2682-1-guicc@profusion.mobi> Subject: [Fuego] [PATCH 00/14] Add screenshot test to fuego-release-test List-Id: Mailing list for the Fuego test framework List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fuego@lists.linuxfoundation.org Hello, everyone. This series of patches adds a new test case class to the fuego_release_test functional test. The name of this new test class is "CheckScreenshot", and its purpose is to get a screenshot of a web-page (in this specific case, Fuego's Jenkins' webpage) and compare it with a reference image. Currently, CheckScreenshot supports: - Taking screenshot of an HTML element of a page and compare it with a reference image. - Taking screenshot of the full viewport (full page if it fits in the viewport) and also compare it with a reference image. - Take a screenshot (full or element) and compare only specific regions of interest with a reference image. The mask is a black-and-white image in which black regions are ignored by the comparison algorithm. On these patches we have also added a helper script (take_screenshot.py) that may be used for collecting reference screenshots and a few test cases to serve as example of usage. A README.md file has also been to explain the usage of fuego_release_test and the helper script, including a few examples. # Running Currently this test requires a modified version of Fuego to be executed, given that it needs to install some dependencies and needs to map the dockerd socket from the host to the fuego container. The modified version can be found in two different branches on Profusion's fuego fork. 1 - Branch master: Just a few commits that are necessary for making this test work, applied on top of fuego/next. We plan to try to integrate these commits into fuego/next in the future. 2 - Branch fuego-base-image: A more complex change on fuego, that makes the necessary changes for allowing it to be shipped as a docker image through dockerhub. The steps for each one of the versions above are given below: ## Building the image (from the branch fuego-test) To run the test, execute the following commands: ``` git clone --branch master https://bitbucket.org/profusionmobi/fuego-core.git git clone --branch fuego-test https://bitbucket.org/profusionmobi/fuego.git cd fuego ./install fuego-to-test-fuego ./fuego-host-scripts/docker-create-container.sh fuego-to-test-fuego fuego-to-test-fuego-container ./fuego-host-scripts/docker-start-container.sh fuego-to-test-fuego-container ``` Then, add the fuego-test board and the Functional.fuegotest and start the test through Jenkins (localhost:8080/fuego/) ``` ftc add-nodes fuego-test ftc add-jobs -b fuego-test -t Functional.fuegotest ``` ## Using the modified Fuego Base Image from Dockerhub (fuego-base-image): You can also use the fuego base image that's being developed in Profusion's fuego-base-image branch in our fork: https://bitbucket.org/profusionmobi/fuego/branch/fuego-base-image The image is already available on dockerhub and can be downloaded/executed with: ``` docker pull fuegotest/fuego docker run -it \ -p 8080:8080 \ -v $(pwd)/host_fuego_home:/var/fuego_home \ -e JENKINS_UID=$(id -u) \ -e JENKINS_GID=$(id -g) \ -v /var/run/docker.sock:/var/run/docker.sock \ fuegotest/fuego:latest ``` Wait for the shell to be available and add fuego-test board and Functional.fuegotest as explained in the last section. ``` ftc add-nodes fuego-test ftc add-jobs -b fuego-test -t Functional.fuegotest ``` You can also run the test in standalone mode (given that you have all the dependencies installed in your system). See the test README.md for more instructions. Thanks. Guilherme Campos Camargo (14): Add a SeleniumCommand that compares screenshots Minor style fix Add a CheckScreenshot command into the COMMANDS_TO_TEST list Increase the size of the webdriver viewport Allow working_dir and install_dirs to be different Prevent exception NameError when removing container Add an example reference screenshot Add helper script for taking element/full-page screenshots Add mask-img-path argument to CheckScreenshot for ignored areas Add a README.md Allow Full viewport Screenshots Allow compare-with-mask to work with ImageMagick 6 and ImageMagick 7 Improve logging Set logging level to INFO by default .../Functional.fuego_release_test/README.md | 182 +++++++++ .../fuego_test.sh | 6 +- .../helpers/take_screenshot.py | 145 ++++++++ .../screenshots/footer.png | Bin 0 -> 7371 bytes .../screenshots/footer_mask.png | Bin 0 -> 302 bytes .../screenshots/full_screenshot.png | Bin 0 -> 46323 bytes .../screenshots/full_screenshot_mask.png | Bin 0 -> 10717 bytes .../screenshots/side-panel-tasks.png | Bin 0 -> 9609 bytes .../Functional.fuego_release_test/test_run.py | 347 ++++++++++++++++-- 9 files changed, 639 insertions(+), 41 deletions(-) create mode 100644 engine/tests/Functional.fuego_release_test/README.md create mode 100755 engine/tests/Functional.fuego_release_test/helpers/take_screenshot.py create mode 100644 engine/tests/Functional.fuego_release_test/screenshots/footer.png create mode 100644 engine/tests/Functional.fuego_release_test/screenshots/footer_mask.png create mode 100644 engine/tests/Functional.fuego_release_test/screenshots/full_screenshot.png create mode 100644 engine/tests/Functional.fuego_release_test/screenshots/full_screenshot_mask.png create mode 100644 engine/tests/Functional.fuego_release_test/screenshots/side-panel-tasks.png -- 2.17.0