A comprehensive end-to-end testing framework built with Playwright for testing web applications, specifically designed for Insomnia API client testing.
- Fast and Reliable: Built on Playwright for fast, reliable end-to-end testing
- Multi-browser Support: Test across Chromium, Firefox, and WebKit
- Rich Reporting: HTML, JSON, and JUnit test reports
- Parallel Execution: Run tests in parallel for faster execution
- Auto-retry: Automatic retry for failed tests
- Visual Debugging: Screenshots and video recordings on failure
- Trace Viewer: Detailed test traces for debugging
- Page Object Model: Clean, maintainable test structure
- GitHub Actions Integration: Automated CI/CD with email notifications
- Use Page Object Model: Organize page interactions into reusable classes
- Write Descriptive Tests: Use clear test names and descriptions
- Use Data Attributes: Prefer
data-testid
over CSS selectors - Handle Async Operations: Always await page operations
- Add Meaningful Assertions: Test behavior, not implementation
- Group Related Tests: Use test.describe for organizing tests
- Use Tags: Categorize tests with @smoke, @regression, etc.
Register and Login functionality can be designed from multiple dimensions for test cases. This framework currently implements partial core functionality:
-
UI Interaction Testing:
- ✅ Login button visibility and clickability
- ✅ Form field validation and error messages
- ✅ Page navigation and redirect functionality
- ✅ Responsive design and cross-browser compatibility
-
Functional Flow Testing:
- ✅ Login form submission
- ✅ OAuth redirect validation
- ❌ Actual authentication flow (limited by security restrictions)
- ❌ Login state persistence
- ❌ Logout functionality
-
Security Testing:
- ❌ Password strength validation
- ❌ CSRF token validation
- ❌ Session management
-
Boundary Condition Testing:
- ❌ Invalid credentials handling
- ❌ Network exception handling
- ❌ Concurrent login restrictions
- ❌ Account lockout mechanisms
-
Integration Testing:
- ❌ Backend API integration
- ❌ Database state validation
- ❌ Third-party service integration
This framework focuses on UI-level automated testing, primarily validating:
- Page elements render correctly
- User interactions respond normally
- Navigation flows meet expectations
- Redirect functionality works properly
Due to OAuth security mechanisms and third-party service limitations, complete end-to-end authentication testing cannot be implemented.
-
GitHub Login:
- Only validates redirection to respective login interfaces
- Cannot perform actual authentication due to OAuth limitations and security restrictions
- Tests focus on UI navigation and redirect functionality
-
Google Login:
- Validates redirection to Google OAuth interface
- Cannot perform actual Google authentication due to OAuth 2.0 security restrictions
- Tests focus on UI navigation and redirect functionality
- Google's OAuth flow requires user interaction and cannot be fully automated
- Limited to verifying the login button redirects to correct Google OAuth URL
-
SSO Login:
- Demo implementation with simplified test cases
- Limited to basic SSO flow demonstration
- Not comprehensive for all SSO provider scenarios
-
Email Verification:
- Cannot test actual email verification due to third-party CAPTCHA and email verification code requirements
- Limited to UI interaction testing without real email delivery validation
- Human verification steps cannot be automated
- Node.js (version 22 or higher)
- npm or yarn package manager
- Git
-
Clone the repository
git clone [email protected]:Hellen-Zhu/insomnia-e2e-test.git cd insomnia-e2e-test
-
Install dependencies
npm install
-
Install Playwright browsers
npx playwright install
insomnia-e2e-test/
├── .github/workflows/ # GitHub Actions workflows
│ └── playwright.yml # CI/CD configuration
├── pages/ # Page Object Models
│ ├── BasePage.js # Base page class with common methods
│ ├── AuthPage.js # Authentication page
│ ├── GitHubLoginPage.js # GitHub login page
│ ├── GoogleLoginPage.js # Google login page
│ ├── SSOLoginPage.js # SSO login page
│ ├── EmailVerificationPage.js # Email verification page
│ └── index.js # Page classes export
├── tests/ # Test files
│ ├── e2e/ # End-to-end tests
│ ├── fixtures/ # Test fixtures and data
│ └── utils/ # Test utilities and helpers
├── playwright.config.js # Playwright configuration
├── package.json # Project dependencies and scripts
└── README.md # This file
# Run all tests
npm test
# Run tests in UI mode (interactive)
npm run test:ui
# Run tests in specific browser
npm run test:chromium
npm run test:firefox
npm run test:webkit
# Run tests by category
npm run test:smoke
npm run test:regression
# Run tests with specific options
npm run test:workers # Single worker (serial execution)
npm run test:retries # 3 retries for failed tests
npm run test:parallel # 4 workers (parallel execution)
# Run specific test
npx playwright test example.spec.js
# Generate test code interactively
npm run test:codegen
# Generate test code for specific URL
npx playwright codegen https://playwright.dev
After running tests, you can view reports:
# Open HTML report
npm run test:report
# View test results
npx playwright show-report test-results/
const { test, expect } = require('@playwright/test');
test('basic test', async ({ page }) => {
await page.goto('https://playwright.dev/');
const title = await page.title();
expect(title).toContain('Playwright');
});
The project includes GitHub Actions workflow that:
- Triggers on: Push to main, Pull requests, Daily schedule, Manual dispatch
- Tests on: Chromium and Firefox browsers
- Uploads: Test reports and screenshots as artifacts
- Sends: Email notifications for test results
You can manually trigger the workflow:
- Go to Actions tab in your repository
- Select "Playwright Tests" workflow
- Click "Re-run all jobs"