Thank you for your interest in contributing to the Microsoft Test Demo project! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Setup
- Making Changes
- Testing Guidelines
- Submitting Changes
- Style Guidelines
This project follows a code of conduct that all contributors are expected to uphold. Please be respectful, inclusive, and considerate in all interactions.
- Fork the repository to your GitHub account
- Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/Microsoft-Test-Demo-01.git cd Microsoft-Test-Demo-01 - Add upstream remote:
git remote add upstream https://github.com/bg-playground/Microsoft-Test-Demo-01.git
- Node.js 18 or higher
- npm (comes with Node.js)
- Git
-
Install dependencies:
npm install
-
Install Playwright browsers:
npx playwright install
-
Verify installation:
npm test
Use descriptive branch names with prefixes:
feature/- New features (e.g.,feature/add-dark-mode)fix/- Bug fixes (e.g.,fix/task-deletion-bug)docs/- Documentation updates (e.g.,docs/update-readme)test/- Test additions or modifications (e.g.,test/add-accessibility-tests)
-
Create a new branch:
git checkout -b feature/your-feature-name
-
Make your changes following our style guidelines
-
Test your changes:
npm test -
Commit your changes:
git add . git commit -m "Add descriptive commit message"
-
Push to your fork:
git push origin feature/your-feature-name
# Run all tests
npm test
# Run tests in headed mode (see browser)
npm run test:headed
# View test report
npm run test:reportWhen adding or modifying visual regression tests:
- Run locally first:
npm run test:visual:update - Review screenshots: Check
tests/visual.spec.js-snapshots/directory - Commit baselines:
git add tests/**/*-snapshots/ - CI will use these baselines: Future test runs will compare against committed screenshots
Visual tests are automatically skipped in CI until baselines exist.
When adding new tests, follow these guidelines:
- Test File Location: Place test files in the
/testsdirectory - Test File Naming: Use
.spec.jsextension (e.g.,feature-name.spec.js) - Test Structure: Follow the AAA pattern (Arrange, Act, Assert)
Example test structure:
const { test, expect } = require('@playwright/test');
test.describe('Feature Name', () => {
test('should do something specific', async ({ page }) => {
// Arrange - Set up test conditions
await page.goto('https://example.com');
// Act - Perform the action
await page.click('#button');
// Assert - Verify the outcome
await expect(page.locator('#result')).toHaveText('Expected text');
});
});- ✅ Write clear, descriptive test names
- ✅ Test one thing per test case
- ✅ Use proper selectors (prefer role, label, or text over CSS selectors)
- ✅ Add appropriate waits (avoid
waitForTimeout) - ✅ Include accessibility tests where applicable
- ❌ Don't test external sites (test the sample app instead)
- ❌ Don't hardcode sensitive data
- ❌ Don't create interdependent tests
- Update documentation if your changes require it
- Ensure all tests pass
- Update the README.md if you're adding new features
- Create a Pull Request with a clear title and description
Use conventional commit format:
feat: Add new feature descriptionfix: Fix bug descriptiondocs: Update documentationtest: Add or update testsrefactor: Refactor codestyle: Format or style changes
## Description
Brief description of changes
## Type of Change
- [ ] New feature
- [ ] Bug fix
- [ ] Documentation update
- [ ] Performance improvement
- [ ] Refactoring
## Testing
- [ ] All existing tests pass
- [ ] New tests added for new functionality
- [ ] Manual testing completed
## Screenshots (if applicable)
Add screenshots for UI changes
## Checklist
- [ ] Code follows project style guidelines
- [ ] Self-review completed
- [ ] Comments added for complex code
- [ ] Documentation updated
- [ ] No new warnings generated- Use ES6+ features (const/let, arrow functions, destructuring)
- Follow Airbnb style guide principles
- Use meaningful variable names
- Add comments for complex logic only
- Keep functions small and focused
Example:
// Good
const addTask = (taskText) => {
if (!taskText.trim()) {
return null;
}
return createTaskObject(taskText);
};
// Avoid
function a(t) {
if (!t.trim()) return null;
return createTaskObject(t);
}- Use semantic HTML elements
- Include proper ARIA attributes
- Add alt text for images
- Use meaningful IDs and classes
- Use CSS variables for colors and common values
- Follow BEM naming convention for classes
- Mobile-first responsive design
- Add comments for complex styles
- Use clear, concise language
- Include code examples where helpful
- Keep markdown formatted consistently
- Update table of contents when adding sections
When reporting bugs, include:
- Steps to reproduce
- Expected behavior
- Actual behavior
- Screenshots (if applicable)
- Browser/environment information
When requesting features:
- Describe the feature clearly
- Explain the use case
- Provide examples if possible
- Consider implementation complexity
Documentation improvements are always welcome:
- Fix typos or grammar
- Add examples
- Improve clarity
- Add missing information
If you have questions:
- Check existing issues and discussions
- Review the documentation
- Open a new issue with the "question" label
Contributors will be recognized in:
- Project README (once changes are merged)
- Release notes
- GitHub contributors page
Thank you for contributing to Microsoft Test Demo! 🎉