task: #3631526 Follow the Vardot module standard: docs, templates and the Varbase E2E suite
Part of #3631526.
Depends on !6 (merged). This branch is built on 3631526-settings, so the diff includes !6 (merged)'s commits until it merges. Review the last commit (task: #3631526 Follow the Vardot module standard: docs, templates and the Varbase E2E suite).
Brings AI Media in line with what the Vardot AI modules share (checked against AI Agent Modes, AI Image Crop and AI Figma; AI Agent Modes is the model):
.gitlab/issue_templates/default.mdand.gitlab/merge_request_templates/default.md, copied from AI Agent Modes (Vardot Checkpoints).docs/+mkdocs.yml(Material theme,site_urlhttps://project.pages.drupalcode.org/ai_media/), nav like AI Agent Modes: Home; Using (generating media in the Media Library); Administering (media types and generators, settings, providers, permissions); Developing (writing a generator plugin); Help (troubleshooting).mkdocs build --strictpasses. Pages are published the way AI Agent Modes publishes them: by the drupal/gitlab_templatespagesjob, which runs on a push to the default branch whenmkdocs.ymlordocs/change. No extra CI job.- README in the AI Agent Modes outline: Documentation link, Why, How it works, Requirements, Usage, plus source and maintainers.
ai_media.info.yml: package AI, a one-line comment on why each dependency (and the core floor) is needed,configure: ai_media.settings.- No update hooks. Comments kept to one short line.
.cspell.jsonreplaces.cspell-project-words.txt(the template's cspell job uses a project.cspell.jsonwhen there is one, and AI Agent Modes and AI Figma ship one)..eslintignoreand.gitignoreas in AI Agent Modes.- No AGENTS.md or CLAUDE.md: only AI Figma ships a CLAUDE.md, the other two ship neither, so it is not the common standard.
Varbase E2E suite
Set up like AI Agent Modes, at the module root: package.json (@vardot/varbase-e2e ^2.0.4), cucumber.js, cucumber.shared.js, playwright.config.ts, tests/selectors (Claro, Gin, ai_media.json), tests/step-definitions/ai_media.steps.js, tests/features/drupal/, tests/README.md. Based on the suite written for this module on a Varbase site, adapted to plain Drupal: Article's Media field instead of Varbase's featured image, standard roles plus a "Media author" role without the AI permission, selectors for the current markup, and the settings page.
tests/recipes/ai_media_test: the AI image, SVG and document media types, the Article Media field (Image first), editor permissions, and the AI module's Echo test provider for chat and for AI Media's text-to-image choice. The default lane therefore generates images and documents with no key and no credit.- Paid scenarios (real image, SVG and document generation) are tagged
@ai-credits: excluded from the default tags and skipped by aBeforehook unlessAI_MEDIA_SPEND_CREDITS=yes(npm run test:credits). - CI, as in AI Agent Modes:
eslint (step definitions)andfunctional-testing (Drupal core), which builds a fresh standard Drupal site with this module through a path repository, enables test-module discovery for Echo, applies the recipe and runsnpm test.
CI is green, the e2e job included and blocking (allow_failure: false): pipeline 1006821, functional-testing (Drupal core) 35 scenarios / 642 steps passed in Chromium on a fresh site. The fixtures recipe applies core's article_content_type, content_editor_role and image_media_type recipes, since the CI site had no Article.
Testing
Against aimtheme1 (Drupal 11.4.10, AI 1.5.1, Echo), Firefox headless, wide screen:
-
Free lane (
npm test, Firefox): 35 scenarios, 642 steps, all passed (users, install and settings page with an axe AA audit, media types, access control, the form, Echo image and document generation with Generate again and Save, each settings scenario). The 3@ai-creditsfeatures were not run. -
phpcs (Drupal, DrupalPractice, including md and yml): 0 errors (line-length warnings on Markdown tables only). eslint on the step definitions: clean. cspell with the new
.cspell.json: 0 issues.mkdocs build --strict: clean.
Remaining tasks
-
@ai-creditsscenarios NOT RUN (they spend provider credit). - Mobile widths not tested (out of scope for this pass).
AI-Generated: Yes. Written with Claude Code (Claude Opus 5.5) under the Drupal AI policy; tested and reviewed by the author before submission.
Checkpoints:
- File an issue
- Addition/Change/Update/Fix
- Testing to ensure no regression
- Automated unit testing coverage
- Automated functional testing coverage
- UX/UI designer responsibilities
- Readability
- Accessibility
- Performance
- Security
- Developer Documentation
- User Guide Documentation
- Reviewed by human
- Code review by maintainers
- Full testing and approval
- Credit contributors
- Review with the product owner
- Release notes snippet
- Release