Sap authentication
Skill mrkanitkar/praman-sap-testing/skills/sap-authentication
This skill should be used when implementing "SAP login", "IDP redirect chains", "SSO configuration", "certificate-based authentication", or "BTP SAML2/IAS" in Playwright tests. Covers basic form auth, Office 365 SSO, API keys, multi-tenant, and mTLS.From its SKILL.md
npx -y skills add mrkanitkar/praman-sap-testing --skill sap-authenticationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.7 KB, as published. Nobody here has run it
SAP Authentication
Select the authentication strategy based on the SAP landscape:
| Landscape | Strategy | Handler Config Key |
|---|---|---|
| SAP OnPrem | basic | username + password |
| BTP Cloud Foundry | btp-saml | IAS/SAML2 redirect |
| Azure AD SSO | office365 | OAuth2 code flow |
| API-only access | custom | API key / bearer |
| Certificate auth | custom | mTLS + client cert |
Auth Setup Pattern
Use Playwright project dependencies to run authentication once and share state across tests.
Configure playwright.config.ts with a setup project that depends on nothing and produces storageState. All test projects depend on this setup project.
Create auth-setup.ts using SAPAuthHandler:
- Import
test as setupfromplaywright-praman. - Instantiate
SAPAuthHandlerwithpageandpramanConfig.auth. - Call
handler.login()which auto-detects the login form and IDP redirects. - Persist session with
page.context().storageState({ path: '.auth/session.json' }).
Environment Variables
Store credentials in .env.test (gitignored, never committed):
SAP_CLOUD_BASE_URL-- system base URLSAP_CLOUD_USERNAME-- login usernameSAP_CLOUD_PASSWORD-- login passwordSAP_CLIENT-- SAP client number (optional)SAP_IDP_HOST-- custom IDP hostname (optional, for BTP SAML)
Load via dotenv or Playwright's built-in env config.
Multi-Tenant and BTP Subaccounts
For multi-tenant BTP apps, set the tenant subdomain in SAP_CLOUD_BASE_URL. The auth handler follows the IAS redirect chain automatically. Pass tenant in auth config for explicit tenant selection.
Session Reuse
Store storageState at .auth/session.json. Playwright reuses cookies and local storage across tests in the same project, eliminating redundant logins. Regenerate on CI by running the setup project before test projects.
Raw Seed Auth (CLI Agents)
When Praman fixtures are unavailable (e.g., playwright-cli browser context during exploration), use raw Playwright auth. Detect the login form by checking for known input selectors and IAS hostnames, fill credentials via CLI commands, and wait for sap.ui.getCore to confirm UI5 loaded. See examples/raw-seed-auth.ts.
Refer to examples/ for complete auth setup patterns per strategy.