alex-moreno/glitcherbot 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alex-moreno/glitcherbot

Composer 安装命令:

composer require alex-moreno/glitcherbot

包简介

Visual regression testing made easy

README 文档

README

Automating the boring stuff.

Managing a website can be difficult. You can end up with hundreds of pages, and making sure all of them are functional after an event, say a deployment, peaks of traffic, editorial changes, ads or javascripts behaving badly, ... Creating software and maintaining websites and apps is hard... regression testing should not.

Before you start, Clone / fork this repository and go into the folder. There are two ways of using this tool: With Vagrant or Docker.

Vagrant

Download and install Vagrant.

Requirements

  • PHP 7.0
  • Sqlite
  • A (maybe big) list of urls to crawl. Robots.txt and Sitemaps detected automatically

Installation

  1. Download and unzip the package:
curl -L -# -C - -O "https://github.com/alex-moreno/glitcherbot/archive/main.zip"
unzip main.zip
cd glitcherbot-main
  1. Run: composer install

  2. Make a copy of your config.php

cp config.sample.php config.php

Usage

Create a .csv which contains a list of urls to iterate over (see example.csv).

If using Acquia Site Factory, a command is supplied to generate a list of sites from a sites.json file. You'll need to:

  1. Download the sites.json in your Acquia Cloud subscription

scp [subscription][ENV].[ENV]@[subscription][ENV].ssh.enterprise-g1.acquia-sites.com:/mnt/files/[subscription][ENV]/files-private/sites.json ./sites-dev.json

  1. Vagrant up if you want to use the crawler inside the virtual machine (recommended).

  2. Run the crawl against that json

php bin/visual_regression_bot.php acquia:acsf-crawl-sites sites.json

You can see all available commands by running:

php bin/visual_regression_bot.php

For help with a specific command use:

php bin/visual_regression_bot.php help <command>

Whilst debugging, increase verbosity by adding a number of -v flags.

-v : verbose -vv : very verbose -vvv : debug

Configuration

There are some settings that you can configure, like the headers that you'll send to the site or the concurrency that you want to use.

Move your config.sample.php into config.php and adapt to your needs. For example:

<?php

return [
  'headers' => [
    'User-Agent'   => 'GlitcherBotScrapper/0.1',
    'Accept'       => 'application/json',
  ],
  'http_errors' => false,
  'connect_timeout' => 0, // wait forever
  'read_timeout' => 0,
  'timeout' => 0, // wait forever
  'concurrency' => 60,
];

Note: The higher the concurrency is configured, the more sites it will run on each step, but be careful, php is fast (contrary to popular belief), it could send high load to a site and put it in trouble. Big power means bigger responsibility.

Stand Alone Tool

To run the regression tool as a stand along interface you need to point your webserver at the html/ directory in the repo.

PHP Web Server

A composer script has been included to aid with testing of the tool. To run this use the command.

composer start

Then navigate to the following address in your browser.

http://0.0.0.0:8000/

Docker

A docker setup has been included to aid with the running or the tool.

Download and install Docker

Starting the Docker container

This command will start the containers

make up

Building the tool (only need to run once)

This command will check if the config file exists and create one if needed. Then it will install all Composer dependencies.

make build

Crawling

This command will use sample-sites.csv as source of urls to Crawl by default.

make crawl

To run the command with a different file, use the syntax

make crawl SITES_CSV=path_to_sites_csv

or for Acquia json files:

make crawl-acquia SITES_JSON=sitesd8-prod.json

Keep in mind that the crawl runs within the container, so path_to_sites_csv needs to be relative to the container.

Web interface

Opens the tool on the browser.

make open

Stopping the container

make stop

Chained commands.

You can run all commands at once, for example the following command will start the containers, build, craw and open the browser.

make up build crawl open

Parameters

--include_sitemaps=yes

This will include all sitemaps in the website, if they are referenced from the robots.txt

--force_sitemaps=yes

Using makefile and Docker:

make crawl SITES_CSV=sample-sites.csv INCLUDE_SITEMAPS=yes

make crawl SITES_CSV=sample-sites.csv FORCE_SITEMAPS=yes

alex-moreno/glitcherbot 适用场景与选型建议

alex-moreno/glitcherbot 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 15, 最近一次更新时间为 2021 年 01 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「visual regression」 「visual regression testing」 「regression testing」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 alex-moreno/glitcherbot 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 alex-moreno/glitcherbot 我们能提供哪些服务?
定制开发 / 二次开发

基于 alex-moreno/glitcherbot 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 15
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 15
  • Watchers: 3
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: AGPL-3.0-or-later
  • 更新时间: 2021-01-30