承接 tr33m4n/codeception-module-percy 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

tr33m4n/codeception-module-percy

Composer 安装命令:

composer require tr33m4n/codeception-module-percy

包简介

Percy https://percy.io module for Codeception

README 文档

README

Test

codeception-module-percy

Percy https://percy.io module for Codeception

Requirements

  • Node.js >=14.0.0
  • PHP >= 8.1
  • Composer v2

Installation

composer require --dev tr33m4n/codeception-module-percy

Example Configuration

The following example acceptance.suite.yml configuration assumes the WebDriver module has been configured correctly for your test suite and shows enabling the Percy module and setting some basic configuration:

modules:
    enabled:
        - WebDriver
        - Percy
    config:
      Percy:
        snapshotConfig:
          widths:
            - 1024
            - 768
            - 320
          minHeight: 1080

The following example shows how to configure the percy:process-snapshots in the codeception.yml file:

extensions:
    commands:
        - Codeception\Module\Percy\Command\ProcessSnapshots

Configuration Options

Parameter Type Default Description
snapshotConfig object {} Additional configuration to pass to the "snapshot" functionality
snapshotConfig.percyCSS string null Percy specific CSS to apply to the "snapshot"
snapshotConfig.minHeight int null Minimum height of the resulting "snapshot" in pixels
snapshotConfig.enableJavaScript bool false Enable JavaScript in the Percy rendering environment
snapshotConfig.widths array null An array of integers representing the browser widths at which you want to take snapshots
serializeConfig object {"enableJavaScript": true} Additional configuration to pass to the PercyDOM.serialize method injected into the web driver DOM
collectOnly bool false Setting this to true will only collect snapshots, rather than collect and then send at the end of the run. They can then be sent manually by calling the vendor/bin/codecept percy:process-snapshots command
snapshotServerTimeout int 30 [debug] The length of the time the Percy snapshot server will listen for incoming snapshots and send on to Percy.io (the amount of time needed to send all snapshots after a successful test suite run). No timeout is set by default
snapshotServerPort int 5338 [debug] The port the Percy snapshot server will listen on
snapshotServerDebug bool false [debug] Output verbosely when running the underlying Node Percy library
snapshotFolder string null [debug] Specify a snapshot folder to use when loading or sending snapshots. Folder respects basic glob patterns. Useful if moving snapshots around on the server before sending them with the CLI command
throwOnError bool false [debug] Throw exception on adapter error
instanceId string null [debug] An ID is used to differentiate between one Codeception runs output files to another, ensuring only the current runs output files are cleared on failure. Use this config to pass a custom instance ID

Running

The Percy integration runs automatically with the test suite but will need your PERCY_TOKEN to be set to successfully send snapshots. For more information, see https://docs.percy.io/docs/environment-variables#section-required

Overriding the node path

By default, the node executable used will be the one defined within the PATH of the user running the test suite. This can be overridden however, by setting the environment variable PERCY_NODE_PATH to your preferred location.

Collect only

In some advanced CI setups, it might make sense to collect all snapshots for multiple runs with different parameters and then send them a single time when all runs are complete. This can be achieved by setting the collectOnly config to true. Once all runs are complete, running the command vendor/bin/codecept percy:process-snapshots will then iterate all collected snapshots, send to Percy and then clean up the snapshot folder. The percy:process-snapshots command needs to be configured in the codeception.yml file, see the "Example Configuration" section

Example Test

<?php

class FirstCest
{
    public function frontpageWorks(AcceptanceTester $I)
    {
        $I->amOnPage('/');
        $I->takeAPercySnapshot('My snapshot name');
    }
}

$I->takeAPercySnapshot can optionally be passed an array of additional arguments to override the global settings for percyCSS, minHeight, enableJavaScript and widths on the fly, for example:

use Codeception\Module\Percy\Snapshot;

$I->takeAPercySnapshot('My snapshot name', [
    Snapshot::WIDTHS => [1024, 768, 320], // Browser breakpoint widths
    Snapshot::MIN_HEIGHT => 1080, // Minimum height of the resulting snapshot
    Snapshot::PERCY_CSS => 'iframe { display: none; }', // Percy specific CSS
    Snapshot::ENABLE_JAVASCRIPT => true // Enable/disable JavaScript
]);

Development

This module comes with ddev configuration to aid with local development. To setup the project do:

  1. Install ddev https://docs.ddev.com/en/stable/users/install/ddev-installation/
  2. Run ddev build
  3. Optionally run ddev test to run static analysis and Codeception test suites. Note, you'll need a Percy token set for the Codeception test suites to complete

This will composer install deps into a ddev environment. For more information about developing with ddev, see their official documentation

tr33m4n/codeception-module-percy 适用场景与选型建议

tr33m4n/codeception-module-percy 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 129.39k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2020 年 02 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 tr33m4n/codeception-module-percy 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 129.39k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-02-09