Installation
This guide will walk you through installing and setting up Playwright-SAP for your project.
Installation Methods​
You can install Playwright-SAP using your preferred JavaScript package manager. The installation process will either initialize a new project or add Playwright-SAP to your existing project.
- npm
- yarn
- pnpm
npm init playwright-sap@latest
yarn create playwright-sap
pnpm create playwright-sap
Installation Options​
During installation, you'll be prompted to configure your project with the following options:
Option | Description | Default |
---|---|---|
Language | Choose between TypeScript or JavaScript | TypeScript |
Tests Folder | Directory where test files will be stored | tests (or e2e if tests already exists) |
GitHub Actions | Add workflow for CI integration | Yes |
Install Browsers | Download browsers required for testing | Yes |
Understanding Package Aliasing​
Playwright-SAP uses a technique called package aliasing to seamlessly integrate with the standard Playwright API. This means:
- You'll import from
@playwright/test
in your code (the standard Playwright import) - Behind the scenes, npm redirects this to the Playwright-SAP package
- This allows Playwright-SAP to extend Playwright without changing your imports
Your package.json
will contain an entry like this:
"devDependencies": {
"@playwright/test": "npm:@playwright-sap/test@^1.0.2",
"@types/node": "^24.2.0"
}
The npm:@playwright-sap/test@^1.0.2
syntax tells npm to use the @playwright-sap/test
package whenever code imports from @playwright/test
.
Read more about package aliasing
Getting Help​
If you encounter issues during installation:
- Check the FAQs for common problems and solutions
- Open an issue on GitHub
Next Steps​
After installation, you're ready to:
- Configure automatic SAP login for your tests
- Learn about specialized SAP locators
- Create your first test script