PHPackages                             drevops/behat-relativity - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. drevops/behat-relativity

AbandonedArchivedLibrary[Testing &amp; Quality](/categories/testing)

drevops/behat-relativity
========================

Behat context for relative elements testing.

0.4.0(3y ago)51.3k1[1 issues](https://github.com/drevops/behat-relativity/issues)[1 PRs](https://github.com/drevops/behat-relativity/pulls)GPL-2.0-or-laterPHP

Since Jun 27Pushed 3y ago3 watchersCompare

[ Source](https://github.com/drevops/behat-relativity)[ Packagist](https://packagist.org/packages/drevops/behat-relativity)[ RSS](/packages/drevops-behat-relativity/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (12)Versions (13)Used By (0)

behat-relativity
================

[](#behat-relativity)

Behat context for relative elements testing

[![CircleCI](https://camo.githubusercontent.com/be0dd0d7feafe28ec5a98ff08fe7d4b375c09f35627bdda0cfaeb173062a415e/68747470733a2f2f636972636c6563692e636f6d2f67682f647265766f70732f62656861742d72656c617469766974792e7376673f7374796c653d736869656c64)](https://circleci.com/gh/drevops/behat-relativity)[![Latest Stable Version](https://camo.githubusercontent.com/b14c680c60418f9a7c9999903ded6648ce17b04669731c6d150d559e0ab91b32/68747470733a2f2f706f7365722e707567782e6f72672f647265766f70732f62656861742d72656c617469766974792f762f737461626c65)](https://packagist.org/packages/drevops/behat-relativity)[![Total Downloads](https://camo.githubusercontent.com/7afff965492450479f338d29bca9fb77620888fdf97e89863d18b0e6589d2c58/68747470733a2f2f706f7365722e707567782e6f72672f647265766f70732f62656861742d72656c617469766974792f646f776e6c6f616473)](https://packagist.org/packages/drevops/behat-relativity)[![License](https://camo.githubusercontent.com/be62ad4c243b777a67d6d46c9962e5cc87e57f688aea074ac51dfd15a1982fc3/68747470733a2f2f706f7365722e707567782e6f72672f647265766f70732f62656861742d72656c617469766974792f6c6963656e7365)](https://packagist.org/packages/drevops/behat-relativity)

What is this?
-------------

[](#what-is-this)

This extension allows to test visual elements positioning on the page relatively to each other. Such tests are dead-simple to write, but they can capture potential issues when developing features on existing project.

Example feature to test elements on the [www.google.com](http://www.google.com)

```
Feature: Google example test

  Show how Behat Relativity can be used to test pages using google.com as an example.

  Background:
    Given I define components:
      | top navigation    | #gb                     |
      | logo              | #hplogo                 |
      | search            | #lst-ib                 |
      | search button     | .jsb input[name="btnK"] |
      | lucky button      | .jsb input[name="btnI"] |
      | bottom navigation | .fbar                   |

  @javascript
  Scenario: Anonymous user visits google.com
    Given I am on "https://www.google.com"
    Then I see top navigation above logo, search, search button, lucky button and bottom navigation
    And I see logo above search, search button, lucky button and bottom navigation
    And I see search above search button, lucky button and bottom navigation
    And I see search button and lucky button above bottom navigation
    And I see search button to the left of lucky button
```

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

[](#installation)

`composer require --dev drevops/behat-relativity`

usage
-----

[](#usage)

Example `behat.yml`:

```
default:
  suites:
    default:
      contexts:
        - DrevOps\BehatRelativityExtension\Context\RelativityContext
        - FeatureContext

  extensions:
    DrevOps\BehatRelativityExtension:
      breakpoints:
        mobile:
          width: 320
          height: 480
        tablet:
          width: 768
          height: 1024
        desktop:
          width: 992
          height: 1024
          default: true
        desktop_large:
          width: 1200
          height: 900
      # Vertical offset - document will be scrolled to the element with this offset.
      # Useful when fixed elements may cover part of pages making it impossible to click on components.
      offset: 60
      # List of site-wide components.
      components:
        'page': "#page"
        'main': "#main"
        'top': "#top"
        'bottom': "#bottom"
```

Maintenance
-----------

[](#maintenance)

### Local development setup

[](#local-development-setup)

1. Install Docker.
2. If using M1: `cp default.docker-compose.override.yml docker-compose.override.yml`
3. Start environment: `docker-compose up -d --build`.
4. Install dependencies: `docker-compose exec phpserver composer install --ansi --no-suggest`.

### Lint code

[](#lint-code)

```
docker-compose exec phpserver vendor/bin/phpcs
```

### Run tests

[](#run-tests)

```
docker-compose exec phpserver vendor/bin/behat
```

### Enable Xdebug

[](#enable-xdebug)

```
XDEBUG_ENABLE=true docker-compose up -d phpserver
```

To disable, run

```
docker-compose up -d phpserver
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 92.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~260 days

Recently: every ~495 days

Total

9

Last Release

1158d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b57b0fd0b96f77f2efa1a1889af0ae607fa139bcc1256e809ee3ebbb30907364?d=identicon)[alexdrevops](/maintainers/alexdrevops)

---

Top Contributors

[![AlexSkrypnyk](https://avatars.githubusercontent.com/u/378794?v=4)](https://github.com/AlexSkrypnyk "AlexSkrypnyk (26 commits)")[![bladeaweb](https://avatars.githubusercontent.com/u/14051753?v=4)](https://github.com/bladeaweb "bladeaweb (2 commits)")

---

Tags

behatbehat-contextbehat-extensionphptest

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/drevops-behat-relativity/health.svg)

```
[![Health](https://phpackages.com/badges/drevops-behat-relativity/health.svg)](https://phpackages.com/packages/drevops-behat-relativity)
```

###  Alternatives

[drupal/drupal-extension

Drupal extension for Behat

22215.1M147](/packages/drupal-drupal-extension)[drevops/behat-steps

Collection of steps for Behat

25381.7k3](/packages/drevops-behat-steps)[devinci/devinci-behat-extension

Provides extra behat goodies.

17593.9k](/packages/devinci-devinci-behat-extension)[guikingone/panther-extension

Panther extension for Mink

232.0k](/packages/guikingone-panther-extension)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
