Skip to content

testla-project/create-testla-screenplay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎭 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.

Usage

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"

What happens when you run it?

  1. 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)
  2. 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
    
  3. Dependencies are installed:

    • @playwright/test
    • @testla/screenplay-playwright
    • dotenv
    • @types/node (dev)
  4. 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)
  5. package.json is updated:

    • Script: test β†’ npx playwright test

Features

  • πŸ› οΈ 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

Example output after successful setup

βœ” 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! 🎭

Requirements

  • Node.js 18.0.0 or higher
  • npm, yarn, or pnpm

Links

License

MIT

About

🎭 Create Testla Screenplay - CLI tool for quickly creating Testla Screenplay projects 🎭

Resources

Stars

Watchers

Forks