drupal-functionaljs-test

drupal-functionaljs-test is a skill for Claude Code from trebormc/drupal-ai-agents. It costs 161 tokens per session (2,140 once invoked), scanned A, original, Apache-2.0.

A Drupal browser test that runs JavaScript in a real Chrome browser through WebDriver, the tool that connects tests to browsers.

In plain words
What is it for?
Use it for Drupal features whose behavior depends on JavaScript and verify the result through page text or visible elements rather than HTTP status codes.
Why use it?
It checks behavior that ordinary code tests cannot, such as AJAX, autocomplete fields, modals, drag-and-drop, and dynamic visibility, while making clear that these tests are slower.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is ssh web ./vendor/bin/phpunit $DDEV_DOCROOT/modules/custom/MODULE/tests/src/FunctionalJavascript.

Good fit Use it for Drupal features whose behavior depends on JavaScript and verify the result through page text or visible elements rather than HTTP status codes.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/trebormc/drupal-ai-agents
agentmods
npx agentmods add skills/trebormc/drupal-ai-agents/drupal-functionaljs-test

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for drupal-functionaljs-test

README.md
[![agentmods](https://agentmods.dev/badge/skills/trebormc/drupal-ai-agents/drupal-functionaljs-test/github.svg)](https://agentmods.dev/skills/trebormc/drupal-ai-agents/drupal-functionaljs-test)
Your own site
<a href="https://agentmods.dev/skills/trebormc/drupal-ai-agents/drupal-functionaljs-test"><img src="https://agentmods.dev/badge/skills/trebormc/drupal-ai-agents/drupal-functionaljs-test/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for drupal-functionaljs-test

Your own site · 80×15
<a href="https://agentmods.dev/skills/trebormc/drupal-ai-agents/drupal-functionaljs-test"><img src="https://agentmods.dev/badge/skills/trebormc/drupal-ai-agents/drupal-functionaljs-test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 161 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,140 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00161 $0.02140
Opus 5.5 $0.00064 $0.00856
Sonnet 5.5 $0.00032 $0.00428
Haiku 4.5 $0.00016 $0.00214

Measured 1mo ago against content hash 24ca75fde1f4, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

drupal-functionaljs-test scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/drupal-functionaljs-test/SKILL.md · 261 lines

How it starts

The opening of the file, as written. The whole thing — 261 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Drupal FunctionalJavascript Test

What It Is

Extends BrowserTestBase but uses a real Chrome browser via WebDriver. JavaScript executes completely. AJAX works. CSS animations are disabled.

Speed: 10-170 seconds per class. Use ONLY when there is no alternative.

Critical Difference from BrowserTestBase

statusCodeEquals() does NOT work in WebDriverTestBase. The Selenium2 driver does not have access to HTTP status codes. Verify access with pageTextContains() or elementExists().

Base Template

<?php
declare(strict_types=1);

namespace Drupal\Tests\MODULE\FunctionalJavascript;

use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\user\UserInterface;

/**
 * Tests DESCRIPTION.
 *
 * @group MODULE
 */
class NameTest extends WebDriverTestBase {

  protected $defaultTheme = 'stark';
  protected static $modules = ['node', 'MODULE'];

  protected UserInterface $adminUser;

  protected function setUp(): void {
    parent::setUp();
    $this->adminUser = $this->drupalCreateUser(['access content', 'administer MODULE']);
  }

  public function testAjaxInteraction(): void {
    $this->drupalLogin($this->adminUser);
    $this->drupalGet('route');

    $page = $this->getSession()->getPage();
    $assert = $this->assertSession();

    $page->selectFieldOption('field', 'value');
    $assert->assertWaitOnAjaxRequest();

    $element = $assert->waitForElementVisible('css', '.result');
    $this->assertNotEmpty($element);
  }

}

GOLDEN RULE: Never sleep(), Always Waits

The #1 cause of flaky tests. NEVER sleep(). ALWAYS use waits:

$assert = $this->assertSession();

// Wait for AJAX (most used)
$assert->assertWaitOnAjaxRequest();

// Wait for element in DOM
$element = $assert->waitForElement('css', '.my-element');
$this->assertNotEmpty($element);

// Wait for VISIBLE element
$element = $assert->waitForElementVisible('css', '.dropdown');

// Wait for element to disappear
$assert->waitForElementRemoved('css', '.spinner');

// Specific waits
$assert->waitForButton('Submit');
$assert->waitForLink('Next');
$assert->waitForField('field_name');
$assert->waitForId('my-id');
$assert->waitForText('Done');

// Autocomplete
$assert->waitOnAutocomplete();

// Custom JS condition
$this->getSession()->wait(5000, 'jQuery("#el").is(":visible")');

Read the full file on GitHub · 261 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 261 lines · 161 tokens per session scan A 24ca75fde1f4

Subscribe to this mod's changes

drupal-functionaljs-test is a skill published in the GitHub repository trebormc/drupal-ai-agents (11 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 161 tokens to every session and 2,140 once invoked, about $0.0006 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

browse

Drive a real browser through Aside: open a page, read it, click through a flow, take screenshots, check console errors. (gstack).

garrytan/gstack · 32 tokens

cua-driver

Use Cua Driver for desktop or browser tasks that are awkward or unavailable through Bash/APIs, or when the user explicitly wants GUI interaction: app testing, visual bug reproduction, form filling, calendar entry, screenshots, and demo recording. Also covers Cua setup; not OpenAI Codex Computer Use or web research.

davidondrej/skills · 68 tokens

create-verification-skill

Create a repo-local verification skill and exhaustive feature map for driving a real app through its UI, CLI, or API. Use for "create a verification skill", "make a verify skill for this repo", or "document how agents can verify this app".

get-bb/bb · 57 tokens

browser-qa

A browser-based quality check for deployed web pages and user flows. It uses browser automation to test rendering, navigation, forms, interactions, responsive behaviour, and accessibility-related issues.

hashgraph-online/awesome-codex-plugins · 58 tokens

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

anthropics/skills · 35 tokens

test-electron-app

Drive the real running PostHog Electron app (live tRPC, workspace-server, real data) over CDP with agent-browser. Connect to the running app on port 9222, test desktop changes against a local Django stack, snapshot the accessibility tree, inspect network requests, and screenshot only when explicitly asked. Use when…

PostHog/posthog-foss · 112 tokens