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

https://github.com/salhifayza/jbl_robot_framework_python

๐ŸŽง ๐Ÿค– ๐Ÿ
https://github.com/salhifayza/jbl_robot_framework_python

automated-testing python3 robotframework

Last synced: 3 months ago
JSON representation

๐ŸŽง ๐Ÿค– ๐Ÿ

Awesome Lists containing this project

README

          

## ๐ŸŽง ๐Ÿค– ๐Ÿ ๐Ÿ’ป โ˜•
## JBL Headset Automation Testing

This project automates testing for a JBL Bluetooth headset using **Python** and **Robot Framework**. It verifies Bluetooth connectivity, plays a YouTube video, and controls system volume dynamically to simulate real-world usage.

---

## ๐Ÿš€ Features

- โœ… Check if the headset is connected via Bluetooth
- ๐Ÿ“บ Play a YouTube video automatically
- ๐Ÿ”Š Dynamically increase the system volume step-by-step
- ๐Ÿ“‰ Read and validate current volume level
- ๐Ÿ“„ Generate test reports (HTML/XML)

---

## ๐Ÿงฉ Project Structure

![alt text](image.png)
---

## โš™๏ธ Requirements

- Python 3.8+
- Robot Framework
- Playwright
- PulseAudio (for volume control, Linux only)
- A Bluetooth headset (JBL or any compatible)

---

## ๐Ÿ“ฆ Installation

1. **Clone the repo**
```bash
git clone https://github.com/SalhiFayza/JBL_Robot_FrameWork_Python.git
cd JBL_Robot_FrameWork_Python
```

2. **Install dependencies**
```bash
pip install -r requirements.txt
playwright install
```

3. **Turn on and connect your Bluetooth headset (e.g., JBL)**
![alt text](image-2.png)
4. **Update your JBL MAC address**
Open the file ```resources/variables.robot``` and replace the default MAC address with your headset's:
```
${MAC} 37:2B:54:9C:75:C4
```
---

## โ–ถ๏ธ Running the Tests

You can run the tests in two ways:

### 1. Using Python runner:

```bash
python run_tests.py
```

### 2. Using Robot Framework directly:

```bash
robot jbl.robot
or
robot -d ./Results/ ./tests/jbl.robot
```
![alt text](img1.png)
Test results will be available in:

- `output.xml` โ€“ test execution log
- `log.html` โ€“ detailed log with steps
- `report.html` โ€“ summary report

---

## ๐Ÿงช Example Test Case

- Check if headset is connected
- Open YouTube
- Simulate increasing volume from 0% to 100%
- Log the current volume
- Fail if volume is not detected

---
## ๐Ÿฅ‡ Volume Control Logic โ€“ Explained
```
current_volume = 0
set_volume(current_volume)
time.sleep(3)

while current_volume < 100:
current_volume += 10
set_volume(min(current_volume, 100))
time.sleep(4)

time.sleep(3)
browser.close()
```
This code starts by setting the system volume to 0%, then gradually increases it by 10% every 4 seconds until it reaches 100%. It uses small delays to simulate natural volume changes while a YouTube video plays, then closes the browser at the end.

---

## ๐Ÿ’ก Notes

- Works best on Linux (uses `pactl` and `bluetoothctl`)
- You must pair your headset before running tests
- The test will open a Chromium browser window (Playwright)

---

## ๐Ÿ“ฌ Contact

Made by Salhi Fayza
---

## ๐Ÿ“„ License

MIT License โ€“ Free to use and modify