diff --git a/docs/run-settings.md b/docs/run-settings.md index 9360cdbad..4fa8a5f12 100644 --- a/docs/run-settings.md +++ b/docs/run-settings.md @@ -1,7 +1,7 @@ --- id: run-settings title: Configuring Cypress Test Execution -hide_title: true +hide_title: false sidebar_label: Configure Cypress Test Execution description: Explore LambdaTest's comprehensive guide on configuring run settings for seamless cross-browser testing. Optimize your testing workflow today. keywords: @@ -15,7 +15,6 @@ keywords: - Cypress Run Specific Test - Cypress Testing Environment - How to Run Cypress Tests - url: https://www.lambdatest.com/support/docs/run-settings/ site_name: LambdaTest slug: run-settings/ @@ -23,388 +22,298 @@ slug: run-settings/ 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'; -# Configuring Cypress Test Execution ---- - + You can specify Cypress CLI flags to run on LambdaTest in two ways: 1. Adding the CLI flag details in `lambdatest-config.json` file 2. Using the CLI -:::info Important -If a glob pattern path is passed in the specs flag using CLI, you must enclose it within double quotes. - -```lambdatest-cypress-cli run --env=stage --verbose --specs "./cypress/integration/examples/*" ``` +:::tip +If a glob pattern path is passed in the specs flag using CLI, you must enclose it within double quotes as shown: +`lambdatest-cypress-cli run --env=stage --verbose --specs "./cypress/integration/examples/*"` ::: -## Specifying Cypress Config File ---- +## Cypress Config File +#### Using `lambdatest-config.json` +You can use the `cypress_config_file` key in `run_settings` option to specify the Cypress configuration file. -**Using lambdatest-config.json**: You can use the *cypress_config_file* key in *run_settings* option to specify the Cypress configuration file. - -:::info Note -Cypress 10 and above versions automatically identify the `cypress.config.js` file in the project. Therefore, you don't need to specify the `cypress_config.js` capability. -::: - -**Example**: +> **NOTE :** Cypress 10 and above versions automatically identify the `cypress.config.js` file in the project. Therefore, you don't need to specify the `cypress_config.js` capability. + - - - -```javascript -// lambdatest-config.json - -{ - "run_settings": { - "cypress_config_file": "cypress.json", + ```javascript title="lambdatest-config.json" + { + "run_settings": { + "cypress_config_file": "cypress.json", + } } -} - -``` - - - - - -```javascript -// In case of Cypress 10 and above, you can specify your custom config files by using the --cy flag. - -lambdatest-cypress run --cy="--config-file " + ``` + -``` - - + + ```javascript title="lambdatest-config.json" + // In case of Cypress 10 and above, you can specify your custom config files by using the --cy flag. + lambdatest-cypress run --cy="--config-file " + ``` + +#### Using CLI +You can specify the Cypress configuration file using the below CLI flag with `run` command. -**Using CLI**: You can specify the Cypress configuration file using the below CLI flag with `run` command. - -| Flag | Purpose | Type | -| -------------------- | --------- |----| -| **--ccf, --cypress-config-file** | Path of the config file | String | - +| Flag | Purpose | Type | +| ---------------------------- | ----------------------- | ------ | +| --ccf, --cypress-config-file | Path of the config file | String | ## Specifying Spec Files ---- - -**Using lambdatest-config.json**: You can use the *specs* key in *run_settings* option to specify the Spec files. - -**Example**: +#### Using `lambdatest-config.json` +You can use the *specs* key in *run_settings* option to specify the Spec files. + - - -```javascript -// lambdatest-config.json - -{ - "run_settings": { - "specs": "**/*.cy.js", + ```javascript title="lambdatest-config.json" + { + "run_settings": { + "specs": "**/*.cy.js", + } } -} - -``` - - - - + ``` + -```javascript -// lambdatest-config.json + -{ - "run_settings": { - "specs": "./cypress/integration/examples/*.spec.js", + ```javascript title="lambdatest-config.json" + { + "run_settings": { + "specs": "./cypress/integration/examples/*.spec.js", + } } -} - -``` - - + ``` + +#### Using CLI +You can specify the Spec files using the below CLI flag with `run` command. +| Flag | Purpose | Type | +| ----------- | --------------------------------------------- | ------ | +| -s, --specs | Path of the spec file or directory or pattern | String | -**Using CLI**: You can specify the Spec files using the below CLI flag with `run` command. - -| Flag | Purpose | Type | -| -------------------- | --------- |----| -| **-s, --specs** | Path of the spec file or directory or pattern | String | - -## Specifying Exclude Specs Files ---- - +## Exclude Specs Files You can use the *exclude_specs* key in *run_settings* option to specify the spec files that you want to exclude from the test execution. -**Example**: - + - - -```javascript -// lambdatest-config.json - -{ - "run_settings": { - "exclude_specs": "./examples/assertion.spec.js, ./examples/connectors.spec.js", + ```javascript title="lambdatest-config.json" + { + "run_settings": { + "exclude_specs": "./examples/assertion.spec.js, ./examples/connectors.spec.js", + } } -} - -``` + ``` + - + - - -```javascript -// lambdatest-config.json - -{ - "run_settings": { - "exclude_specs": "./examples/assertion.spec.js, ./examples/connectors.spec.js", + ```javascript title="lambdatest-config.json" + { + "run_settings": { + "exclude_specs": "./examples/assertion.spec.js, ./examples/connectors.spec.js", + } } -} - -``` - - - + ``` + - - -## Specifying Geolocation ---- - -**Using lambdatest-config.json**: You can use the *geo_location* key in *run_settings* option to specify the Spec files. - -**Example**: +## Geolocation +#### Using `lambdatest-config.json` +You can use the *geo_location* key in *run_settings* option to specify the Spec files. + - - -```javascript -// lambdatest-config.json - -{ - "run_settings": { - "geo_location": "", + ```javascript title="lambdatest-config.json" + { + "run_settings": { + "geo_location": "", + } } -} - -``` + ``` + - + - - -```javascript -// lambdatest-config.json - -{ - "run_settings": { - "geo_location": "", + ```javascript title="lambdatest-config.json" + { + "run_settings": { + "geo_location": "", + } } -} - -``` - - - + ``` + +#### Using CLI +You can specify the geolocation files using the below CLI flag with `run` command. +| Flag | Purpose | Type | +| --------------------- | ------------------------- | ------ | +| --geo, --geo_location | Pass the Geo country code | String | -**Using CLI**: You can specify the geolocation files using the below CLI flag with `run` command. - -| Flag | Purpose | Type | -| -------------------- | --------- |----| -| **--geo, --geo_location** | Pass the Geo country code | String | - -## Specifying Resolution ---- - -**Using lambdatest-config.json**: Use the *resolution* key in *run_settings* option to specify the resolution. - -**Example**: +## Resolution +#### Using `lambdatest-config.json` +Use the *resolution* key in *run_settings* option to specify the resolution. + - - -```javascript -// lambdatest-config.json - -{ - "run_settings": { - "resolution": "1024x768", + ```javascript title="lambdatest-config.json" + { + "run_settings": { + "resolution": "1024x768", + } } -} - -``` + ``` + - + - - -```javascript -// lambdatest-config.json - -{ - "run_settings": { - "resolution": "1024x768", + ```javascript title="lambdatest-config.json" + { + "run_settings": { + "resolution": "1024x768", + } } -} - -``` - - - + ``` + -**Using CLI**: You can specify the system's resolution using the below CLI flag with `run` command. +#### Using CLI +You can specify the system's resolution using the below CLI flag with `run` command. -| Flag | Purpose | Type | -| -------------------- | --------- |----| +| Flag | Purpose | Type | +| ------ | ------------------- | ------ | | --res | Pass the resolution | String | *It will change the resolution of the system but the viewport in which Cypress launches the website is controlled by Cypress.* **Supported resolutions**: `1024x768`, `1280x960`, `1280x1024`, `1600x1200`, `1920x1080`, `2048x1536`, `2560x1440` - ## Excluding Files From Test Uploads ---- - -**Using lambdatest-config.json**: You can use the *ignore_files* key in *run_settings* option to ignore or exclude any particular files while uploading your tests. - -**Example**: +#### Using `lambdatest-config.json` +You can use the *ignore_files* key in *run_settings* option to ignore or exclude any particular files while uploading your tests. + - - -```javascript -// lambdatest-config.json - -{ - "run_settings": { - "ignore_files": "", + ```javascript title="lambdatest-config.json" + { + "run_settings": { + "ignore_files": "", + } } -} + ``` + -``` - - - - + -```javascript -// lambdatest-config.json - -{ - "run_settings": { - "ignore_files": "", + ```javascript title="lambdatest-config.json" + { + "run_settings": { + "ignore_files": "", + } } -} - -``` - - - + ``` + +#### Using CLI +Specify the files that you want to exclude using the below CLI flag with `run` command. -**Using CLI**: Specify the files that you want to exclude using the below CLI flag with `run` command. - -| Flag | Purpose | Type | -| -------------------- | --------- |----| -| **--if, --ignore_files** | Files to ignore in the zip project | String | - -## Specifying Max Duration for Test Session Timeout ---- +| Flag | Purpose | Type | +| ------------------- | ---------------------------------- | ------ | +| --if, --ignore_files| Files to ignore in the zip project | String | +## Max Duration for Test Session Timeout When running tests, if you encounter a situation where a particular test is running for an extended period and causing other parallel tests to be blocked, in this case, you can use the *max duration* flag to mitigate the issue. This flag allows you to specify a maximum time limit for the test to run before it is automatically stopped, thus freeing up resources for other tests to execute. -The valid input for *max_duration* must be an integer, and it can only be within the range of 2 to 240 minutes. - - -You can specify *max_duration*: - - -**Using lambdatest-config.json**: You can use the *max_duration* key in *run_settings* option to specify the session timeout. - -**Example**: +The valid input for `max_duration` must be an integer, and it can only be within the range of 2 to 240 minutes. +#### Using `lambdatest-config.json` +You can use the `max_duration` key in *run_settings* option to specify the session timeout. + - - -```javascript -// lambdatest-config.json - -{ - "run_settings": { - "max_duration":2 + ```javascript title="lambdatest-config.json" + { + "run_settings": { + "max_duration":2 + } } -} - -``` - - + ``` + - + -```javascript -// lambdatest-config.json - -{ - "run_settings": { - "max_duration":2 + ```javascript title="lambdatest-config.json" + { + "run_settings": { + "max_duration":2 + } } -} - -``` - - - + ``` + +#### Using CLI + You can specify the timeout using the below CLI flag with `run` command. - -**Using CLI**: You can specify the timeout using the below CLI flag with `run` command. - -| Flag | Purpose | Type | -| -------------------- | --------- |----| +| Flag | Purpose | Type | +| -------------- | ------------------------------ | ------- | | --max_duration | idle timeout of a test session | Integer | ## Organizing Tests -*** - You can name your test cases and categorize your Cypress builds by build number, build name, test and build tags for easier analysis. Use the following keys to organize your tests. -| Key | Description | Type | -| -------- | ------------ | -------- | -| build-name | Represent the name of the build for your test | String | -| project-name | Represents the name of your project | String | -| tags | Group your tests | String | +| Key | Description | Type | +| ------------ | -------------------------------------------- | ------ | +| build-name | Represent the name of the build for your test | String | +| project-name | Represents the name of your project | String | +| tags | Group your tests | String | **Example**: -```javascript -// lambdatest-config.json - +```javascript title="lambdatest-config.json" { "run_settings": { "build-name": "Cypress 10 Demo", @@ -415,19 +324,15 @@ You can name your test cases and categorize your Cypress builds by build number, ``` ## Headless Browser -*** - You can run Headless tests with Cypress by the `headless` key to `true`. -| Key | Description | Type | -| -------- | ------------ | -------- | -| headless | Run test in Headless mode | Boolean | +| Key | Description | Type | +| -------- | ------------------------- | ------- | +| headless | Run test in Headless mode | Boolean | **Example**: -```javascript -// lambdatest-config.json - +```javascript title="lambdatest-config.json" { "run_settings": { "headless": "true", @@ -436,8 +341,6 @@ You can run Headless tests with Cypress by the `headless` key to `true`. ``` ## Capture Network Logs -*** - You can generate Network logs with Cypress by setting the `network` key to `true`. | Key | Description | Type | @@ -446,9 +349,7 @@ You can generate Network logs with Cypress by setting the `network` key to `true **Example**: -```javascript -// lambdatest-config.json - +```javascript title="lambdatest-config.json" { "run_settings": { "network": "true", @@ -456,28 +357,26 @@ You can generate Network logs with Cypress by setting the `network` key to `true } ``` -## Specifying NPM Package Dependencies ---- - -**Need of `npm_dependencies`**: In order to run your tests on LambdaTest, we refer to your `package.json` and use those dependencies and devDependencies. Since, `package.json` may contain several dependencies which may not be required to run your Cypress tests. We recommend to use "npm_dependencies" parameter to list down the required dependencies to run your test, because it will reduce your build time on LambdaTest. +## NPM Package Dependencies +In order to run your tests on LambdaTest, we refer to your `package.json` and use those dependencies and devDependencies. Since, `package.json` may contain several dependencies which may not be required to run your Cypress tests. We recommend to use `npm_dependencies` parameter to list down the required dependencies to run your test, because it will reduce your build time on LambdaTest. Below are the ways through which LambdaTest detects the dependencies which has to be installed before running the test on LambdaTest. -1. `npm_dependencies`: Inside run_settings of `lambdatest-config.json`, you can provide the list of NPM dependencies. +#### Using `npm_dependencies` +Inside `run_settings` of `lambdatest-config.json`, you can provide the list of NPM dependencies: -Example: - -```json -"npm_dependencies": { - "cypress": "9.0.0" - } +```javascript title="lambdatest-config.json" +"run_settings": { + "npm_dependencies": { + "cypress": "9.0.0", + }, +}, ``` -2. `package.json`: LambdaTest will automatically detects the dependencies that has to be installed from `package.json`. - -Example: +#### Using `package.json` +LambdaTest will automatically detects the dependencies that has to be installed from `package.json`. -```json +```javascript title="package.json" "devDependencies": { "cypress": "9.2.1", "eslint": "7.0.0", @@ -486,27 +385,17 @@ Example: }, ``` -:::info Note +:::tip note It's recommended to use `npm_dependencies` instead of `package.json` because `package.json` may contain the dependencies which are not actually used while running the Cypress tests and also, installing these unwanted dependencies will increase the build time. ::: - +## Specific Node Version +LambdaTest allows you to specify the Node.js version for running your tests using the ``useNodeVersion`` capability in the `run_settings` section of the `lambdatest-config.json` file. This capability provides greater flexibility and ensures compatibility with your project's dependencies and environment. +> Supported Versions are 18, 20 and 22. The exact version will be used are `18.17.1`, `20.18.0`, and `22.11.0` respectively + +```javascript title="lambdatest-config.json" +"run_settings": { + "useNodeVersion":"20" +} +``` \ No newline at end of file diff --git a/docs/sharding-espresso.md b/docs/sharding-espresso.md index 98eeccc79..36056409d 100644 --- a/docs/sharding-espresso.md +++ b/docs/sharding-espresso.md @@ -330,6 +330,22 @@ filters: This example will fetch all the test cases from 2 classes and 1 package as defined above and divide them with respect to concurrency given in the yaml file. +## Generate Reports and Artifacts +To generate artifacts for your Espresso tests, add the `artifacts: true`, and `report: true` flag in your YAML file: + +```yaml +report: true +framework: + name: "android/espresso" + args: + artifacts: true + ...// +``` + +To download these artifacts in your local machine, you can pass the `--download-artifacts` and `--download-report` flag with the CLI command to execute the tests as shown in the next step. + +> Learn more about it in the [HyperExecute Espresso Documentation](https://www.lambdatest.com/support/docs/hyperexecute-espresso-testing/) + ## Additional Links ---