Bridging Platforms in Automation: One Test, Two Worlds


We often talk about the importance of tool selection in automation, but what happens when a single functional test spans across web and mobile native apps? I hadn’t done this before — testing a web and a mobile native app simultaneously as part of a single functional automation test. I had to orchestrate a test scenario where a process started on a web application and seamlessly continued on a mobile native app. This wasn’t just about making the test pass; it was about understanding how different frameworks adapt to handle the same functionality.It made me pause and rethink the way we approach test frameworks.
When we talk about test automation, it’s usually in silos — we write Playwright tests for web, Appium for mobile, maybe Selenium for legacy flows. But what if your user journey doesn’t stay in one place? What if they start something on the web, but finish it on mobile?
This blog dives into that exact challenge — multi-platform, single-scenario automation, and what it taught me about adaptability, tooling, and building smarter pipelines.
The Challenge: A Seamless Transition
The core challenge was ensuring a smooth transition between web and mobile native environments within a single test scenario. This required handling session persistence, authentication states, and maintaining consistent UI interactions across platforms. It’s one thing to automate a web flow or a mobile flow independently, but bridging the gap between them is a whole different ball game.
The Solution: A Trio of Power
To tackle this, I leveraged a powerful trio of frameworks:
Playwright: For efficient web interactions.
Appium: For robust mobile native automation.
Selenium (Implicitly): For some basic web interaction (if needed).
The key was to manage the handoff between these frameworks effectively. Here’s a glimpse into the process:
Web Interaction with Playwright: The test started by automating the initial steps on the web application using Playwright. This involved navigating through the web UI, entering data, and triggering the event that would transition the process to the mobile app.
Session Persistence and Authentication: Ensuring the authentication state and session were maintained during the transition was critical. This involved careful management of cookies, tokens, or other authentication mechanisms.
Mobile Native Automation with Appium: Once the process moved to the mobile app, Appium took over. This involved launching the native app, navigating through its UI, and completing the remaining steps of the test.
Data Synchronization: If the web and mobile parts of the test involved data synchronization, I had to ensure that the data was consistent across both platforms.
1. Project Setup and Planning:
- Identify the Cross-Platform Scenario: Clearly define the test scenario that spans both web and mobile native apps.
Choose Your Frameworks: Decide on the frameworks you’ll use
Web: Playwright for modern, fast automation
Mobile: Appium for native app testing
Optional: Selenium for compatibility with legacy web flows
Plan Your Test Structure: Design how the test will transition from web to mobile, including
Data sharing
Session/authentication management
Shared context
Create Project Structure:
Web tests
Mobile tests
Shared resources (e.g., tokens, API mocks)
Dockerfiles and environment setup scripts
2. Web Automation with Playwright
Install Playwright
Use your preferred language. eg: pythonDevelop Web Test Scripts
Simulate the initial steps of the user journey — login, form submission, trigger events.Manage Session/Auth State
Implement methods to capture session data (cookies, tokens) for continuity with mobile tests.Trigger the Transition to Mobile
Automate the action that leads to the mobile flow (e.g., QR scan, redirect, push notification).
3. Install Appium and Dependencies
Installations
Appium server, Node.js, Language bindings (e.g.,Appium-Python-Client
, Java client)Set Up Desired Capabilities
Configure device/emulator settings including app package, platform version, and automation engine.Write Appium Test Scripts
Complete the mobile portion of the user journey — e.g., OTP verification, in-app confirmation.Handle Data Sharing
Enable seamless hand-off using:APIs, Shared file system, Environment variables or test context
4. Docker Containerization
Create Dockerfile
Define base image (e.g., FROM python:3.9
) and install:
Playwright
Appium & dependencies
Your test scripts and configs
docker build -t cross-platform-tests .
Run Tests in a Container
docker run cross-platform-tests
5. CI/CD Pipeline Integration
Choose Your CI/CD Platform
Options include Jenkins, GitHub Actions, GitLab CI, or Azure DevOps.
Define Pipeline Stages
Install dependencies
Build Docker image
Run web + mobile tests
Generate and publish reports
Integrate Docker in CI
Use Docker commands in your pipeline to build and run tests reliably across environments.
Collect and Report Results
Aggregate test results and display them via CI plugins or dashboards.
6. Cross-Framework Coordination
Enable Communication Between Frameworks
Options include: API calls, Shared files or JSON data, Cloud storage or temporary DB
Sync Session/Data States
Write utilities to sync auth tokens, session states, or test data between web and mobile flows.
7. Testing & Debugging
Run Tests Locally
Verify the entire flow works as expected on local machines/emulators.
Debug Transition Points
Focus on areas where context is handed from one platform to another.
Test Within Docker
Ensure consistency by running tests inside the Docker environment.
Validate in CI/CD Pipeline
Run full cross-platform automation through the pipeline to confirm stability and integration.
8. Maintenance & Scalability
Keep Dependencies Updated
Regularly update Playwright, Appium, and related tools.
Refactor for Scalability
Organize reusable components, simplify setup scripts, and modularize test flows.
Expand Test Coverage
Continuously add new end-to-end test scenarios across platforms.
Bringing It All Together: Cross-Framework Adaptability
This experience underscored the importance of cross-framework adaptability. It wasn’t just about making Playwright and Appium work together; it was about understanding their strengths and weaknesses and finding the right balance.
Playwright’s Speed and Reliability: Playwright’s speed and reliability made it ideal for handling the web portion of the test.
Appium’s Native Capabilities: Appium’s ability to interact with native mobile UI elements was essential for automating the mobile app portion.
Selenium’s Legacy Support: Selenium brought the support for older web applications, if needed.
Docker Containerization: Ensuring Consistent Environments
To further enhance the reliability and reproducibility of our cross-platform tests, we incorporated Docker containerization. This allowed us to create a consistent and isolated environment for our tests.
Dockerfile Creation: We created a Dockerfile that defined our testing environment. This included the base image (e.g., Python), installation of dependencies (Playwright, Appium, Selenium, and their dependencies), and copying our test scripts.
Image Building: We then built a Docker image using the
docker build
command, which encapsulates all the necessary components for our tests.Container Execution: Finally, we ran our tests within a Docker container using the
docker run
command. This ensured that the tests were executed in a controlled environment, eliminating any potential environment-related inconsistencies.
This approach significantly improved the stability of our tests, especially when running them in a CI/CD pipeline.
Setting Up the CI/CD Pipeline
To ensure continuous testing, I set up a CI/CD pipeline that could handle Playwright, Appium, and Selenium tests, with Docker integration. This involved configuring the pipeline to:
Build the Docker image.
Run the tests within the Docker container.
Collect and report test results from both web and mobile environments.
This project discussing about the importance of:
Framework Interoperability: Understanding how different frameworks can work together.
Session Management: Effectively managing authentication and session states.
Data Consistency: Ensuring data integrity across platforms.
CI/CD Integration: Building robust pipelines for cross-platform testing.
Docker Containerization: Creating consistent and reproducible testing environments.
Subscribe to my newsletter
Read articles from arya bhattathiri directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
