PHPackages                             coldfrontlabs/drupal-codeception - 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. coldfrontlabs/drupal-codeception

ActivePackage

coldfrontlabs/drupal-codeception
================================

Codeception toolset for Drupal testing.

9.0.2(5y ago)015.5k↓36.1%1[2 PRs](https://github.com/coldfrontlabs/drupal-codeception/pulls)1GPL-2.0PHP

Since Sep 24Pushed 7mo agoCompare

[ Source](https://github.com/coldfrontlabs/drupal-codeception)[ Packagist](https://packagist.org/packages/coldfrontlabs/drupal-codeception)[ RSS](/packages/coldfrontlabs-drupal-codeception/feed)WikiDiscussions 10.x Synced 1mo ago

READMEChangelog (2)Dependencies (6)Versions (33)Used By (1)

Drupal Codeception
==================

[](#drupal-codeception)

Overview
--------

[](#overview)

Sets of codeception modules and utilities to test drupal cms. Includes:

- Drupal Bootstrap
- Drupal Entity
- Drupal User
- Drupal Watchdog
- Drupal Drush
- Drupal Acceptance

Differences from guncha25/drupal-codeception
--------------------------------------------

[](#differences-from-guncha25drupal-codeception)

- Mostly added support for testing events and event subscribers.
- Otherwise pretty much exactly the same (major props to guncha25)

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

[](#installation)

Require package:

`composer require coldfrontlabs/drupal-codeception --dev`

If codeception was not previously set up:

`./vendor/bin/codecept bootstrap`

If you require only one suite for now (e.g. acceptance):

`./vendor/bin/codecept init acceptance`

Drupal Bootstrap
----------------

[](#drupal-bootstrap)

Provides full bootstrapping in to Drupal before test. Allows using drupal API in test cases.

### Configuration

[](#configuration)

- server: Server and execution environment information.
- root: Drupal root. Uses DrupalFinder to detect the Drupal root. Falls back to codeception root + `/web`. (optional)

```
modules:
    - DrupalBootstrap:
        server:
            SERVER_PORT: null
            REQUEST_URI: '/'
            REMOTE_ADDR: '127.0.0.1'
            HTTP_HOST: 'site.multi'

```

Drupal Drush
------------

[](#drupal-drush)

Provides drush (`runDrush`) command.

### Configuration

[](#configuration-1)

- working\_directory: Working directory where drush should be executed. Defaults to codeception root.
- timeout: Timeout in seconds for drush command. Set to 0 for no timeout. Default to 60 seconds.
- drush: Drush executable. Defaults to `drush`.

```
modules:
    - DrupalDrush:
        working_directory: './web'
        timeout: 120
        drush: './vendor/bin/drush'
          options:
            uri: http://mydomain.com
            root: /app/web

```

### Usage

[](#usage)

Run drush status and store output.

`$output = $i->runDrush('status');`

Run drush config import and store output from STDERR.

`$output = $i->runDrush('cim -y', [], TRUE)->getErrorOutput();`

Run drush cache rebuild and store the exit code.

`$exit_code = $i->runDrush('cr', [], TRUE)->getExitCode();`

Get one-time login url.

`$uri = $i->getLoginUri('userName');`

Drupal Entity
-------------

[](#drupal-entity)

Provides better interaction with drupal entities and test entity cleanup service.

### Configuration

[](#configuration-2)

- cleanup\_test: Indicator if test entities should be deleted after each test.
- cleanup\_failed: Indicator if test entities should be deleted after test fails.
- cleanup\_suite: Indicator if test entities should be deleted after suite.
- route\_entities: Entity list that can be retrieved by url.

```
modules:
    - DrupalEntity:
        cleanup_test: true
        cleanup_failed: false
        cleanup_suite: true
        route_entities:
            - node
            - taxonomy_term

```

### Usage

[](#usage-1)

Create entities.

`$node = $i->createEntity(['title => 'My node', 'type' => 'page']);`

`$term = $i->createEntity(['name => 'My term', 'vid' => 'tag'], 'taxonomy_term');`

Delete all stored test entities.

`$i->doEntityCleanup();`

Register test entity.

`$i->registerTestEntity('node', '99');`

Register test entity by url.

`$i->registerTestEntityByUrl($i->grabFromCurrentUrl());`

Get entity by url.

`$entity = $i->getEntityFromUrl($i->grabFromCurrentUrl());`

Drupal User
-----------

[](#drupal-user)

Provides better interaction with drupal user and test user setup and cleanup service.

### Configuration

[](#configuration-3)

- default\_role: Default user role if no specified. Defaults to 'authenticated'
- driver: Driver used for interacting with site. Defaults to WebDriver.
- drush: Drush executable. Defaults to `drush`.
- cleanup\_entities: Entities to delete when test user gets deleted.
- cleanup\_test: Indicator if test entities should be deleted after each test.
- cleanup\_failed: Indicator if test entities should be deleted after test fails.
- cleanup\_suite: Indicator if test entities should be deleted after suite.

```
modules:
    - DrupalUser:
        default_role: 'authenticated'
        driver: 'PhpBrowser'
        drush: './vendor/bin/drush'
        cleanup_entities:
            - media
            - file
        cleanup_test: true
        cleanup_failed: false
        cleanup_suite: true

```

### Usage

[](#usage-2)

Create test user with specified roles.

`$user = $i->createUserWithRoles(['editor', 'authenticated'], 'password');`

Log in user by username.

`$i->loginAs('userName');`

Create new user with certain role and login.

`$i->logInWithRole('administrator');`

Drupal Watchdog
---------------

[](#drupal-watchdog)

Provides log checking while testing.

### Configuration

[](#configuration-4)

- enabled: Wheather automatic check is enabled after suite. Defaults to `TRUE`
- level: Global log level that would produce fail. Defaults to 'ERROR'.
- channels: Individual log channel settings.

```
modules:
    - DrupalWatchdog:
        enabled: true
        level: 'ERROR'
        channels:
            my_module: 'NOTICE'
            php: 'WARNING'

```

### Usage

[](#usage-3)

Clean logs.

`$i->prepareLogWatch();`

Check logs.

`$i->checkLogs();`

Drupal Acceptance
-----------------

[](#drupal-acceptance)

Provides helper methods to interact with drupal via webdriver.

```
modules:
    - DrupalAcceptance:

```

### Usage

[](#usage-4)

```
// Fill title.
$i->fillTextField(FormField::title(), 'Mans nosukums');

// Select option from select list by key or value.
// For custom fields, target (last parameter) usually needs to be set to an
// empty string.
$i->selectOptionFromList(FormField::langcode(), 'en');
$i->selectOptionFromList(FormField::langcode(), 'English');
$i->selectOptionFromList(FormField::field_my_list(), 'Apple', '');

// Select the nth option from a select list.
$i->selectOptionFromList(FormField::langcode());
$i->selectNthOptionFromList(MTOFormField::field_my_list(), 2, '');

// Fill first paragraph of type text.
$page_elements = ParagraphFormField::field_page_elements();
$i->fillWysiwygEditor(FormField::field_text_formatted($page_elements), 'Lorem');

// Remove text paragraph.
$i->removeParagraph($page_elements);

// Add second paragraph of type graybox.
$i->addParagraph('graybox', $page_elements->next());

// Fill title of graybox.
$i->fillTextField(FormField::field_title($page_elements), 'Mans nosukums');

// Fill link field.
$i->fillLinkField(FormField::field_link($page_elements), 'http://example.com', 'Example');
$i->fillLinkField(FormField::field_link($page_elements), 'http://example.com');

// Add taxonomy term reference for tags field.
$field_tags = FormField::field_tags();
$i->fillReferenceField(FormField::field_tags(), Fixtures::get('term1'));
$i->addReferenceFieldItem($field_tags->next());
$i->fillReferenceField($field_tags, Fixtures::get('term2'));

$i->clickOn(FormField::submit());

```

Drupal Fields Utility
---------------------

[](#drupal-fields-utility)

Provides xpath builder object for drupal specific form field xpath retrieval.

Includes: - FormField: Fields that can be set to cardinality unlimited - MTOFormField: Single value fields. - ParagraphFormField: Paragraph form fields.

### Usage

[](#usage-5)

Create paragraph field with machine name field\_page\_elements.

`$page_elements = ParagraphFormField::field_page_elements();`

Get next paragraph.

`$page_elements->next();`

Fill title field value from field page elements.

`$i->fillField(FormField::title($page_elements)->value);`

Add new paragraph of type liftup\_element.

```
$i->click($page_elements->addMore('liftup_element'));
$i->waitForElementVisible($page_elements->getCurrent('Subform'));

```

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance44

Moderate activity, may be stable

Popularity26

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~82 days

Recently: every ~358 days

Total

28

Last Release

583d ago

Major Versions

8.0.16 → 9.0.02020-09-17

9.x-dev → 10.x-dev2024-10-12

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/6dae95ea3ea10a58c2638a4d60894d20f6d2a8a9259977cbb92c3c6216856d2a?d=identicon)[spotzero](/maintainers/spotzero)

---

Top Contributors

[![guncha25](https://avatars.githubusercontent.com/u/10857118?v=4)](https://github.com/guncha25 "guncha25 (56 commits)")[![minorOffense](https://avatars.githubusercontent.com/u/871728?v=4)](https://github.com/minorOffense "minorOffense (39 commits)")[![Rade333](https://avatars.githubusercontent.com/u/922901?v=4)](https://github.com/Rade333 "Rade333 (8 commits)")[![spotzero](https://avatars.githubusercontent.com/u/996913?v=4)](https://github.com/spotzero "spotzero (5 commits)")[![adubovskoy](https://avatars.githubusercontent.com/u/297623?v=4)](https://github.com/adubovskoy "adubovskoy (3 commits)")[![mgalang](https://avatars.githubusercontent.com/u/209939?v=4)](https://github.com/mgalang "mgalang (2 commits)")[![jaapjan](https://avatars.githubusercontent.com/u/2848293?v=4)](https://github.com/jaapjan "jaapjan (2 commits)")[![ragnarkurmwunder](https://avatars.githubusercontent.com/u/28702260?v=4)](https://github.com/ragnarkurmwunder "ragnarkurmwunder (1 commits)")

### Embed Badge

![Health badge](/badges/coldfrontlabs-drupal-codeception/health.svg)

```
[![Health](https://phpackages.com/badges/coldfrontlabs-drupal-codeception/health.svg)](https://phpackages.com/packages/coldfrontlabs-drupal-codeception)
```

###  Alternatives

[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)[guncha25/drupal-codeception

Codeception toolset for Drupal testing.

17131.1k2](/packages/guncha25-drupal-codeception)[joomla-projects/joomla-browser

joomla-browser Codeception Module

24311.0k](/packages/joomla-projects-joomla-browser)[oxid-esales/testing-library

OXID eShop testing library

13374.0k10](/packages/oxid-esales-testing-library)[docler-labs/codeception-slim-module

Codeception Module for Slim framework.

13178.0k1](/packages/docler-labs-codeception-slim-module)[voidagency/vactory_starter_kit

Vactory is a custom Drupal profile which is developed and released by VOID Agency.

1019.7k](/packages/voidagency-vactory-starter-kit)

PHPackages © 2026

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