An open API service indexing awesome lists of open source software.

https://github.com/creativechai12/snipeit-automation-tests

A Playwright + .NET automation framework for SnipeIT, built using NUnit and Page Object Model architecture. Includes screenshot capture, reusable page objects, structured test data, and HTML reporting with ReportGenerator. Designed for scalability, readability, and real‑world UI test automation.
https://github.com/creativechai12/snipeit-automation-tests

automation dotnet nunit playwright testing

Last synced: 2 months ago
JSON representation

A Playwright + .NET automation framework for SnipeIT, built using NUnit and Page Object Model architecture. Includes screenshot capture, reusable page objects, structured test data, and HTML reporting with ReportGenerator. Designed for scalability, readability, and real‑world UI test automation.

Awesome Lists containing this project

README

          

**SnipeIT Automation Framework**
This repository contains a robust UI automation framework for SnipeIT using Playwright for .NET, NUnit, and a clean Page Object Model (POM) architecture.

**Features**

- ✅ Playwright browser automation (Chromium)
- ✅ NUnit test execution with ordered flows
- ✅ Page Object Model for maintainability
- ✅ Screenshot capture on failure (saved to TestData/Screenshots)
- ✅ Asset persistence via AssetStore
- ✅ Clean folder structure for scalability
- ✅ HTML report generation via ReportGenerator

**Folder Structure**

SnipeIT.Automation.Tests/
├── Helpers/ # Reusable helper classes
│ ├── captureScreenshot.cs
│ ├── selectStatusHelper.cs

├── Models/ # Data models
│ ├── AssetData.cs

├── Pages/ # Page Object classes
│ ├── AssetDetailsPage.cs
│ ├── AssetListPage.cs
│ ├── AssetPage.cs
│ ├── CreateAssetPage.cs
│ ├── LoginPage.cs

├── Storage/ # Asset persistence
│ ├── AssetStore.cs

├── TestData/ # Test inputs and screenshots
│ ├── Screenshots/

├── TestReport/ # HTML report output

├── Tests/ # NUnit test classes
│ ├── CreateAssetTest.cs
│ ├── ValidateAssetTest.cs

├── SnipeIT.Automation.Tests.csproj
├── Automation.sln
├── TestResult.xml # NUnit test result file

**Running Tests**
Run all tests ::
dotnet test --logger:"nunit;LogFilePath=TestResult.xml"

**Run a specific test**
dotnet test --filter "FullyQualifiedName~CreateAssetTest"

**Screenshot Capture**
Screenshots are automatically captured on test failure and saved to:
TestData/Screenshots/

Each file includes a timestamp and test name:
CreateAssetTest_20251223_001200.png

These are attached to the NUnit XML and embedded in the HTML report.

**📊 HTML Report Generation**
Install the global tool (once):
dotnet tool install -g dotnet-reportgenerator-globaltool

**Generate the report:**
reportgenerator -reports:TestResult.xml -targetdir:TestReport -reporttypes:Html

**Open the report:**
start .\TestReport\index.html

**Page Object Model**
Each page is represented by a class in Pages/:

- LoginPage → login actions
- CreateAssetPage → asset creation
- AssetListPage → search and table interactions
- AssetDetailsPage → details and history validation

**Asset Persistence**
The last created asset is stored in:
Storage/AssetStore.cs

This allows validation tests to access the same asset created earlier.

**Cleanup and Teardown**
Each test includes a [TearDown] method that:

- Captures a screenshot on failure
- Closes the browser
- Disposes Playwright

**Dependencies**
- .NET SDK
- Playwright for .NET
- NUnit
- ReportGenerator