[email protected] |
---|
playwright-ts-cli
is a powerful command-line tool designed to initialize and update projects with the Playwright TypeScript template. It simplifies the process of setting up a new project with specific configurations, dependencies, and structure, allowing developers to kickstart their Playwright testing with ease.
- Initialize Project: Quickly scaffold a new project with predefined Playwright TypeScript configurations, dependencies, and structure.
- Update Project: Seamlessly update existing projects with the latest files and configurations from the Playwright TypeScript template.
- Compatibility: Works with the vasu-playwright-utils library, offering additional utilities and functionalities.
Ensure you have the following software installed on your machine:
- npm (v8.0.0 or later): Package manager for JavaScript, used to install and manage software packages.
- To verify your current version, use the command
npm -v
. - If npm isn't installed, follow the npm installation guide.
- To verify your current version, use the command
- Node.js (v16.0.0 or later): JavaScript runtime built on Chrome's V8 JavaScript engine, allowing the execution of JavaScript server-side.
- To verify your current version, use the command
node -v
.
- To verify your current version, use the command
- Git: Distributed version control system used to track changes in source code during software development.
- To check if Git is installed, run the command
git --version
. - If Git isn't installed, download and install it from the official Git website.
- To check if Git is installed, run the command
Before installing the CLI, make sure to have Node.js installed on your system. Here are two ways to install Node.js:
-
Using Official Website:
- Visit the official Node.js website.
- Download and install the latest stable version.
-
Using Command Line (nvm):
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash source ~/.nvm/nvm.sh nvm install --lts
mkdir playwright-e2e-tests
cd playwright-e2e-tests
npm i -D vasu-playwright-cli
Navigate to the desired directory and run:
npx vasu-playwright-cli init
This command will set up a new project with ready to use Playwright TypeScript framework, including:
- Setup the Playwright TypeScript framework template with sample tests.
- Create a new
package.json
file with all the necessary dependencies. - Initializing a new Git repository if neither the current nor parent directory is a Git repository.
- Installing all the npm packages including the playwright utils library which contains playwright helper methods.
Navigate to the project directory and run:
npx vasu-playwright-cli update
This command will update specific files or directories within the project, aligning them with the latest updates to the Playwright TypeScript template.
Keep your Playwright library up to date with the latest playwright utilities which contain the helper methods that are updated regularly:
npm i -D vasu-playwright-utils@latest
To make sure the project framework is working as expected, you can run the following command to run the sample tests:
npm run test:chromium-headed -- sauce-demo-all-pass.spec.ts
View the report with:
npx playwright show-report
If you encounter any issues or have feedback, please Raise an Issue on GitHub.
We welcome contributions! Feel free to submit a Pull Request on GitHub.
This project is licensed under the MIT License. See the LICENSE file for details.