Cloud Testing Guide
Taflex JS provides native integration with industry-leading cloud testing platforms like BrowserStack and SauceLabs. This allows you to scale your test execution across a vast array of browser/OS combinations and real mobile devices without managing your own infrastructure.
đ Why Use Cloud Testing?â
- Zero Infrastructure: No need to maintain local browser versions or mobile emulators.
- Parallel Execution: Run tests simultaneously across multiple configurations.
- Real Devices: Test your mobile applications on actual physical hardware.
- Debugging Tools: Access video recordings, network logs, and screenshots of every test session.
đ ī¸ Configurationâ
To enable cloud execution, update your .env file with the following parameters:
Common Settingsâ
# Set the platform (local, browserstack, saucelabs)
CLOUD_PLATFORM=browserstack
# Your cloud credentials
CLOUD_USER=your_username
CLOUD_KEY=your_access_key
Web Executionâ
For web automation, you can specify the target environment:
EXECUTION_MODE=web
BROWSER=chromium
BROWSER_VERSION=latest
OS=Windows
OS_VERSION=11
Mobile Executionâ
For mobile automation, the framework automatically maps these settings to Appium capabilities:
EXECUTION_MODE=mobile
OS=Android
OS_VERSION=Google Pixel 7
đŠī¸ Supported Providersâ
BrowserStackâ
When CLOUD_PLATFORM=browserstack is set, the framework uses the Playwright CDP (Chrome DevTools Protocol) endpoint for web tests and the BrowserStack Appium hub for mobile tests.
Specific capabilities included:
bstack:optionsare automatically generated.- Project and Build names are automatically tagged with "Taflex Framework" and the current date.
SauceLabsâ
When CLOUD_PLATFORM=saucelabs is set, the framework connects to the SauceLabs US-West-1 data center.
Specific capabilities included:
sauce:optionsare automatically generated.- Standard W3C capabilities are enforced for maximum compatibility.
đģ CLI Usageâ
You can easily switch between local and cloud execution using environment variables in your command line:
# Run web tests locally
npm run test:web
# Run web tests on BrowserStack
CLOUD_PLATFORM=browserstack npm run test:web
# Run mobile tests on SauceLabs
CLOUD_PLATFORM=saucelabs EXECUTION_MODE=mobile npm run test:bdd
đ Debugging in the Cloudâ
Once a test finishes, you can log in to your provider's dashboard to see:
- Video Recording: A full video of the test execution.
- Metadata: Detailed information about the browser, OS, and environment.
- Logs: Console logs and network traffic (HAR files).