This project contains a comprehensive test automation suite for the SauceDemo website using Robot Framework with Browser (Playwright) Library.
saucedemo-robot-tests/
├── resources/
│ ├── common.resource # Common keywords and settings
│ ├── pages/ # Page object models
│ │ ├── login_page.resource
│ │ ├── inventory_page.resource
│ │ ├── cart_page.resource
│ │ └── checkout_page.resource
│ └── variables/ # Test data and variables
│ └── users.resource
├── tests/ # Test suites
│ ├── login_tests.robot
│ ├── inventory_tests.robot
│ ├── cart_tests.robot
│ └── checkout_tests.robot
└── results/ # Test reports (generated)
- Install Node.js dependencies:
npm install
- Initialize the Browser library:
npm run setup
Run all tests:
npm test
Run specific test suites:
npm run test:login
npm run test:inventory
npm run test:cart
npm run test:checkout
Run tests in parallel:
npm run test:parallel
Clean test results:
npm run clean
Test reports are generated in the results
directory after each test run. Open report.html
in a browser to view the test results.
- Page Object Model: Separates page elements and actions for better maintainability
- Common Keywords: Reusable keywords for common actions
- Data-driven Testing: Test data separation for easy maintenance
- Parallel Execution: Support for parallel test execution
- Detailed Reporting: Comprehensive test reports with screenshots on failures
- Cross-browser Testing: Ability to run tests across different browsers
You can modify the browser settings in resources/common.resource
:
*** Variables ***
${BROWSER} chromium # Change to 'firefox' or 'webkit' as needed
${HEADLESS} True # Set to False for visible browser
- Keep each test case focused on a single functionality
- Maintain test independence - each test should be able to run on its own
- Use descriptive names for test cases and keywords
- Add proper documentation for test cases and keywords
- Separate test data from test logic
- Take screenshots on test failures
- Implement proper waiting strategies