Thank you for your interest in contributing to Sapphire! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Setup
- How to Contribute
- Coding Standards
- Testing Guidelines
- Pull Request Process
- Release Process
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code.
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/sapphire.git cd sapphire - Add upstream remote:
git remote add upstream https://github.com/kavyasoni/sapphire.git
- Java 17 or higher (LTS version recommended)
- Maven 3.8+ (or use the provided Maven wrapper)
- Git for version control
- Appium Server (for integration tests)
- Android SDK and/or Xcode (for platform-specific tests)
# Build the project
./mvnw clean install
# Build without tests
./mvnw clean install -DskipTests
# Run tests only
./mvnw test
# Run specific test
./mvnw test -Dtest=YourTestClass- Import as Maven project
- Enable annotation processing (Settings → Build → Compiler → Annotation Processors)
- Install Lombok plugin
- Code style: Settings → Editor → Code Style → Import
checkstyle.xml
- Import as Maven project
- Install Lombok
- Install Checkstyle plugin
- Check existing issues first
- Use the bug report template
- Include:
- Clear description
- Steps to reproduce
- Expected vs actual behavior
- Environment details (OS, Java version, Appium version)
- Logs and screenshots
- Check existing feature requests
- Use the feature request template
- Explain the use case and benefits
- Provide examples if possible
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes:
- Write clean, readable code
- Follow coding standards
- Add tests for new functionality
- Update documentation
-
Commit your changes:
git add . git commit -m "Add: descriptive commit message"
Commit message format:
Add: new featureFix: bug descriptionUpdate: improvement descriptionRefactor: code improvementDocs: documentation updateTest: test addition/update
-
Keep your fork updated:
git fetch upstream git rebase upstream/main
-
Push to your fork:
git push origin feature/your-feature-name
-
Create a Pull Request on GitHub
- Formatting: Follow Google Java Style Guide
- Indentation: 4 spaces (no tabs)
- Line length: 120 characters max
- Naming conventions:
- Classes:
PascalCase - Methods:
camelCase - Constants:
UPPER_SNAKE_CASE - Packages:
lowercase
- Classes:
- Checkstyle: Code must pass Checkstyle checks
- SpotBugs: No high-priority bugs
- PMD: No critical violations
- Test Coverage: Maintain >80% coverage for new code
- Use meaningful variable and method names
- Keep methods small and focused (< 50 lines)
- Add JavaDoc for public APIs
- Use SLF4J for logging (not System.out)
- Handle exceptions appropriately
- Use try-with-resources for AutoCloseable
- Prefer composition over inheritance
- Use Optional for nullable returns
- Use Java 17 features appropriately
/**
* Finds an element by its label text.
*
* @param label the text label to search for
* @param timeout maximum wait time in seconds
* @return the found element
* @throws ElementNotFoundException if element is not found
*/
public WebElement findByLabel(String label, int timeout) {
logger.debug("Finding element with label: {}", label);
return waitFor(timeout)
.until(driver -> {
By locator = buildLabelLocator(label);
return driver.findElement(locator);
});
}src/test/java
├── unit/ # Unit tests (fast, no external dependencies)
├── integration/ # Integration tests (with Appium)
└── e2e/ # End-to-end tests
- Unit Tests: Use JUnit 5 and Mockito
- Integration Tests: Use TestNG with Appium
- Test Naming:
shouldDoSomethingWhenCondition() - Assertions: Use AssertJ for fluent assertions
@Test
public void shouldFindElementByLabel() {
// Given
String label = "Submit";
// When
WebElement element = inspector.findByLabel(label);
// Then
assertThat(element).isNotNull();
assertThat(element.getText()).isEqualTo(label);
}# All tests
./mvnw test
# Unit tests only
./mvnw test -Dgroups=unit
# Integration tests
./mvnw test -Dgroups=integration
# With specific platform
./mvnw test -Dplatform=android
# With coverage
./mvnw test jacoco:report- Code builds successfully
- All tests pass
- Code follows style guidelines
- New tests added for new features
- Documentation updated
- Commit messages are clear
- No merge conflicts with main
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
How has this been tested?
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Comments added for complex code
- [ ] Documentation updated
- [ ] Tests added/updated
- [ ] All tests pass- Automated checks must pass (CI/CD)
- At least one maintainer approval required
- Address review comments
- Maintainer will merge when approved
Releases are managed by maintainers:
- Version bump in
pom.xml - Update
CHANGELOG.md - Create release tag
- Build and publish artifacts
- Create GitHub release with notes
- Questions: Open a GitHub Discussion
- Bugs: Create an issue with bug template
- Features: Create an issue with feature template
- Chat: Join our community (if available)
Contributors will be recognized in:
- Release notes
- README.md contributors section
- GitHub contributors page
Thank you for contributing to Sapphire!