Skip to content

Commit f9b8612

Browse files
Merge pull request #2150 from amanchopra1905/stage
hyp hackathon items
2 parents 44ee4df + aff63fd commit f9b8612

File tree

3 files changed

+68
-173
lines changed

3 files changed

+68
-173
lines changed

docs/hyperexecute-how-to-configure-tunnel.md

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: hyperexecute-how-to-configure-tunnel
3-
title: How to Configure Tunnel with HyperExecute
4-
hide_title: true
3+
title: Tunnel Configuration in HyperExecute
4+
hide_title: false
55
sidebar_label: How to Configure Tunnel with HyperExecute
66
description: Learn to set up a Tunnel with HyperExecute effortlessly with our straightforward guide, simplifying the configuration process for you!
77
keywords:
@@ -37,37 +37,36 @@ slug: hyperexecute-how-to-configure-tunnel/
3737
})
3838
}}
3939
></script>
40+
You can configure a secure tunnel in HyperExecute to test applications that are:
4041

41-
# Tunnel Configuration
42+
- Hosted locally on your system, or
43+
- Behind a private network/firewall.
4244

43-
***
45+
## Prerequisites
46+
- 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.
47+
- [HyperExecute CLI](/support/docs/hyperexecute-cli-run-tests-on-hyperexecute-grid/) to trigger your tests.
4448

45-
## How to Configure Tunnel with HyperExecute?
46-
47-
> You can use any version of YAML to pass the Tunnel Parameters.
48-
49-
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.
50-
51-
There are 3 ways to use a tunnel in HyperExecute:
49+
## Ways to Use Tunnel in HyperExecute
50+
There are 3 main ways to use a tunnel in HyperExecute:
5251

5352
### 1. Simple `tunnel` Connection
53+
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.
5454

55-
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.
56-
57-
```bash
55+
```yaml title="hyperexecute.yaml"
5856
tunnel: true
5957
```
58+
> Recommended if you want to quickly enable tunnel access for locally hosted apps.
6059
6160
### 2. Using Existing `tunnel`
61+
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.
6262

63-
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.
64-
65-
```bash
63+
```yaml title="hyperexecute.yaml"
6664
tunnelNames: ["lambdatest_tunnel"]
6765
```
6866

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

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

7372
| Options | Type | Description |
@@ -79,7 +78,11 @@ These are the parameters you can use to configure your [tunnel](/support/docs/de
7978
|`systemProxy`| Boolean | Should the tunnel be OS system wide? Default false. |
8079
|`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. |
8180

82-
```bash
81+
> 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.
82+
83+
```yaml title="hyperexecute.yaml"
84+
tunnel: true
85+
8386
tunnelOpts:
8487
global: true
8588
```

docs/hyperexecute-maestro-testing.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ https://github.com/LambdaTest/hyperexecute-maestro-sample-test/blob/main/ios-sim
135135

136136
</Tabs>
137137

138+
> 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.
139+
138140
## Step 5: Generate JUnit XML Report
139141
1. Update the `runTest.sh` file to include the `--format junit` flag in the maestro test command:
140142

docs/playwright-real-device-on-hyperexecute.md

Lines changed: 44 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: playwright-real-device-on-hyperexecute
3-
title: Run playwright automation tests on HyperExecute using Real Devices
4-
hide_title: true
3+
title: Running Playwright Real Device Tests on HyperExecute
4+
hide_title: false
55
sidebar_label: Real Device
66
description: Learn how to run playwright automation tests using Real Devices on HyperExecute
77
keywords:
@@ -20,6 +20,8 @@ slug: playwright-real-device-on-hyperexecute/
2020

2121
import CodeBlock from '@theme/CodeBlock';
2222
import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys";
23+
import Tabs from '@theme/Tabs';
24+
import TabItem from '@theme/TabItem';
2325

2426
<script type="application/ld+json"
2527
dangerouslySetInnerHTML={{ __html: JSON.stringify({
@@ -44,184 +46,84 @@ import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/co
4446
})
4547
}}
4648
></script>
47-
48-
# Running Playwright with Real Devices on HyperExecute
49-
50-
This guide details how to execute your **Playwright Real Device** tests on **HyperExecute**:
51-
<!--
52-
- [**Using Local System**](/support/docs/junit-on-hyperexecute-grid/#1-testing-using-local-system) - You can use your own local machine to execute tests.
53-
- [**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) -->
54-
55-
<!-- ## Testing Using Local System
56-
57-
Follow the step-by-step guide to execute your test on HyperExecute. -->
49+
This guide explains how to run your **Playwright** tests on **Real devices (Android and iOS)** using HyperExecute:
5850

5951
## Prerequisites
60-
61-
To run the Tests on HyperExecute from your Local System, you are required:
52+
Before running your tests, ensure you have:
6253

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

68-
## Step 1: Setup Your Test Suite
69-
70-
You can use your own project to configure and test it. For demo purposes, we are using the sample repository.
58+
## Step 1: Set Up Your Test Project
59+
You can use your own Playwright project or try the sample repo:. For demo purposes, we are using the sample repository.
7160

7261
:::tip Sample repo
73-
7462
Download or Clone the code sample for the Playwright Real Device from the LambdaTest GitHub repository to run the tests on the HyperExecute.
7563

7664
<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>
77-
7865
:::
7966

80-
### Configure the Capabilities
81-
82-
Configure the desired capabilities based on your test requirements. For example:
83-
84-
```bash
85-
const capabilities = {
86-
'browserName': 'Chrome', #Browsers allowed: `Chrome`, `MicrosoftEdge`, `pw-chromium`, `pw-firefox` and `pw-webkit`
87-
'browserVersion': 'latest',
88-
'LT:Options': {
89-
'platform': 'android',
90-
'build': 'Playwright HyperExecute Build',
91-
'name': 'Playwright HyperExecute Test',
92-
'user': '<your_lambdatest_user_name>',
93-
'accessKey': '<your_lambdatest_access_key>',
94-
# 'network': true,
95-
'video': true,
96-
'console': true
97-
}
98-
}
99-
```
67+
### Configure Desired Capabilities
68+
Update your test configuration with the required capabilities.
69+
70+
<Tabs className="docs__val">
71+
<TabItem value="android" label="Android" default>
72+
```javascript title="playwright-android-real-device.js" reference
73+
https://github.com/LambdaTest/LambdaTest-HyperExecute-Playwright-Appium-Sample/blob/main/playwright-android-real-device.js
74+
```
75+
</TabItem>
76+
77+
<TabItem value="ios" label="iOS" default>
78+
```javascript title="playwright-ios-real-device.js" reference
79+
https://github.com/LambdaTest/LambdaTest-HyperExecute-Playwright-Appium-Sample/blob/main/playwright-ios-real-device.js
80+
```
81+
</TabItem>
82+
</Tabs>
10083

10184
> 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/).
10285
10386
### Configure the CDP URL
87+
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.
10488

105-
- 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.
106-
107-
```bash
89+
```javascript title="playwright-ios-real-device.js"
10890
const browser = await chromium.connect({
10991
wsEndpoint: `wss://cdp.lambdatest.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
11092
})
11193
```
11294

113-
## Step 2: Setup the CLI in your Test Suite
114-
115-
After cloning / downloading the sample repo, you need to setup the CLI and the environment variables.
116-
117-
### Download the HyperExecute CLI
118-
119-
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.
95+
## Step 2: Download the CLI in your Project
96+
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.
12097

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

123-
| Platform | HyperExecute CLI |
100+
| Host Machine | HyperExecute CLI |
124101
| ---------| ---------------- |
125102
| Windows | https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe |
126103
| MacOS | https://downloads.lambdatest.com/hyperexecute/darwin/hyperexecute |
127104
| Linux | https://downloads.lambdatest.com/hyperexecute/linux/hyperexecute |
128105

129-
### Setup Environment Variable
130-
131-
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).
132-
133-
Run the below mentioned commands in your terminal to setup the CLI and the environment variables.
134-
135-
import Tabs from '@theme/Tabs';
136-
import TabItem from '@theme/TabItem';
106+
## Step 3: Configure YAML in your Test Suite
107+
Use the sample YAML below to configure your execution:
137108

138109
<Tabs className="docs__val">
139-
140-
<TabItem value="bash" label="Linux / MacOS" default>
141-
142-
<div className="lambdatest__codeblock">
143-
<CodeBlock className="language-bash">
144-
{`export LT_USERNAME="${ YOUR_LAMBDATEST_USERNAME()}"
145-
export LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"`}
146-
</CodeBlock>
147-
</div>
148-
149-
</TabItem>
150-
151-
<TabItem value="powershell" label="Windows" default>
152-
153-
<div className="lambdatest__codeblock">
154-
<CodeBlock className="language-powershell">
155-
{`set LT_USERNAME="${ YOUR_LAMBDATEST_USERNAME()}"
156-
set LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"`}
157-
</CodeBlock>
158-
</div>
159-
160-
</TabItem>
110+
<TabItem value="android" label="Android" default>
111+
```yaml title="hyperexecute_android.yaml" reference
112+
https://github.com/LambdaTest/LambdaTest-HyperExecute-Playwright-Appium-Sample/blob/main/hyperexecute_android.yaml
113+
```
114+
</TabItem>
115+
116+
<TabItem value="ios" label="iOS" default>
117+
```yaml title="hyperexecute_ios.yaml" reference
118+
https://github.com/LambdaTest/LambdaTest-HyperExecute-Playwright-Appium-Sample/blob/main/hyperexecute_ios.yaml
119+
```
120+
</TabItem>
161121
</Tabs>
162122

163-
## Step 3: Configure YAML in your Test Suite
164-
165-
Configure your YAML file as per your use cases using **key value** pairs.
166-
167-
In this sample YAML file, we have mentioned:
168-
169-
- **version** of the YAML file
170-
- **runson** flag to specify the operating system
171-
- **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.
172-
- **Pre and Post** commands
173-
- and other necessary YAML Parameters
174-
175-
```yaml
176-
---
177-
version: "0.2"
178-
179-
runson: android
180-
181-
autosplit: true
182-
183-
concurrency: 1
184-
185-
retryOnFailure: true
186-
maxRetries: 2
187-
188-
cacheKey: '{{ checksum "package-lock.json" }}'
189-
cacheDirectories:
190-
- node_modules
191-
192-
env:
193-
INFRA_TIMEOUT: 2000
194-
195-
runtime:
196-
language: node
197-
version: "18"
198-
199-
pre:
200-
- npm install
201-
- npx playwright install
202-
203-
testDiscovery:
204-
command: cat pw_androidtests.txt
205-
mode: static
206-
type: raw
207-
208-
testRunnerCommand: npm run test-android --verbose
209-
210-
# highlight-start
211-
framework:
212-
name: appium
213-
args:
214-
playwrightRD : true
215-
region: eu
216-
# highlight-end
217-
218-
jobLabel: ['Playwright', 'Real-Device', 'HyperExecute']
219-
```
220-
221123
:::info
222124
To Run test on Mobile Containers in a Particular Region
223125

224-
```bash
126+
```yaml title="hyperexecute.yaml"
225127
dynamicAllocation: true
226128

227129
framework:
@@ -231,9 +133,7 @@ framework:
231133
region: ap # supported regions -> ap, eu, us
232134
reservation: false
233135
```
234-
235136
- 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`**.
236-
237137
:::
238138

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

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

245-
```bash
246-
./hyperexecute --config RELATIVE_PATH_OF_YOUR_YAML_FILE
247-
```
248-
249-
OR use this command if you have not exported your username and access key in the step 2.
250-
251145
<div className="lambdatest__codeblock">
252146
<CodeBlock className="language-bash">
253147
{`./hyperexecute --user ${ YOUR_LAMBDATEST_USERNAME()} --key ${ YOUR_LAMBDATEST_ACCESS_KEY()} --config RELATIVE_PATH_OF_YOUR_YAML_FILE `}
254148
</CodeBlock>
255149
</div>
256150

257-
<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"/>
258-
259-
<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"/>
260-
261151
## Step 5: Monitor the Test Execution
262152

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

0 commit comments

Comments
 (0)