diff --git a/samples/testing-frameworks/desktop-browsers/client-side/python/README.md b/samples/testing-frameworks/desktop-browsers/client-side/python/README.md index 2f8cfab6..2a7dda93 100644 --- a/samples/testing-frameworks/desktop-browsers/client-side/python/README.md +++ b/samples/testing-frameworks/desktop-browsers/client-side/python/README.md @@ -7,6 +7,7 @@ Files ===== * `bitbar_selenium.py` contains the sample unittest that opens the BitBar sample page, verifies the result text, and saves screenshots locally. +* `Requirements.txt` contains the required Python package versions for this sample. * `screenshots/` is created when the test runs and stores the captured images. Prerequisites @@ -19,25 +20,19 @@ Prerequisites Setup ===== -Install Selenium with one of the following options: +Install dependencies from `Requirements.txt`: ```bash -python3 -m pip install selenium +python3 -m pip install -r Requirements.txt ``` -If your Python installation is managed by Homebrew and blocks global installs, use either a virtual environment or the explicit override: +If your Python installation is managed by Homebrew and blocks global installs, use: ```bash -python3 -m venv .venv -source .venv/bin/activate -python3 -m pip install selenium +python3 -m pip install --break-system-packages --user -r Requirements.txt ``` -or - -```bash -python3 -m pip install --break-system-packages selenium -``` +For this sample to run without any code changes, use the package versions defined in `Requirements.txt`. Then set your BitBar API key in the test capabilities in `bitbar_selenium.py`. @@ -67,4 +62,7 @@ Troubleshooting * `ModuleNotFoundError: No module named 'selenium'` means Selenium is not installed for the Python interpreter you used to launch the test. * `SessionNotCreatedException: Full authentication is required to access this resource` usually means the BitBar API key is missing, invalid, or expired. +* `TypeError: WebDriver.__init__() got an unexpected keyword argument 'desired_capabilities'` means incompatible package versions are installed. Reinstall dependencies from `Requirements.txt`. +* `ValueError: Timeout value connect was ` usually means `urllib3` is too new for this sample. Reinstall dependencies from `Requirements.txt`. +* `DeprecationWarning` messages from Selenium 3 internals can appear with newer Python versions and are non-blocking. * The sample saves screenshots into the local `screenshots` folder in the current working directory. \ No newline at end of file diff --git a/samples/testing-frameworks/desktop-browsers/client-side/python/Requirements.txt b/samples/testing-frameworks/desktop-browsers/client-side/python/Requirements.txt new file mode 100644 index 00000000..d06c3510 --- /dev/null +++ b/samples/testing-frameworks/desktop-browsers/client-side/python/Requirements.txt @@ -0,0 +1,2 @@ +selenium==3.141.0 +urllib3<2 diff --git a/samples/testing-frameworks/desktop-browsers/client-side/ruby/README.md b/samples/testing-frameworks/desktop-browsers/client-side/ruby/README.md new file mode 100644 index 00000000..7e2b7afb --- /dev/null +++ b/samples/testing-frameworks/desktop-browsers/client-side/ruby/README.md @@ -0,0 +1,35 @@ +# Ruby Selenium Sample + +This folder contains a Ruby Selenium example script: + +- `bitbar_selenium.rb` + +## Prerequisites + +- Ruby installed +- Gems installed (from this folder): + +```bash +bundle install +``` + +## Run + +From the repository root: + +```bash +ruby samples/testing-frameworks/desktop-browsers/client-side/ruby/bitbar_selenium.rb +``` + +Or from this folder: + +```bash +ruby bitbar_selenium.rb +``` + +## Expected Output + +When successful, the script prints page title text similar to: + +- Bitbar - Test Page for Samples +- Bitbar diff --git a/samples/testing-frameworks/selenium/client-side/CSharp/SeleniumCSharpSample/SeleniumCsharpSample/README.md b/samples/testing-frameworks/selenium/client-side/CSharp/SeleniumCSharpSample/SeleniumCsharpSample/README.md new file mode 100644 index 00000000..63d99927 --- /dev/null +++ b/samples/testing-frameworks/selenium/client-side/CSharp/SeleniumCSharpSample/SeleniumCsharpSample/README.md @@ -0,0 +1,59 @@ +# BitBar Selenium C# Sample + +This folder contains a C# NUnit Selenium sample + +## Prerequisites + +- .NET SDK installed (current project targets `net10.0`/`net7.0`) +- A valid BitBar API key + + +## Files + +- `UnitTest1.cs`: Main sample test +- `BitbarSeleniumSampleCSharp.csproj`: Project file and dependencies + +## Run the test + +From this folder: + +```bash +dotnet test BitbarSeleniumSampleCSharp.csproj +``` + +## Configure BitBar + +Update capabilities in `UnitTest1.cs` as needed: + +- platformName +- browserVersion +- bitbar:options (project, testrun, apiKey, osVersion, resolution) + + +## Corner Cases / Troubleshooting + +- SDK version mismatch (`NETSDK1045`): + If your local SDK does not support the target framework, install a compatible SDK or change the target framework in `BitbarSeleniumSampleCSharp.csproj`. + + Example to install/check SDK: + + ```bash + dotnet --list-sdks + ``` + +- Need to update Selenium WebDriver version: + If tests fail after browser or API-side changes, update `Selenium.WebDriver` to a newer compatible version. + + ```bash + dotnet add BitbarSeleniumSampleCSharp.csproj package Selenium.WebDriver --version 4.33.0 + dotnet restore + ``` + +- Package restore/build issues after version change: + Clean and restore dependencies before running tests again. + + ```bash + dotnet clean BitbarSeleniumSampleCSharp.csproj + dotnet restore BitbarSeleniumSampleCSharp.csproj + dotnet test BitbarSeleniumSampleCSharp.csproj + ``` \ No newline at end of file diff --git a/samples/testing-frameworks/selenium/client-side/NodeJS/README.md b/samples/testing-frameworks/selenium/client-side/NodeJS/README.md new file mode 100644 index 00000000..162f1364 --- /dev/null +++ b/samples/testing-frameworks/selenium/client-side/NodeJS/README.md @@ -0,0 +1,53 @@ +# Selenium NodeJS Sample + +This folder contains a sample client-side Selenium test for desktop browsers in BitBar Cloud. + +## Files + +- `bitbar_selenium.js` runs a Selenium WebDriver session against the BitBar desktop hub, opens the sample page, clicks the button, and validates the page title, result text, and button style. +- `package.json` defines the Node.js dependencies for the sample. + +## Requirements + +- Node.js +- npm +- A valid BitBar API key + +## Dependencies + +This sample uses the dependencies declared in `package.json`: + +- `selenium-webdriver` `^4.28.1` +- `chai` `^5.1.2` + +## Before Running + +Open `bitbar_selenium.js` and replace the `apiKey` value with your own BitBar API key. + +Install the project dependencies from this folder: + +```bash +npm install +``` + +## Run Locally + +From this folder, run: + +```bash +node bitbar_selenium.js +``` + +## Expected Output + +A successful run prints output similar to: + +Bitbar - Test Page for Samples +Bitbar + + +## Troubleshooting + +If `npm install` fails, verify that `node` and `npm` are installed and available in your shell. + +If the test starts but fails to create a remote session, check that the BitBar `apiKey` in `bitbar_selenium.js` is valid. \ No newline at end of file diff --git a/samples/testing-frameworks/selenium/client-side/java/README.md b/samples/testing-frameworks/selenium/client-side/java/README.md new file mode 100644 index 00000000..783c65a4 --- /dev/null +++ b/samples/testing-frameworks/selenium/client-side/java/README.md @@ -0,0 +1,48 @@ +Intro +===== + +This folder contains a sample client side Selenium test for desktop browsers in BitBar Cloud. +To run the sample, go to `https://cloud.bitbar.com/` and use a valid Bitbar API key. + +Folder Content +-------------- + +This folder contains the following files: + +* `src/test/java/com/bitbar/selenium/BitbarSelenium.java` is the Java sample test. + +* `pom.xml` defines the Maven project and pulls the Selenium Java dependency used by the sample. + +Requirements +------------ + +* Java 8 or newer +* Maven 3.6 or newer +* A valid Bitbar API key + +Before Running +-------------- + +Add your BitBar Key here in BitbarSelenium.java:- +* `bitbarOptions.put("apiKey", "");` + +Run Locally +----------- + +From this folder, run: + +```bash +mvn -q -DskipTests test-compile org.codehaus.mojo:exec-maven-plugin:3.6.0:java \ + -Dexec.mainClass=com.bitbar.selenium.BitbarSelenium \ + -Dexec.classpathScope=test +``` + +Expected Output +--------------- + +A successful run prints output similar to: + +```text +Bitbar - Test Page for Samples +Bitbar +``` diff --git a/samples/testing-frameworks/selenium/client-side/python/README.md b/samples/testing-frameworks/selenium/client-side/python/README.md new file mode 100644 index 00000000..2a91b227 --- /dev/null +++ b/samples/testing-frameworks/selenium/client-side/python/README.md @@ -0,0 +1,27 @@ +# Selenium Python Sample + +1. Open `bitbar_selenium.py` and update `apiKey` in `capabilities`. +2. Install compatible Selenium: +3. Run: + +```bash +python3 bitbar_selenium.py +``` + +## Common Error + +Error: + +```text +TypeError: WebDriver.__init__() got an unexpected keyword argument 'desired_capabilities' +``` + +Cause: +- Installed Selenium version is too new for this sample code. + +Fix: + +```bash +python -m pip install "selenium==4.9.1" +(any selenium version that is compatible) +``` diff --git a/samples/testng-parallel-mobile-tests/src/test/resources/properties/Apple iPhone 16 A3287 26.2.properties b/samples/testng-parallel-mobile-tests/src/test/resources/properties/Apple iPhone 16 A3287 26.2.properties new file mode 100644 index 00000000..4258560a --- /dev/null +++ b/samples/testng-parallel-mobile-tests/src/test/resources/properties/Apple iPhone 16 A3287 26.2.properties @@ -0,0 +1,5 @@ +bitbar_device = Apple iPhone 16 A3287 26.2 +browser_name = safari +platform_name = iOS +device_name = iPhone device +automation_name = XCUITest diff --git a/samples/testng-parallel-mobile-tests/src/test/resources/properties/GooglePixelXL.properties b/samples/testng-parallel-mobile-tests/src/test/resources/properties/GooglePixelXL.properties index 4e92c85b..ed802dc6 100644 --- a/samples/testng-parallel-mobile-tests/src/test/resources/properties/GooglePixelXL.properties +++ b/samples/testng-parallel-mobile-tests/src/test/resources/properties/GooglePixelXL.properties @@ -2,3 +2,4 @@ bitbar_device = Google Pixel XL browser_name = chrome platform_name = Android device_name = Android Phone +automation_name = UiAutomator2 diff --git a/samples/testng-parallel-mobile-tests/src/test/resources/properties/Samsung Galaxy S24 Ultra SM-S928B.properties b/samples/testng-parallel-mobile-tests/src/test/resources/properties/Samsung Galaxy S24 Ultra SM-S928B.properties new file mode 100644 index 00000000..bd4093ba --- /dev/null +++ b/samples/testng-parallel-mobile-tests/src/test/resources/properties/Samsung Galaxy S24 Ultra SM-S928B.properties @@ -0,0 +1,5 @@ +bitbar_device = Samsung Galaxy S24 Ultra SM-S928B +browser_name = chrome +platform_name = Android +device_name = Android Phone +automation_name = UiAutomator2