Package Exports
- sdk_automation
- sdk_automation/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sdk_automation) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
SDK Automation
SDK Automation is a public npm package created for the QA Portfolio demo project.
It provides utilities, services, and helpers for automated testing, logging, data handling, and test data generation.
๐ Installation
Install via npm:
npm install sdk_automation๐ก Quick Start
import { logger, UserService } from 'sdk_automation';
// Logging example
logger.log('Hello from SDK Automation!');
// Working with UserService
const userService = new UserService();
const users = await userService.getAllUsers();
console.log(users);๐ Package Structure
- utils/ โ general utilities like logger, test data generator, and assets tracker
- services/ โ services for database interaction and business logic
- constants/ โ selectors, URLs, and other constants
- interfaces/ โ TypeScript interfaces and types
- config/ โ environment configuration
โจ Features
- Logger โ simple logger with color output
- UserService โ service for user-related operations
- MongoService โ MongoDB connection and data operations
- TestDataGenerator โ generate random test data
- AssetsTracker โ track changes in project resources
๐งช Example Usage with Playwright
import { logger, testDataGenerator } from 'sdk_automation';
import { test } from '@playwright/test';
test('example test', async ({ page }) => {
logger.log('Starting test');
const testUser = testDataGenerator.generateUser();
await page.fill('#username', testUser.username);
await page.fill('#password', testUser.password);
logger.log('Test completed successfully');
});โ๏ธ CI/CD Workflows
This project has two GitHub Actions workflows to ensure code quality and automate package publishing:
1๏ธโฃ Pull Request Workflow (ci-pr.yml)
- Trigger:
on: pull_requesttargetingmainbranch - Purpose: run full CI for every PR before merge
- Jobs:
- Checkout repository
- Setup Node.js
- Install dependencies (
npm ci) - TypeScript type check (
npx tsc --noEmit) - Lint code (
npm run lint) - Run unit tests (
npm test) - Audit dependencies (
npm audit --audit-level=moderate)
โ ๏ธ This workflow does not publish the package, it only ensures PRs are safe and code quality is maintained.
2๏ธโฃ Publish Workflow (publish.yml)
- Trigger:
on: pushtomainbranch - Purpose: build and publish the SDK package to npm
- Jobs:
- Checkout repository
- Setup Node.js with npm registry
- Cache node modules
- Install dependencies (
npm ci) - TypeScript type check (
npx tsc --noEmit) - Lint code (
npm run lint) - Run tests (
npm test) - Audit dependencies (
npm audit) - Build package (
npm run build) - Publish to npm (
npm publish --access public) usingNODE_AUTH_TOKENfrom GitHub Secrets
โ ๏ธ This workflow ensures that only code merged to main and passing all checks gets published.
๐ Documentation
Full documentation for each utility and service can be found in the dist folder or by exploring the TypeScript types.
๐ฌ Contributing
This package is maintained for the QA Portfolio demo project.
Found a bug or have a feature request? Open an issue or submit a pull request.