π Create Testla Screenplay - CLI tool for quickly creating Testla Screenplay projects with Playwright π
This package provides an initializer to interactively and automatically set up new Testla Screenplay projects with Playwright.
You can create a new Testla Screenplay project using one of the following commands:
# In the current directory (recommended: create an empty directory first)
npm init @testla/screenplay
npx @testla/create-screenplay
yarn create @testla/screenplay
pnpm create @testla/screenplay
The tool uses the current directory name as the project name and sets up the project structure there.
Example:
mkdir my-tests
cd my-tests
npm init @testla/screenplay
# Project name is "my-tests"
-
Interactive configuration (prompts):
- Name of the test directory (default:
tests
) - Base URL of the application under test
- Browser (chromium, firefox, webkit)
- Headless mode (default: true)
- Reporter (testla-reporter, html, junit, json, list, dot)
- Name of the test directory (default:
-
Project structure is created:
<project-directory>/ βββ <tests>/ # Test files (e.g. example.spec.ts) βββ screenplay/ β βββ tasks/ # Example task β βββ actions/ # (empty) β βββ questions/ # (empty) β βββ screens/ # Example screen βββ fixtures/ # Test actor βββ playwright.config.ts # Playwright configuration βββ .env # Environment variables βββ .gitignore # Git ignore βββ README.md # Project documentation (generated) βββ package.json
-
Dependencies are installed:
@playwright/test
@testla/screenplay-playwright
dotenv
@types/node
(dev)
-
Configuration and example files are generated:
- Playwright configuration (
playwright.config.ts
) .env
file with your settings- Example test, demo task, demo screen, fixtures
- Project-specific README (replaces this file in the target project)
- Playwright configuration (
-
package.json is updated:
- Script:
test
βnpx playwright test
- Script:
- π οΈ Interactive setup with sensible defaults
- π Automatic folder structure following the Screenplay pattern
- π Ready to use with example code and configuration
- π Multi-browser support (Chromium, Firefox, WebKit)
- π Generates a README for the new project
β Success! Created a Testla Screenplay project at /path/to/project
We suggest that you begin by typing:
npm test
Runs the end-to-end tests.
And check out the following files:
- ./<tests>/example.spec.ts - Example test
- ./fixtures/user.ts - Definition of the Actor
- ./screenplay/tasks/demo-task.ts - Example task
- ./screenplay/screens/demo-screen.ts - Example screen
- ./playwright.config.ts - Playwright configuration
- ./.env - Environment variables
β¨ More info: https://github.com/testla-project/testla-screenplay-playwright-js/tree/main/docs β¨
π Discord: https://discord.gg/MDRjCH3v π
Happy hacking! π
- Node.js 18.0.0 or higher
- npm, yarn, or pnpm
MIT