如何安装和配置幽灵

什么是幽灵?

Wraith 是一种视觉回归测试工具,它使用屏幕截图比较来评估网站在一段时间内的视觉差异。 它目前托管在 GitHub 上,可在 Apache 2.0 开源许可证。

谁从使用幽灵中受益?

Wraith 通常用于确保新更改不会对生产网站的设计产生不利影响。 您可以运行 Wraith 来比较网站上每个页面的输出。

先决条件

Wraith 使用各种第三方程序来正常工作。 在本教程中,我们将在 Ubuntu 18.04 上安装 Wraith。 要安装它,我们首先需要安装下面的依赖项。

  • 红宝石
  • ImageMagick
  • 至少以下浏览器之一:
    • 幻影JS
    • 卡斯珀JS
    • SlimerJS

步骤 1. 安装 Ruby

Ruby 是一种开源动态编程语言。 在此安装过程中,我们将使用简单的安装。 如果你想要一个完整的、高级的 ruby​​ 安装,你可以点击这个链接到关于如何安装 Ruby on Rails 的文章。

[root@host ~]# apt-get install ruby-full
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  fonts-lato javascript-common libgmp-dev libgmpxx4ldbl libjs-jquery libruby2.5 rake ri ruby ruby-dev ruby-did-you-mean
  ruby-minitest ruby-net-telnet ruby-power-assert ruby-test-unit ruby2.5 ruby2.5-dev ruby2.5-doc rubygems-integration unzip zip
Suggested packages:
  apache2 | lighttpd | httpd gmp-doc libgmp10-doc libmpfr-dev bundler
The following NEW packages will be installed:
  fonts-lato javascript-common libgmp-dev libgmpxx4ldbl libjs-jquery libruby2.5 rake ri ruby ruby-dev ruby-did-you-mean
  ruby-full ruby-minitest ruby-net-telnet ruby-power-assert ruby-test-unit ruby2.5 ruby2.5-dev ruby2.5-doc rubygems-integration
  unzip zip
0 upgraded, 22 newly installed, 0 to remove and 76 not upgraded.
Need to get 8701 kB of archives.
After this operation, 49.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
...
...
...
Setting up ruby-full (1:2.5.1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for fontconfig (2.12.6-0ubuntu2) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
root@host:~#

安装 Ruby 后,我们可以使用以下命令检查版本。

root@host:~# ruby --version
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
root@host:~# 

步骤 2. 验证是否安装了 ImageMagick

ImageMagick 是一组用于读取和编辑图形格式文件的程序。 它可能预装在您的 Ubuntu 版本中,但我们仍会验证以确保已安装。 如果未安装 ImageMagick,输出应类似于以下内容。

root@host:~# convert --version
Command 'convert' not found, but can be installed with:

apt install imagemagick-6.q16                
apt install graphicsmagick-imagemagick-compat
apt install imagemagick-6.q16hdri            
root@host:~#

让我们继续安装 ImageMagick 的先决条件,然后安装 ImageMagick 本身。

root@host:~# apt-get install php php-common gcc
Reading package lists... Done
Building dependency tree       
Reading state information... Done
gcc is already the newest version (4:7.4.0-1ubuntu2.3).
gcc set to manually installed.
The following additional packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php7.2 libapr1 libaprutil1 libaprutil1-dbd-sqlite3
  libaprutil1-ldap liblua5.2-0 libsodium23 php7.2 php7.2-cli php7.2-common php7.2-json php7.2-opcache php7.2-readline
Suggested packages:
  www-browser apache2-doc apache2-suexec-pristine | apache2-suexec-custom php-pear
The following NEW packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php7.2 libapr1 libaprutil1 libaprutil1-dbd-sqlite3
  libaprutil1-ldap liblua5.2-0 libsodium23 php php-common php7.2 php7.2-cli php7.2-common php7.2-json php7.2-opcache
  php7.2-readline
0 upgraded, 19 newly installed, 0 to remove and 76 not upgraded.
Need to get 5724 kB of archives.
After this operation, 24.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
...
...
...
Setting up php7.2-cli (7.2.24-0ubuntu0.18.04.3) ...
update-alternatives: using /usr/bin/php7.2 to provide /usr/bin/php (php) in auto mode
update-alternatives: using /usr/bin/phar7.2 to provide /usr/bin/phar (phar) in auto mode
update-alternatives: using /usr/bin/phar.phar7.2 to provide /usr/bin/phar.phar (phar.phar) in auto mode

Creating config file /etc/php/7.2/cli/php.ini with new version
Setting up libapache2-mod-php7.2 (7.2.24-0ubuntu0.18.04.3) ...

Creating config file /etc/php/7.2/apache2/php.ini with new version
Module mpm_event disabled.
Enabling module mpm_prefork.
apache2_switch_mpm Switch to prefork
apache2_invoke: Enable module php7.2
Setting up php7.2 (7.2.24-0ubuntu0.18.04.3) ...
Setting up php (1:7.2+60ubuntu1) ...
Processing triggers for systemd (237-3ubuntu10.33) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ufw (0.36-0ubuntu0.18.04.1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
root@host:~# 

安装 ImageMagick 的命令如下。

root@host:~# apt-get install php-imagick imagemagick-6.q16
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  fonts-droid-fallback fonts-noto-mono ghostscript gsfonts imagemagick-6-common libcupsfilters1 libcupsimage2 libfftw3-double3
  libgs9 libgs9-common libijs-0.35 libjbig2dec0 liblqr-1-0 libltdl7 libmagickcore-6.q16-3 libmagickwand-6.q16-3 libpaper-utils
  libpaper1 ttf-dejavu-core
Suggested packages:
  fonts-noto ghostscript-x libfftw3-bin libfftw3-dev libmagickcore-6.q16-3-extra
The following NEW packages will be installed:
  fonts-droid-fallback fonts-noto-mono ghostscript gsfonts imagemagick-6-common libcupsfilters1 libcupsimage2 libfftw3-double3
  libgs9 libgs9-common libijs-0.35 libjbig2dec0 liblqr-1-0 libltdl7 libmagickcore-6.q16-3 libmagickwand-6.q16-3 libpaper-utils
  libpaper1 php-imagick ttf-dejavu-core
0 upgraded, 20 newly installed, 0 to remove and 76 not upgraded.
Need to get 15.5 MB of archives.
After this operation, 49.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
...
...
...
Setting up libgs9-common (9.26~dfsg+0-0ubuntu0.18.04.12) ...
Setting up libpaper1:amd64 (1.1.24+nmu5ubuntu1) ...

Creating config file /etc/papersize with new version
Setting up imagemagick-6-common (8:6.9.7.4+dfsg-16ubuntu6.8) ...
Setting up fonts-droid-fallback (1:6.0.1r16-1.1) ...
Setting up libpaper-utils (1.1.24+nmu5ubuntu1) ...
Setting up gsfonts (1:8.11+urwcyr1.0.7~pre44-4.4) ...
Setting up ttf-dejavu-core (2.37-1) ...
Setting up libfftw3-double3:amd64 (3.3.7-1) ...
Setting up fonts-noto-mono (20171026-2) ...
Setting up libcupsfilters1:amd64 (1.20.2-0ubuntu3.1) ...
Setting up libcupsimage2:amd64 (2.2.7-1ubuntu2.7) ...
Setting up liblqr-1-0:amd64 (0.4.2-2.1) ...
Setting up libjbig2dec0:amd64 (0.13-6) ...
Setting up libltdl7:amd64 (2.4.6-2) ...
Setting up libijs-0.35:amd64 (0.35-13) ...
Setting up libgs9:amd64 (9.26~dfsg+0-0ubuntu0.18.04.12) ...
Setting up libmagickcore-6.q16-3:amd64 (8:6.9.7.4+dfsg-16ubuntu6.8) ...
Setting up ghostscript (9.26~dfsg+0-0ubuntu0.18.04.12) ...
Setting up libmagickwand-6.q16-3:amd64 (8:6.9.7.4+dfsg-16ubuntu6.8) ...
Setting up php-imagick (3.4.3~rc2-2ubuntu4) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for fontconfig (2.12.6-0ubuntu2) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
root@host:~# 

再次,我们可以通过运行以下命令来检查是否安装了 ImageMagick。

root@host:~# convert --version
Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 https://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: https://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP 
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib
root@host:~#

步骤 3.安装以下浏览器之一

接下来,我们需要安装三种所需的浏览器类型之一。

  • 幻影JS
  • 卡斯珀JS
  • SlimerJS
  • Chrome (目前使用 Selenium WebDriver + Chromedriver 为 Chrome; 可以针对特定的选择器)

出于本教程的目的,我们将安装 PhantomJS。 PhantomJS 是用于自动页面交互的知名浏览器。 它是离线网站测试、屏幕截图、页面自动化和网络监控的有效工具。 它还提供对各种 Web 标准的支持,包括 DOM 处理、CSS、JSON、Canvas 和 SVG 选择器。

接下来,我们将再次更新我们的包列表。

root@host:~# apt-get update

然后,我们需要安装一些 PhantomJS 所需的额外库。

root@host:~# apt-get install build-essential chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev -y
...
...
...
Setting up chrpath (0.16-2) ...
Setting up libpthread-stubs0-dev:amd64 (0.3-4) ...
Setting up libpng-tools (1.6.34-1ubuntu0.18.04.2) ...
Setting up libssl-dev:amd64 (1.1.1-1ubuntu2.1~18.04.5) ...
Setting up xorg-sgml-doctools (1:1.11-1) ...
Setting up x11proto-dev (2018.4-4) ...
Setting up pkg-config (0.29.1-0ubuntu2) ...
Setting up xtrans-dev (1.3.5-1) ...
Setting up libxdmcp-dev:amd64 (1:1.1.2-3) ...
Setting up libx11-doc (2:1.6.4-3ubuntu0.2) ...
Setting up zlib1g-dev:amd64 (1:1.2.11.dfsg-0ubuntu2) ...
Setting up x11proto-core-dev (2018.4-4) ...
Setting up libxau-dev:amd64 (1:1.0.8-1) ...
Setting up libxcb1-dev:amd64 (1.13-2~ubuntu18.04) ...
Setting up libx11-dev:amd64 (2:1.6.4-3ubuntu0.2) ...
Setting up libpng-dev:amd64 (1.6.34-1ubuntu0.18.04.2) ...
Setting up libxrender-dev:amd64 (1:0.9.10-1) ...
Setting up libfreetype6-dev:amd64 (2.8.1-2ubuntu2) ...
Setting up libfontconfig1-dev:amd64 (2.12.6-0ubuntu2) ...
Setting up libxft-dev (2.3.2-1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
root@host:~# 

接下来,让我们导出文件。

root@host:~# export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
root@host:~#

现在,我们可以下载 PhantomJS tar.bz2 安装程序文件。

root@host:~# wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2
--2020-03-05 14:39:03--  https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2
Resolving github.com (github.com)... 140.82.114.3
Connecting to github.com (github.com)|140.82.114.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/5755891/d55faeca-f27c-11e5-84be-6e92fb868e05 [following]
--2020-03-05 14:39:04--  https://github-production-release-asset-2e65be.s3.amazonaws.com/5755891/d55faeca-f27c-11e5-84be-6e92fb868e05
Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.217.46.108
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.217.46.108|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 23415665 (22M) [application/octet-stream]
Saving to: ‘phantomjs-2.1.1-linux-x86_64.tar.bz2’

phantomjs-2.1.1-linux-x86_64.tar 100%[=======================================================>]  22.33M  61.0MB/s    in 0.4s    

2020-03-05 14:39:04 (61.0 MB/s) - ‘phantomjs-2.1.1-linux-x86_64.tar.bz2’ saved [23415665/23415665]

root@host:~# 

接下来,让我们提取文件。

tar xvjf $PHANTOM_JS.tar.bz2

接下来,我们将把 phantomjs-2.1.1-linux-x86_64/ 文件夹移动到 /usr/local/share。

root@host:~# mv $PHANTOM_JS /usr/local/share

现在,我们可以将 phantomjs 二进制文件链接到 bin。

root@host:/usr/local/share# ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin
root@host:/usr/local/share#

最后,让我们检查一下安装,看看是否安装了我们需要的版本。

root@host:/usr/local/share# phantomjs --version
2.1.1
root@host:/usr/local/share#

第 4 步。安装幽灵

让我们继续安装 Wraith。

root@host:~# gem install wraith
root@host:/usr/local/share# gem install wraith
Fetching: image_size-2.0.2.gem (100%)
Successfully installed image_size-2.0.2
Fetching: mini_magick-4.10.1.gem (100%)
Successfully installed mini_magick-4.10.1
Fetching: robotex-1.0.0.gem (100%)
Successfully installed robotex-1.0.0
Fetching: mini_portile2-2.4.0.gem (100%)
Successfully installed mini_portile2-2.4.0
Fetching: nokogiri-1.10.9.gem (100%)
Building native extensions. This could take a while...
...
...
...
Parsing documentation for wraith-4.2.4
Installing ri documentation for wraith-4.2.4
Done installing documentation for image_size, mini_magick, robotex, mini_portile2, nokogiri, anemone, log4r, thor, parallel, childprocess, rubyzip, selenium-webdriver, io-like, archive-zip, chromedriver-helper, wraith after 5 seconds
16 gems installed
root@host:/usr/local/share#

同样,让我们​​验证安装的 Wraith 版本。

root@host:~# wraith --version
4.2.4
root@host:~#

配置幽灵

首先,我们需要创建一个项目文件夹。

mkdir -p /home/user/wraith

现在,让我们将目录更改为我们的项目文件夹。

root@host:~# cd /home/user/wraith

接下来,我们可以使用 wraith 命令来设置我们项目文件夹中所需的文件夹和文件。

root@host:/home/user/wraith# wraith setup
      create  configs
      create  configs/capture.yaml
      create  configs/history.yaml
      create  configs/spider.yaml
      create  javascript
      create  javascript/cookies_and_headers--casper.js
      create  javascript/cookies_and_headers--phantom.js
      create  javascript/disable_javascript--casper.js
      create  javascript/disable_javascript--phantom.js
      create  javascript/interact--casper.js
      create  javascript/interact--chrome.js
      create  javascript/interact--phantom.js
      create  javascript/wait--casper.js
      create  javascript/wait--chrome.js
      create  javascript/wait--phantom.js
root@host:/home/user/wraith# 
root@host:/home/user/wraith# ll
total 16
drwxr-xr-x 4 root root 4096 Mar  5 15:32 ./
drwxr-xr-x 3 root root 4096 Mar  5 15:27 ../
drwxr-xr-x 2 root root 4096 Mar  5 15:32 configs/
drwxr-xr-x 2 root root 4096 Mar  5 15:32 javascript/
root@host:/home/user/wraith#

wraith 命令为我们的 wraith 文件创建必要的配置、模板和设置文件夹。 接下来,我们将复制位于 configs 文件夹中的名为“config.yaml”的文件,并为其指定一个名为“my_project_name.yaml”的新文件名。 然后,我们可以使用 vim 添加我们想要用来比较我们的站点的设置。

root@host:/home/user/wraith# cp configs/capture.yaml configs/my_project_name.yaml

root@host:/home/user/wraith# vim configs/capture.yaml

下面是文件的完整视图。

# (required) The engine to run Wraith with. Examples: 'phantomjs', 'casperjs', 'slimerjs'
browser: “phantomjs”

# (required) The domains to take screenshots of.
domains:
  current:  “https://www.example.com”
  new:      “https://develop.example.com”

# (required) The paths to capture. All paths should exist for both of the domains specified above.
paths:
  home:     /
  about:    /about
  contact:  /get-in-touch

# (required) Screen widths (and optional height) to resize the browser to before taking the screenshot.
screen_widths:
  - 320
  - 600x768
  - 768
  - 1024
  - 1280

# (required) The directory that your screenshots will be stored in
directory: 'shots'

为了配置“my_project_name.yaml”文件,我们需要调整六个必需的参数(如上所示)。

  • 浏览器
    • 当前的
    • 新的
  • 路径:
    • 家: /
    • 关于:/关于
    • 联系方式:/get-in-touch
  • 屏幕宽度
  • 目录
  • 绒毛

这是框标题 yaml 文件格式对空间敏感,因此文件中的“域”和“路径”条目等设置应按照编辑器中的说明隔开。

我们还可以修改其他几个可选设置以满足我们的特定需求。

# (optional) JavaScript file to execute before taking screenshot of every path. Default: nil
before_capture: 'javascript/disable_javascript--phantom.js'

# (optional) The maximum acceptable level of difference (in %) between two images before Wraith reports a failure. Default: 0
threshold: 5

# (optional) Specify the template (and generated thumbnail sizes) for the gallery output.
gallery:
  template: 'slideshow_template' # Examples: 'basic_template' (default), 'slideshow_template'
  thumb_width:  200
  thumb_height: 200

# (optional) Choose which results are displayed in the gallery, and in what order. Default: alphanumeric
# Options:

#   alphanumeric - all paths (with or without a difference) are shown, sorted by path

#   diffs_first - all paths (with or without a difference) are shown, sorted by difference size (largest first)

#   diffs_only - only paths with a difference are shown, sorted by difference size (largest first)

# Note: different screen widths are always grouped together.
mode: diffs_first

# (optional) Set the number of threads to use when saving images. Raising this value can improve performance, but very high
# values can lead to server connection issues. Set to around 1.5 the available CPU cores for best performance. Default: 8
threads: 8

添加特定设置后,在 vim 中键入 :wq 以保存文件。

幽灵如何使用?

Wraith 有两种主要模式可供选择:

  • “捕获”
  • “历史”

捕获模式对于比较开发站点和实时站点的版本很有用。 为了利用这一点,我们可以在 yaml 文件中指定两个域、路径数以及屏幕宽度,然后我们可以运行“幽灵捕获”。

root@host:~# wraith capture configs/capture.yaml
Config validated. No serious issues found.
Creating Folders
SAVING IMAGES
Loading https://www.example.com/ at dimensions: 320×1500
Loading https://develop.example.com/ at dimensions: 320×1500
Loading https://www.example.com/ at dimensions: 768×1500
Loading https://develop.example.com/ at dimensions: 600×768
Loading https://www.example.com/ at dimensions: 600x768
Loading https://develop.example.com/ at dimensions: 1024×1500
Loading https://www.example.com/ at dimensions: 1024×1500
Loading https://develop.example.com/ at dimensions: 768×1500
...
...
...
Snapping https://www.example.com/ at: 320×1500
Snapping https://www.example.com/ at: 768×1500
Snapping https://www.example.com/ at: 600×768
Snapping https://www.example.com/ at: 1024×1500

Traceback (most recent call last):
	6: from /var/lib/gems/2.5.0/gems/parallel-1.19.1/lib/parallel.rb:209:in `block (3 levels) in in_threads'
	5: from /var/lib/gems/2.5.0/gems/parallel-1.19.1/lib/parallel.rb:359:in `block in work_in_threads'
	4: from /var/lib/gems/2.5.0/gems/parallel-1.19.1/lib/parallel.rb:518:in `with_instrumentation'
	3: from /var/lib/gems/2.5.0/gems/parallel-1.19.1/lib/parallel.rb:360:in `block (2 levels) in work_in_threads'
	2: from /var/lib/gems/2.5.0/gems/parallel-1.19.1/lib/parallel.rb:509:in `call_with_index'
	1: from /var/lib/gems/2.5.0/gems/wraith-4.2.4/lib/wraith/save_images.rb:80:in `block in parallel_task'
/var/lib/gems/2.5.0/gems/wraith-4.2.4/lib/wraith/save_images.rb:89:in `rescue in block in parallel_task'
root@host:~# 

另一种格式是历史模式。 使用此选项,我们可以随时间比较同一域。 它用于检查您的网站是否随着时间的推移看起来相同或是否发生了变化。 当您的网站使用第三方组件时很有帮助。

在此模式下,您可以指定一个域、任意数量的路径和屏幕宽度。 您确实需要确保设置了 history_dir 属性,然后运行创建故事以生成基本屏幕截图。 然后,我们可以添加新的屏幕截图以将它们与旧屏幕截图进行比较。

无论您使用哪种模式,都有某些配置选项仍然适用于这两种模式。

图库和输出

捕获每个屏幕截图后,Wraith 将进行验证,然后在 diff.png 和 data.txt 中显示必要的信息。 data.txt 将显示每个已更改文件的像素数。 在比较所有图片后,图库可用于查看每张图片。

蜘蛛功能

在这种模式下,Wraith 将抓取页面或站点。 您可以通过以下两种方式之一选择您的路径。

  1. 您可以手动指定路径,或者,
  2. 让 Wraith 抓取您的网站以确定您的路径。

为了让 Wraith 为我们抓取网站,我们只需删除 .yaml 文件中的“paths”属性,然后在 .yaml 文件中指定“imports”属性。

imports: "spider_paths.yml"​

然后,我们可以让 Wraith 爬取域。

wraith spider my_config.yaml

这会在与我们的 my_project_name.yaml 相同的目录中创建一个名为 spider_paths.yml 的文件。 现在,我们可以像手动指定路径一样运行 Wraith 命令。

root@host:~# wraith capture my_config.yml

幽灵命令

这是可用 Wraith 命令的完整列表。

root@host:/# wraith
Commands:
  wraith capture [config_name] # Capture paths against two domains, compare them, generate gallery
  wraith compare_images [config_name] # compares images to generate diffs
  wraith copy_base_images [config_name] # copies the required base images over for comparison with latest images
  wraith crop_images [config_name] # crops images to the same height
  wraith generate_gallery [config_name] # create page for viewing images
  wraith generate_thumbnails [config_name] # create thumbnails for gallery
  wraith help [COMMAND]  Describe available commands or one specific command
  wraith history [config_name] # Setup a baseline set of shots
  wraith info # Show various info about your system
  wraith latest [config_name] # Capture new shots to compare with baseline
  wraith multi_capture [filelist] # A Batch of Wraith Jobs
  wraith reset_shots [config_name] # removes all the files in the shots folder
  wraith save_images [config_name] # captures screenshots
  wraith setup # creates config folder and default config
  wraith setup_folders [config_name] # create folders for images
  wraith spider [config_name] # crawls a site for paths and stores them to YML file
  wraith validate [config_name] # checks your configuration and validates that all required properties exist
  wraith version # Show the version of Wraith

root@host:/# 

要快速了解您的系统,我们可以运行以下命令。

root@host:/# wraith info
DEBUG: #################################################
DEBUG:   Command run:        info
DEBUG:   Wraith version:     4.2.4
DEBUG:   Ruby version:       ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
DEBUG:   ImageMagick:        Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 https://www.imagemagick.org
DEBUG:   PhantomJS version:  2.1.1
DEBUG:   chromedriver version:  ChromeDriver 81.0.4044.20 (f006328e39a9769596eb506c8841c3004b24e747-refs/branch-heads/4044@{#244})
DEBUG:   CasperJS version:   CasperJS not installed
DEBUG: #################################################
root@host:/# 

结论

Wraith 是一款出色的工具,它不仅可以让我们通过创建屏幕截图来自动化比较过程,还可以比较这些屏幕截图并创建差异以供以后分析和检查。

仍然对 Wraith 以及此工具如何在您的测试中更有用有疑问? 给我们打电话 800.580.4985,或打开 聊天 或与我们联系,立即与我们知识渊博的解决方案团队或经验丰富的托管顾问交谈!