Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

This module exposes Drush commands via a POST endpoint, allowing them to be triggered by automated testing tools like Cypress. It's designed for use cases where Drush cannot be run directly within the testing environment, such as when tests run in a separate container from the web server.

Exposes drush commands so that they can be called with POST.

To be used in automated testing (ie Cypress) when you can't run drush commands, for example when your testing suite runs on a different container than your web server.

Usage

In your Cypress test do a POST request:

cy.request({
  method: 'POST',  // Make sure this is POST
  url: '/api/drush/cron'
});


You can also use cURL from command line for testing:

curl -X POST https://SITENAME.ddev.site/api/drush/cron



Login to a site in a Cypress test

describe('I can login using Drush', () => {
  it('Logs me in', () => {
    // Login
    cy.request({
      method: 'POST',
      url: '/api/drush/uli',
    }).then((response) => {
      expect(response.status).to.eq(200);
      expect(response.body).to.have.property('success', true);

      const uli = response.body.output.trim();

      cy.visit(uli);
      // You are logged in!
    })
  })
})

Requirements

It is assumed that you have a complete understanding of what you are enabling on your site!

There are precautions that make it difficult to run this modules on production, but they will not save you if you intentionally enable it there. So be very careful.

Installation

  • Install as you would normally install a contributed Drupal module. See: https://www.drupal.org/node/895232 for further information.
  • There are no permissions, this is a module oriented to automated testing only. Everything is allowed by default.
  • Allow the module to run, by enabling it in your settings.local.php file:
    // Enable drush_endpoint
    $settings['drush_endpoint_enabled'] = TRUE;
    $settings['drush_endpoint_allow_uli'] = TRUE;
    

NOTE

As you see above, uli commands need that extra line to be enabled.

WARNING

Do not put the above lines in production!

Maintainers

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Jan 2025
Latest release
2 months ago
Releases (12 mo)
1
Maintenance
Active

Releases

Version Type Core Release date
1.0.0-rc1 Pre-release 10–11 Jun 13, 2026
1.0.x-dev Dev 10–11 Jan 22, 2025