定制 etsy/pigeon-webkit 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

etsy/pigeon-webkit

最新稳定版本:0.1.5

Composer 安装命令:

composer require etsy/pigeon-webkit

包简介

README 文档

README

Functional testing tool for PHP built on top of capybara-webkit

Build Status

Installation

The following instructions outline installation using Composer. If you don't have Composer, you can download it from https://getcomposer.org/

$ gem install capybara-webkit -v "1.8.0"

or

$ sudo gem install capybara-webkit -v "1.8.0"
  • Run the following command:
$ php composer.phar global require etsy/pigeon-webkit:dev-master

How it works

capybara-webkit provides a headless web browser (built on QT Webkit). When the browser starts, it opens up a port to accept commands. Pigeon Webkit starts the browser, opens a TCP connection to that port and sends commands to the browser to "drive" it and run assertions.

FunctionalPigeon is extending CapybaraWebkitDriver, which is an implementation of Behat Mink's [DriverInterface] (https://github.com/minkphp/Mink/blob/master/src/Behat/Mink/Driver/DriverInterface.php). As a result, most of the methods defined by the interface are available. The ones that are not implemented throw an UnsupportedException.

The css to xpath translation is handled by [the Symfony CssSelector component] (http://symfony.com/doc/current/components/css_selector.html)

Usage

$pigeon = new PigeonWebkit\FunctionalPigeon();
$pigeon->visit("https://etsy.com");
print_r($pigeon->body()); // HTML content of etsy.com
$pigeon->click("a#sign-in"); // opens the sign in modal
// ...etc

By default, Pigeon Webkit accepts css selectors. But it also has a xpath mode.

$pigeon->setXPathMode(true);
$pigeon->visit("https://etsy.com");
$pigeon->click("//a[@id='sign-in']");

Example usage with the [kahlan] (https://github.com/crysalead/kahlan) testing framework

<?php
 
use PigeonWebkit\FunctionalPigeon;
 
describe("Visiting a URL", function() {
  before(function() {
    $this->p = new FunctionalPigeon();
  });
  
  it("loads the page", function() {
    $this->p->visit("https://etsy.com");
    expect($this->p->body())->toContain("Shop directly from people around the world.");
  });
});

For more examples, take a look at the specs for FunctionalPigeon and its base class, CapybaraWebkiDriver.

Some of the available methods

  reset
  visit
  getCurrentUrl
  reload
  forward
  back
  setRequestHeader
  getResponseHeaders
  setCookie
  getCookie
  getStatusCode
  getContent
  find
  getTagName
  getText
  getHtml
  getOuterHtml
  getAttribute
  getValue
  setValue
  check
  uncheck
  isChecked
  selectOption
  isSelected
  submitForm
  click
  isVisible
  executeScript
  evaluateScript
  getScreenshot

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-11-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固