Skip to content

enableedge/playwright-dotnet-enableedge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Playwright + .NET Automation Test Framework

A comprehensive test automation framework for web application testing using C#/.NET, NUnit, and Playwright🎭.

License GitHub issues

Description

A comprehensive test automation framework for web application testing using C#/.NET, NUnit, and Playwright. This framework implements Page Object Model (POM) pattern and supports both UI and API testing.

Getting Started

Prerequisites

  • .NET 7.0 or higher
  • Visual Studio 2022 or higher
  • Allure Report Generator

Installation

  1. Clone the repository:
git clone <repository-url>
  1. Install dependencies:
dotnet restore
  1. Install Allure CLI:

    Install Allure on Windows

    Install Allure on macOS

Running the Tests

UI Tests

dotnet test --filter "Category=UI"

API Tests

dotnet test --filter "Category=API"

Generate Allure Report

allure serve Results/Allure

###Project Structure:

AutomationFramework/
├── AutomationFramework.Tests/
│   ├── Pages/
│   │   ├── HomePage.cs
│   │   ├── LoginPage.cs
│   │   ├── SignupPage.cs
│   │   └── ProductsPage.cs
│   ├── Tests/
BaseTest.cs
│   │   ├── LoginTests.cs
│   │   └── SignupTests.cs
│   ├── ApiTests/
│   │   ├── ApiTestBase.cs
│   │   └── ProductApiTests.cs
│   ├── Configuration/
│   │   └── TestConfig.cs
│   ├── appsettings.json
│   └── AutomationFramework.Tests.csproj
│   ├── utils/
│       └── TestDataGenerator.cs
├── run-tests.ps1
└── README.md

Key Features Implemented:

Page Object Model (POM):

  • Created page classes for all required pages
  • Each page class contains its own elements and methods
  • BasePage class provides common functionality

Test Cases:

  • UI Tests:

    • Login functionality tests
    • Signup functionality tests
  • API Tests:

    • Product list API tests
    • Product category API tests
    • Product search API tests

Configuration:

  • Test settings in appsettings.json
  • TestConfig class for configuration management
  • Browser settings, timeouts, and credentials

Reporting:

  • Allure report integration
  • Test results stored in Results/Allure directory

Best Practices:

  • Clean architecture with separation of concerns
  • Parallel test execution support
  • Proper error handling and assertions
  • Configuration-driven testing
    • Code coverage collection

To run the tests, you can use the PowerShell script:

.\run-tests.ps1

Built With

  • C#/.NET
  • NUnit
  • Playwright
  • Allure Report

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Playwright sample repo for UI + API automation [Playwright + .NET + Allure]

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors