Skip to content

Commit

Permalink
Revamp the library for v2.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
pamil committed Dec 2, 2020
1 parent 9c3ecc0 commit 389df78
Show file tree
Hide file tree
Showing 16 changed files with 167 additions and 361 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build

on:
push: ~
pull_request: ~
release:
types: [created]
schedule:
-
cron: "0 1 * * 6" # Run at 1am every Saturday

jobs:
tests:
runs-on: ubuntu-latest

name: "PHP ${{ matrix.php }}"

strategy:
fail-fast: false
matrix:
php: [8.0, 7.4, 7.3, 7.2]

steps:
-
uses: actions/checkout@v2

-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
coverage: none

-
name: Run Chrome Headless
run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 &

-
name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

-
name: Cache Composer
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php }}-composer-
-
name: Install PHP dependencies
run: composer install --no-interaction

-
name: Validate composer.json
run: composer validate --ansi --strict

-
name: Run Behat
run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress
73 changes: 0 additions & 73 deletions .travis.yml

This file was deleted.

12 changes: 9 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
CHANGELOG
=========
# CHANGELOG

### v1.0
### v2.0.0

* Added support for PHP 8.0
* Allowed taking screenshots with more drivers than just Selenium2Driver
* Removed supplementary `upload-textfiles`, `upload-screenshots`, `wait-for-port` binaries
* Renamed extension from `Lakion\Behat\MinkDebugExtension` to `FriendsOfBehat\MinkDebugExtension`

### v1.0.0

* Initial release.
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2016-2020 Lakion
2020-2021 Kamil Kokot

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
65 changes: 7 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,100 +1,49 @@
MinkDebugExtension
==================

[![License](https://img.shields.io/packagist/l/lakion/mink-debug-extension.svg)](https://packagist.org/packages/lakion/mink-debug-extension)
[![Version](https://img.shields.io/packagist/v/lakion/mink-debug-extension.svg)](https://packagist.org/packages/lakion/mink-debug-extension)
[![Total Downloads](https://img.shields.io/packagist/dt/lakion/mink-debug-extension.svg)](https://packagist.org/packages/lakion/mink-debug-extension)
[![Build status...](https://img.shields.io/travis/Lakion/MinkDebugExtension/master.svg)](http://travis-ci.org/Lakion/MinkDebugExtension)
[![Scrutinizer Quality Score](https://img.shields.io/scrutinizer/g/Lakion/MinkDebugExtension.svg)](https://scrutinizer-ci.com/g/Lakion/MinkDebugExtension/)

**MinkDebugExtension** is a Behat extension made for debugging and logging Mink related data after every failed step.
It is especially useful while running tests on continuous integration server like Travis.
While using Selenium2 driver, you can also save screenshots just after the failure.

Moreover, it comes bundled with some useful scripts, that will make uploading logs and screenshots extremely easy.
While using appropriate driver, you can also save screenshots just after the failure.

Installation
------------

Assuming you already have Composer:

```bash
composer require lakion/mink-debug-extension
composer require friends-of-behat/mink-debug-extension
```

Then you only need to configure your Behat profile:

```yml
default:
extensions:
Lakion\Behat\MinkDebugExtension:
FriendsOfBehat\MinkDebugExtension:
directory: directory-where-to-save-logs
```
Configuration reference
-----------------------
Under `Lakion\Behat\MinkDebugExtension` there are three options to be configured:
Under `FriendsOfBehat\MinkDebugExtension` there are three options to be configured:

- `directory` (required to enable extension) - contains path to directory that will contain generated logs. Use the variable `%paths.base%` to refer to the directory where your `behat.yml` is
- `screenshot` (default `false`) - whether to save screenshots if using `Selenium2Driver`
- `screenshot` (default `false`) - whether to save screenshots if using supporting driver
- `clean_start` (default `true`) - whether to clean your existing logs on each Behat execution

Scripts
-------

MinkDebugExtension comes with three tiny, but powerful scripts. They will be installed to your [`config.bin-dir` directory](https://getcomposer.org/doc/articles/vendor-binaries.md#can-vendor-binaries-be-installed-somewhere-other-than-vendor-bin-),
which is `vendor/bin` by default.

#### Uploading textfiles

`vendor/bin/upload-textfiles "<glob_path>"` - uploades file contents to [termbin.com](http://termbin.com) and returns a list of file names and urls to uploaded content.

Glob paths must be quoted to work correctly. Usage:

```bash
$ vendor/bin/upload-textfiles "logs/*.log"
$ vendor/bin/upload-textfiles README.md
```

#### Uploading screenshots

`vendor/bin/upload-screenshots "<glob_path>"` - uploades images to [imgur.com](http://imgur.com) and returns a list of file names and theirs urls.

Glob paths must be quoted to work correctly. Requires Imgur API key to be set as environmental variable `$IMGUR_API_KEY`. Usage:

```bash
$ export IMGUR_API_KEY="imgur api key"
$ vendor/bin/upload-screenshots "logs/*.png"
$ vendor/bin/upload-screenshots favicon.ico
```

#### Waiting for port to be taken

`vendor/bin/wait-for-port <port> [limit = 15] [interval = 1]` - waits for service to appear at localhost at a given port, useful while waiting for Selenium or webserver to warm up.

Limit is the number of tries, interval is the delay in seconds between another tries. Usage:

```bash
$ java -jar selenium.jar &
$ vendor/bin/wait-for-port 4444
```

Testing
-------

In order to test the extensions run:

```bash
composer install
bin/phpspec run
bin/behat --strict
```

Authors
-------

MinkDebugExtension was originally created by [Kamil Kokot](http://kamil.kokot.me).
See the list of [contributors](https://github.com/Lakion/MinkDebugExtension/contributors).
MinkDebugExtension was originally created by [Kamil Kokot](https://kamilkokot.com).
See the list of [contributors](https://github.com/FriendsOfBehat/MinkDebugExtension/contributors).
44 changes: 21 additions & 23 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
{
"name": "lakion/mink-debug-extension",
"name": "friends-of-behat/mink-debug-extension",
"type": "behat-extension",
"description": "Debug extension for Behat",
"keywords": ["debug", "behat", "mink", "logging"],
"homepage": "https://github.com/Lakion/MinkDebugExtension",
"keywords": [
"debug",
"behat",
"mink",
"logging"
],
"homepage": "https://github.com/FriendsOfBehat/MinkDebugExtension",
"license": "MIT",
"authors": [
{
"name": "Kamil Kokot",
"email": "[email protected]",
"homepage": "http://kamil.kokot.me"
"homepage": "https://kamilkokot.com"
}
],
"require": {
"php": "^7.2",
"behat/behat": "^3.0.5",
"behat/mink-extension": "^2.0.1"
"php": "^7.2 || ^8.0",
"behat/behat": "^3.5",
"behat/mink-extension": "^2.3"
},
"require-dev": {
"phpspec/phpspec": "^2.0",
"behat/mink-goutte-driver": "^1.1",
"behat/mink-selenium2-driver": "^1.2"
},
"suggest": {
"behat/mink-browserkit-driver": "To get request debug information included in log file",
"behat/mink-selenium2-driver": "To get screenshots"
"behat/mink-goutte-driver": "^1.2",
"behat/mink-selenium2-driver": "^1.4",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"phpspec/phpspec": "^7.0",
"symfony/process": "^4.4 || ^5.2"
},
"bin": [
"travis/tools/upload-screenshots",
"travis/tools/upload-textfiles",
"travis/tools/wait-for-port"
],
"autoload": {
"psr-4": { "Lakion\\Behat\\MinkDebugExtension\\": "src/" }
},
"autoload-dev": {
"psr-4": { "Lakion\\Behat\\MinkDebugExtension\\spec\\": "spec/" }
"psr-4": {
"FriendsOfBehat\\MinkDebugExtension\\": "src/"
}
}
}
Loading

0 comments on commit 389df78

Please sign in to comment.