Skip to content

A test automation framework for validating cross-browser and cross-device compatibility on LambdaTest using Selenium and Pytest

Notifications You must be signed in to change notification settings

infuse-consulting/LambdaTest-Compatibility-testing-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LambdaTest Compatibility and Cross-Browser Testing Framework

Overview

This project is a Selenium-based Python automation framework designed for cross-browser and cross-device testing using the LambdaTest platform.

It enables the execution of test scripts across a wide range of real and virtual devices.The framework follows Page Object Model (POM) design pattern, promoting reusability, maintainability.

Key Features

  • Excel-Driven Configurations
    • The framework extracts test environment details such as browser, platform, device name and test URL from a structured Excel file without modifying code.
  • Cross-Browser & Cross-Device Execution
    • Allows Cross-browser and cross-device testing on LambdaTest and Supports both real and virtual devices
  • Automated Reporting
    • Automatically generates an Excel report with Device/browser/OS info,Test execution status and LambdaTest video session link

Workflow

  • This diagram illustrates the complete workflow of the framework.

alt text

Project Structure

  • The project follows a modular folder structure with dedicated directories for configurations, test scripts, reports, and utilities, ensuring better maintainability and scalability.

alt text

Prerequisites

Create a LambdaTest Account & Get Credentials

  • Sign Up: Go to LambdaTest Sign Up and create a free account.
  • 💡 Note: Plan Selection: For real device testing, ensure your plan includes: Web Automation Testing → Web & Mobile Browser on Real Device
  • Get Your Credentials: Once logged in, open the side menu in the Dashboard.
  • Copy your Username and Access Key from the Credentials section to connect your tests to LambdaTest.

Installation

  1. Clone the repository
git clone https://github.com/infuse-consulting/LambdaTest-Compatibility-testing-framework.git
cd LambdaTest-Compatibility-testing-framework
  1. Install dependencies
 pip install -r requirements.txt 
  1. Set up LambdaTest credentials in project

Create a .env file in the root directory:

LT_USERNAME= your_lambdatest_username
LT_ACCESS_KEY= your_lambdatest_access_key

Set up virtual environment (recommended)

Windows (PowerShell)

python -m venv .venv
.venv\Scripts\Activate.ps1

Windows (Command Prompt)

python -m venv .venv
.venv\Scripts\activate.bat

macOS / Linux

python3 -m venv .venv
source .venv/bin/activate

Test Data Configuration

The file ./src/data/test_data.xlsx contains all configuration data for your test environment:

alt text

Devices Sheet: Defines cross-browser/device parameters: browser, browserVersion, platform, platformVersion, deviceName, etc.

💡 Note: Use the provided template.You may add new devices, but ensure column names remain unchanged.

💡 Note: To check which devices support which platform versions: use the LambdaTest Capabilities Generator.

Example:

alt text

Url Sheet: Stores the test URL for running tests.

Example:

alt text

Load Test Configurations

Example of generated Test configuration JSON object from excel file ./src/data/test_data.xlsx :

alt text

JSON Object:

  {
    "browser": "Chrome",
    "browserVersion": "138",
    "platformName": "android",
    "platformVersion": "14",
    "deviceName": "Galaxy S24 ",
    "isRealMobile": "False"
  }

Test Setup Fixtures

The conftest.py file contains reusable pytest fixtures for test setup.

  • dataLoad: Loads test data (username, access key, URL) from .env and Excel.
  • driver: Creates and configures a Selenium WebDriver session on LambdaTest.
  • setup: Returns pre-initialized LoginPage, Utils to use in tests.

Example usage in a test:

def test_login(setup):
    login_page, assertion, url = setup
    login_page.navigate_to_page(url)
    login_page.login()
    assertion.assert_page_is_displayed(login_page.products_catalog_page, "Products Catalog Page")

Running Tests

Run a test using pytest:

pytest .\tests\test_login.py -v -s 
  💡 Note: Test files should be placed inside the tests/ directory 
    Test function names must be prefixed with test_ for pytest to detect and execute them.

The framework will:

  • Execute the test across all environments defined in the Excel file.
  • Automatically generates a compatibility_test_report in reports/ folder in Excel format with:
    • Device, Browser,Platform details
    • Pass/Fail status
    • LambdaTest session video link

Example of ./reports/compatibility_test_report.xlsx:

alt text

💡 Note: Every execution appends Test Results to compatibility_test_report

About

A test automation framework for validating cross-browser and cross-device compatibility on LambdaTest using Selenium and Pytest

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages