Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 22 additions & 19 deletions docs/hyperexecute-how-to-configure-tunnel.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: hyperexecute-how-to-configure-tunnel
title: How to Configure Tunnel with HyperExecute
hide_title: true
title: Tunnel Configuration in HyperExecute
hide_title: false
sidebar_label: How to Configure Tunnel with HyperExecute
description: Learn to set up a Tunnel with HyperExecute effortlessly with our straightforward guide, simplifying the configuration process for you!
keywords:
Expand Down Expand Up @@ -37,37 +37,36 @@ slug: hyperexecute-how-to-configure-tunnel/
})
}}
></script>
You can configure a secure tunnel in HyperExecute to test applications that are:

# Tunnel Configuration
- Hosted locally on your system, or
- Behind a private network/firewall.

***
## Prerequisites
- HyperExecute YAML file -> HyperExecute supports multiple ways of setting up tunnels directly from your YAML configuration. You can use any version of [YAML](https://www.lambdatest.com/support/docs/hyperexecute-yaml-parameters/) to pass the Tunnel parameters.
- [HyperExecute CLI](/support/docs/hyperexecute-cli-run-tests-on-hyperexecute-grid/) to trigger your tests.

## How to Configure Tunnel with HyperExecute?

> You can use any version of YAML to pass the Tunnel Parameters.

If you want to use a tunnel with HyperExecute, you will have to download the [HyperExecute CLI](/support/docs/hyperexecute-cli-run-tests-on-hyperexecute-grid/) and configure it.

There are 3 ways to use a tunnel in HyperExecute:
## Ways to Use Tunnel in HyperExecute
There are 3 main ways to use a tunnel in HyperExecute:

### 1. Simple `tunnel` Connection
Enable tunnel directly by setting the `tunnel` flag to `true` in your HyperExecute YAML file. The HyperExecute CLI will launch a tunnel as sub process for accessing your applications which are locally hosted or behind a firewall.

Set the `tunnel` flag to `true` to enable it. The cli will launch a tunnel as sub process for accessing your applications which are locally hosted or behind a firewall.

```bash
```yaml title="hyperexecute.yaml"
tunnel: true
```
> Recommended if you want to quickly enable tunnel access for locally hosted apps.

### 2. Using Existing `tunnel`
If you already have a running tunnel, you can reuse it by specifying its name to access your applications which are locally hosted or behind a firewall.

Specify the list of already running tunnel names which you want to use for accessing your applications which are locally hosted or behind a firewall.

```bash
```yaml title="hyperexecute.yaml"
tunnelNames: ["lambdatest_tunnel"]
```

### 3. Advanced `tunnel` Configurations
> Useful when running multiple jobs and you don’t want to spawn new tunnels each time.

### 3. Advanced `tunnel` Configurations
These are the parameters you can use to configure your [tunnel](/support/docs/deep-dive-into-hyperexecute-yaml/#tunnel) settings when running it.

| Options | Type | Description |
Expand All @@ -79,7 +78,11 @@ These are the parameters you can use to configure your [tunnel](/support/docs/de
|`systemProxy`| Boolean | Should the tunnel be OS system wide? Default false. |
|`checkTunnelOnFailure`| Boolean | Check tunnel on failure adds a check on our system to check the tunnel connection if a test fails and the tunnel is set to true. This option will retry the test 2 times if tunnel connection is flaky. |

```bash
> HyperExecute now supports tunnel capabilities for [Maestro](https://www.lambdatest.com/support/docs/hyperexecute-maestro-testing/) tests running on both virtual devices and real devices using the Raw Framework configuration.

```yaml title="hyperexecute.yaml"
tunnel: true

tunnelOpts:
global: true
```
Expand Down
2 changes: 2 additions & 0 deletions docs/hyperexecute-maestro-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ https://github.com/LambdaTest/hyperexecute-maestro-sample-test/blob/main/ios-sim

</Tabs>

> HyperExecute now supports [tunnel capabilities](/support/docs/hyperexecute-how-to-configure-tunnel/) for Maestro tests running on both virtual devices and real devices using the Raw Framework configuration.

## Step 5: Generate JUnit XML Report
1. Update the `runTest.sh` file to include the `--format junit` flag in the maestro test command:

Expand Down
198 changes: 44 additions & 154 deletions docs/playwright-real-device-on-hyperexecute.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: playwright-real-device-on-hyperexecute
title: Run playwright automation tests on HyperExecute using Real Devices
hide_title: true
title: Running Playwright Real Device Tests on HyperExecute
hide_title: false
sidebar_label: Real Device
description: Learn how to run playwright automation tests using Real Devices on HyperExecute
keywords:
Expand All @@ -20,6 +20,8 @@ slug: playwright-real-device-on-hyperexecute/

import CodeBlock from '@theme/CodeBlock';
import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys";
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<script type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify({
Expand All @@ -44,184 +46,84 @@ import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/co
})
}}
></script>

# Running Playwright with Real Devices on HyperExecute

This guide details how to execute your **Playwright Real Device** tests on **HyperExecute**:
<!--
- [**Using Local System**](/support/docs/junit-on-hyperexecute-grid/#1-testing-using-local-system) - You can use your own local machine to execute tests.
- [**Using Gitpod Platform**](/support/docs/junit-on-hyperexecute-grid/#2-testing-using-gitpod) - Execute tests using GitPod. (Requires a [Gitpod](https://gitpod.io/login/) account) -->

<!-- ## Testing Using Local System

Follow the step-by-step guide to execute your test on HyperExecute. -->
This guide explains how to run your **Playwright** tests on **Real devices (Android and iOS)** using HyperExecute:

## Prerequisites

To run the Tests on HyperExecute from your Local System, you are required:
Before running your tests, ensure you have:

- Your LambdaTest [Username and Access key](/support/docs/hyperexecute-how-to-get-my-username-and-access-key/)
- [HyperExecute YAML](/support/docs/hyperexecute-yaml-version0.2/) file which contains all the necessary instructions.
- [HyperExecute YAML](/support/docs/hyperexecute-yaml-version0.2/) file with the test configuration.
- [HyperExecute CLI](/support/docs/hyperexecute-cli-run-tests-on-hyperexecute-grid/) in order to initiate a test execution Job .
- Setup the [Environmental Variable](/support/docs/hyperexecute-environment-variable-setup/)

## Step 1: Setup Your Test Suite

You can use your own project to configure and test it. For demo purposes, we are using the sample repository.
## Step 1: Set Up Your Test Project
You can use your own Playwright project or try the sample repo:. For demo purposes, we are using the sample repository.

:::tip Sample repo

Download or Clone the code sample for the Playwright Real Device from the LambdaTest GitHub repository to run the tests on the HyperExecute.

<a href="https://github.com/LambdaTest/LambdaTest-HyperExecute-Playwright-Appium-Sample" className="github__anchor"><img loading="lazy" src={require('../assets/images/icons/github.png').default} alt="Image" className="doc_img"/> View on GitHub</a>

:::

### Configure the Capabilities

Configure the desired capabilities based on your test requirements. For example:

```bash
const capabilities = {
'browserName': 'Chrome', #Browsers allowed: `Chrome`, `MicrosoftEdge`, `pw-chromium`, `pw-firefox` and `pw-webkit`
'browserVersion': 'latest',
'LT:Options': {
'platform': 'android',
'build': 'Playwright HyperExecute Build',
'name': 'Playwright HyperExecute Test',
'user': '<your_lambdatest_user_name>',
'accessKey': '<your_lambdatest_access_key>',
# 'network': true,
'video': true,
'console': true
}
}
```
### Configure Desired Capabilities
Update your test configuration with the required capabilities.

<Tabs className="docs__val">
<TabItem value="android" label="Android" default>
```javascript title="playwright-android-real-device.js" reference
https://github.com/LambdaTest/LambdaTest-HyperExecute-Playwright-Appium-Sample/blob/main/playwright-android-real-device.js
```
</TabItem>

<TabItem value="ios" label="iOS" default>
```javascript title="playwright-ios-real-device.js" reference
https://github.com/LambdaTest/LambdaTest-HyperExecute-Playwright-Appium-Sample/blob/main/playwright-ios-real-device.js
```
</TabItem>
</Tabs>

> You can also use **dev** and **beta** browser versions. To generate capabilities for your test requirements, you can use our inbuilt 🔗 [Capabilities Generator Tool](https://www.lambdatest.com/capabilities-generator/).

### Configure the CDP URL
You will have to update the **CDP (Chrome DevTools Protocol) URL** which is a protocol used for communication between the browser and the developer tools.

- You will have to update the **CDP (Chrome DevTools Protocol) URL** which is a protocol used for communication between the browser and the developer tools.

```bash
```javascript title="playwright-ios-real-device.js"
const browser = await chromium.connect({
wsEndpoint: `wss://cdp.lambdatest.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
})
```

## Step 2: Setup the CLI in your Test Suite

After cloning / downloading the sample repo, you need to setup the CLI and the environment variables.

### Download the HyperExecute CLI

The CLI is used for triggering the tests on HyperExecute. It is recommend to download the CLI binary on the host system and keep it in the root directory of the suite to perform the tests on HyperExecute.
## Step 2: Download the CLI in your Project
The CLI is used for triggering the tests on HyperExecute. It is recommend to download the CLI binary on the host system and keep it in the root directory of the project to execute the tests on HyperExecute.

You can download the CLI for your desired platform from the below mentioned links:

| Platform | HyperExecute CLI |
| Host Machine | HyperExecute CLI |
| ---------| ---------------- |
| Windows | https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe |
| MacOS | https://downloads.lambdatest.com/hyperexecute/darwin/hyperexecute |
| Linux | https://downloads.lambdatest.com/hyperexecute/linux/hyperexecute |

### Setup Environment Variable

Now, you need to export your environment variables *LT_USERNAME* and *LT_ACCESS_KEY* that are available in the [LambdaTest Profile page](https://accounts.lambdatest.com/detail/profile).

Run the below mentioned commands in your terminal to setup the CLI and the environment variables.

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
## Step 3: Configure YAML in your Test Suite
Use the sample YAML below to configure your execution:

<Tabs className="docs__val">

<TabItem value="bash" label="Linux / MacOS" default>

<div className="lambdatest__codeblock">
<CodeBlock className="language-bash">
{`export LT_USERNAME="${ YOUR_LAMBDATEST_USERNAME()}"
export LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"`}
</CodeBlock>
</div>

</TabItem>

<TabItem value="powershell" label="Windows" default>

<div className="lambdatest__codeblock">
<CodeBlock className="language-powershell">
{`set LT_USERNAME="${ YOUR_LAMBDATEST_USERNAME()}"
set LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"`}
</CodeBlock>
</div>

</TabItem>
<TabItem value="android" label="Android" default>
```yaml title="hyperexecute_android.yaml" reference
https://github.com/LambdaTest/LambdaTest-HyperExecute-Playwright-Appium-Sample/blob/main/hyperexecute_android.yaml
```
</TabItem>

<TabItem value="ios" label="iOS" default>
```yaml title="hyperexecute_ios.yaml" reference
https://github.com/LambdaTest/LambdaTest-HyperExecute-Playwright-Appium-Sample/blob/main/hyperexecute_ios.yaml
```
</TabItem>
</Tabs>

## Step 3: Configure YAML in your Test Suite

Configure your YAML file as per your use cases using **key value** pairs.

In this sample YAML file, we have mentioned:

- **version** of the YAML file
- **runson** flag to specify the operating system
- **Mode of execution** is [Autosplit](/support/docs/hyperexecute-auto-split-strategy/). You can also opt for [Matrix](/support/docs/hyperexecute-matrix-multiplexing-strategy/) or [Hybrid](/support/docs/hyperexecute-hybrid-strategy/) mode.
- **Pre and Post** commands
- and other necessary YAML Parameters

```yaml
---
version: "0.2"

runson: android

autosplit: true

concurrency: 1

retryOnFailure: true
maxRetries: 2

cacheKey: '{{ checksum "package-lock.json" }}'
cacheDirectories:
- node_modules

env:
INFRA_TIMEOUT: 2000

runtime:
language: node
version: "18"

pre:
- npm install
- npx playwright install

testDiscovery:
command: cat pw_androidtests.txt
mode: static
type: raw

testRunnerCommand: npm run test-android --verbose

# highlight-start
framework:
name: appium
args:
playwrightRD : true
region: eu
# highlight-end

jobLabel: ['Playwright', 'Real-Device', 'HyperExecute']
```

:::info
To Run test on Mobile Containers in a Particular Region

```bash
```yaml title="hyperexecute.yaml"
dynamicAllocation: true

framework:
Expand All @@ -231,9 +133,7 @@ framework:
region: ap # supported regions -> ap, eu, us
reservation: false
```

- If **`reservation : false`**, it means that it will allocate the device from any region. If you want to allocate the device of any specific region, keep the **`reservation : true`**.

:::

## Step 4: Execute your Test Suite
Expand All @@ -242,22 +142,12 @@ framework:

Run the below command in your terminal at the root folder of the project:

```bash
./hyperexecute --config RELATIVE_PATH_OF_YOUR_YAML_FILE
```

OR use this command if you have not exported your username and access key in the step 2.

<div className="lambdatest__codeblock">
<CodeBlock className="language-bash">
{`./hyperexecute --user ${ YOUR_LAMBDATEST_USERNAME()} --key ${ YOUR_LAMBDATEST_ACCESS_KEY()} --config RELATIVE_PATH_OF_YOUR_YAML_FILE `}
</CodeBlock>
</div>

<img loading="lazy" src={require('../assets/images/hyperexecute/frameworks/playwright/real-device/1.png').default} alt="JUnit HyperExecute Terminal Logs" width="1920" height="868" className="doc_img"/>

<img loading="lazy" src={require('../assets/images/hyperexecute/frameworks/playwright/real-device/2.png').default} alt="JUnit HyperExecute Terminal Logs" width="1920" height="868" className="doc_img"/>

## Step 5: Monitor the Test Execution

Visit the [HyperExecute Dashboard](https://hyperexecute.lambdatest.com/hyperexecute) and check your Job status.
Expand Down
Loading