### Navigate and Run Playwright Tests Source: https://docs.saucelabs.com/web-apps/automated-testing/playwright/quickstart/index Navigates into the cloned Playwright example directory and executes the sample tests using the `saucectl run` command. This assumes `saucectl` is installed and configured. ```shell cd saucectl-playwright-example saucectl run ``` -------------------------------- ### Install backtrace-go Library Source: https://docs.saucelabs.com/error-reporting/language-integrations/go/index Installs the backtrace-go library using the go get command. This is the primary step to include the Backtrace error reporting functionality in your Go project. ```go go get github.com/backtrace-labs/backtrace-go ``` -------------------------------- ### Clone Playwright Example Project (HTTPS) Source: https://docs.saucelabs.com/web-apps/automated-testing/playwright/quickstart/index Clones the `saucectl-playwright-example` repository from GitHub using the HTTPS protocol. This command requires Git to be installed. ```git git clone https://github.com/saucelabs/saucectl-playwright-example.git ``` -------------------------------- ### Basic Integration - Install Package Source: https://docs.saucelabs.com/error-reporting/language-integrations/javascript Install the @backtrace/browser SDK using npm. ```APIDOC ## Install the package ```bash $ npm install @backtrace/browser ``` ``` -------------------------------- ### Clone TestCafe Example Project (HTTPS) Source: https://docs.saucelabs.com/web-apps/automated-testing/testcafe/quickstart/index Clones the `saucectl-testcafe-example` GitHub repository using the HTTPS protocol. This command requires Git to be installed on your system. ```git git clone https://github.com/saucelabs/saucectl-testcafe-example.git ``` -------------------------------- ### Navigate to Sauce Connect Bin Directory (Windows) Source: https://docs.saucelabs.com/secure-connections/sauce-connect-4/quickstart This command navigates the command prompt to the 'bin' directory of the Sauce Connect Proxy client on a Windows system. Adjust the path based on your installation directory and version. ```batch cd C:\sc-4.9.2-win32\bin ``` -------------------------------- ### Start Sauce Connect from Zip Package Source: https://docs.saucelabs.com/secure-connections/sauce-connect-5/installation/windows/index Starts Sauce Connect using a configuration file, executed directly from the unpacked zip directory. This command is used when Sauce Connect is installed via the zip package and not through winget. ```powershell ./sauce-connect.exe run --config-file sauce-connect.yaml ``` -------------------------------- ### Install backtrace-go Library Source: https://docs.saucelabs.com/error-reporting/language-integrations/go This command installs the backtrace-go library, which is used for capturing fatal and non-fatal errors in Go applications. Ensure you have Go installed and configured correctly. ```bash go get github.com/backtrace-labs/backtrace-go ``` -------------------------------- ### Jenkins Pipeline for Playwright using saucectl Source: https://docs.saucelabs.com/dev/cli/saucectl/usage/ci/jenkins This Jenkinsfile demonstrates how to set up a Jenkins pipeline for running Playwright tests with Sauce Labs. It ensures the Sauce Labs username and access key are loaded from Jenkins credentials and then proceeds to install 'saucectl' and execute the tests using 'npx saucectl run'. The example also provides guidance on Jenkins Docker setup. ```groovy pipeline { agent any environment { SAUCE_USERNAME = credentials('sauce-username') SAUCE_ACCESS_KEY = credentials('sauce-access-key') } stages { stage('run') { steps { echo 'Run Sauce Playwright Pipeline Test' sh 'npm install saucectl' sh 'npx saucectl run' } } } } ``` -------------------------------- ### Install and Setup Morgue for Organization Creation Source: https://docs.saucelabs.com/error-reporting/advanced/coroner/server-installation Instructions for installing the 'backtrace-morgue' Node.js NPM utility and using the 'morgue setup' command to initialize an organization and admin user for the coronerd object store. Includes an example of the setup command and handling self-signed certificates with the -k flag. ```bash npm install backtrace-morgue -g ``` ```bash $ morgue setup https://coronerd.mydomain.com ``` ```bash $ morgue setup -k https://coronerd.mydomain.com ``` -------------------------------- ### Run saucectl Recordings Source: https://docs.saucelabs.com/web-apps/automated-testing/replay/quickstart/index Navigates to the `saucectl-replay-example` project directory and executes the `saucectl run` command. This command initiates the replay of the sample recording included in the project. ```bash cd saucectl-replay-example saucectl run ``` -------------------------------- ### Navigate and Run Cypress Tests Source: https://docs.saucelabs.com/web-apps/automated-testing/cypress/quickstart Navigates into the 'v1' directory of the cloned example project (suitable for Cypress 10+) and executes the sample Cypress tests using saucectl. The results will be visible in your Sauce Labs account. ```bash cd saucectl-cypress-example/v1 saucectl run ``` -------------------------------- ### Coroner Client Configuration with Self-Signed Certificates Source: https://docs.saucelabs.com/error-reporting/advanced/coroner/client-getting-started/index Example configuration for the coroner client when using self-signed certificates. This setup disables certificate verification for secure communications and defines universe and token settings. ```ini [universe] name = myuniversename write = https://:6098 read = :4097 read.ssl.enabled = true read.ssl.method = TLSv12 curl.ssl_verifyhost = false curl.ssl_verifypeer = false [token] = ``` -------------------------------- ### Create Organization and Admin User Details for Morgue Source: https://docs.saucelabs.com/error-reporting/advanced/coroner/server-installation Provides examples of the information required during the 'morgue setup' process, including the organization name (lowercase) and administrator user details such as username, email, and password. ```text Username: jdoe E-mail address: jdoe@mydomain.com Password: ************ Confirm password: ************ ``` -------------------------------- ### Start Local Virtual USB Server Source: https://docs.saucelabs.com/basics/integrations/evinced/index This command starts the local Virtual USB server. Ensure you have the `virtual-usb-client.jar` file in your current directory. The `--datacenter` flag specifies the data center to connect to, choose the one closest to you for optimal performance. ```bash java -jar virtual-usb-client.jar server --datacenter US ``` -------------------------------- ### Coroner Client Configuration with CA-Trusted Certificates Source: https://docs.saucelabs.com/error-reporting/advanced/coroner/client-getting-started/index Example configuration for the coroner client when using CA-trusted certificates for secure communication. This setup specifies the universe details and token associations for interacting with the coronerd object store. ```ini [universe] name = myuniversename write = https://:6098 read = :4097 read.ssl.enabled = true read.ssl.method = TLSv12 [token] = ``` -------------------------------- ### Clone Replay Demo Repository (SSH) Source: https://docs.saucelabs.com/web-apps/automated-testing/replay/quickstart/index Clones the `saucectl-replay-example` repository using SSH. This is an alternative to HTTPS for cloning the sample project, useful if you have SSH keys set up with GitHub. ```git git clone git@github.com:saucelabs/saucectl-replay-example.git ``` -------------------------------- ### Install and Setup morgue Utility Source: https://docs.saucelabs.com/error-reporting/advanced/coroner/server-installation/index Instructions for installing the 'morgue' command-line utility using Node.js NPM and launching its setup process. This utility is used for creating organizations and admin users for the 'coronerd' object store. ```bash npm install backtrace-morgue -g ``` ```bash $ morgue setup https://coronerd.mydomain.com ``` ```bash Username: jdoe E-mail address: jdoe@mydomain.com Password: ************ Confirm password: ************ ``` -------------------------------- ### Clone Cypress Demo Repo (HTTPS) Source: https://docs.saucelabs.com/web-apps/automated-testing/cypress/quickstart Clones the saucectl-cypress-example repository using HTTPS. This provides a sample Cypress project structure, configuration, and tests for demonstration purposes. ```bash git clone https://github.com/saucelabs/saucectl-cypress-example.git ``` -------------------------------- ### Coronerd SSL Configuration Example Source: https://docs.saucelabs.com/error-reporting/advanced/coroner/server-installation/index Example configuration snippet for coronerd specifying CA-trusted certificate paths for console, listener, and http-console services. ```json { //... "console" : { "path" : "/var/run/coronerd/coronerd.socket", "bind" : { "hostname" : "0.0.0.0", "service" : "9040" }, "backlog" : 16, "ssl" : { "certificate_chain_file" : "/etc/coronerd/ssl/chain.pem", "key" : "/etc/coronerd/ssl/key.pem" } }, //... "listener" : { "write" : { "http_bind" : [ { "hostname" : "0.0.0.0", "service" : "6097", "concurrency" : 2000 } ], "https_bind" : [ { "hostname" : "0.0.0.0", "service" : "6098", "concurrency" : 2000 } ], "threads" : 1, "ssl" : { "certificate_chain_file" : "/etc/coronerd/ssl/chain.pem", "key" : "/etc/coronerd/ssl/key.pem" } }, "read" : { "bind" : [ { "hostname" : "0.0.0.0", "service" : "4097" } ], "threads" : 1, "ssl" : { "certificate_chain_file" : "/etc/coronerd/ssl/chain.pem", "key" : "/etc/coronerd/ssl/key.pem" } }, "http-console" : { "bind" : [ { "hostname" : "0.0.0.0", "service" : "443", "concurrency" : 1000 } ], "columns" : { //... }, "threads" : 1, "ssl" : { "certificate_chain_file" : "/etc/coronerd/ssl/chain.pem", "key" : "/etc/coronerd/ssl/key.pem" } } } } ``` -------------------------------- ### Clone Replay Demo Repository (HTTPS) Source: https://docs.saucelabs.com/web-apps/automated-testing/replay/quickstart/index Clones the `saucectl-replay-example` repository using HTTPS. This provides a sample project structure, configuration file, and recording for testing purposes. ```git git clone https://github.com/saucelabs/saucectl-replay-example.git ``` -------------------------------- ### Start and Verify coronerd Service Source: https://docs.saucelabs.com/error-reporting/advanced/coroner/server-installation/index Commands to start the 'coronerd' service and verify its running status. These are essential for ensuring the service is operational before proceeding with further configuration. ```bash $ /etc/init.d/coronerd start ``` ```bash $ /etc/init.d/coronerd status ``` -------------------------------- ### Coronerd SSL Configuration Example Source: https://docs.saucelabs.com/error-reporting/advanced/coroner/server-installation Example JSON configuration for coronerd specifying certificate chain and private key paths for SSL encryption on various endpoints. ```json { //... "console" : { "path" : "/var/run/coronerd/coronerd.socket", "bind" : { "hostname" : "0.0.0.0", "service" : "9040" }, "backlog" : 16, "ssl" : { "certificate_chain_file" : "/etc/coronerd/ssl/chain.pem", "key" : "/etc/coronerd/ssl/key.pem" } }, //... "listener" : { "write" : { "http_bind" : [ { "hostname" : "0.0.0.0", "service" : "6097", "concurrency" : 2000 } ], "https_bind" : [ { "hostname" : "0.0.0.0", "service" : "6098", "concurrency" : 2000 } ], "threads" : 1, "ssl" : { "certificate_chain_file" : "/etc/coronerd/ssl/chain.pem", "key" : "/etc/coronerd/ssl/key.pem" } }, "read" : { "bind" : [ { "hostname" : "0.0.0.0", "service" : "4097" } ], "threads" : 1, "ssl" : { "certificate_chain_file" : "/etc/coronerd/ssl/chain.pem", "key" : "/etc/coronerd/ssl/key.pem" } }, "http-console" : { "bind" : [ { "hostname" : "0.0.0.0", "service" : "443", "concurrency" : 1000 } ], "columns" : { //... }, "threads" : 1, "ssl" : { "certificate_chain_file" : "/etc/coronerd/ssl/chain.pem", "key" : "/etc/coronerd/ssl/key.pem" } } } } ``` -------------------------------- ### Install Backtrace Unity SDK using OpenUPM Source: https://docs.saucelabs.com/error-reporting/platform-integrations/unity/setup This snippet shows how to install the Backtrace Unity SDK package using the openupm-cli tool. It involves installing the CLI, navigating to the Unity project directory, and then adding the specific package. This method is suitable for projects using the OpenUPM package registry. ```bash # Install openupm-cli npm install -g openupm-cli # Go to your Unity project directory cd YOUR_UNITY_PROJECT_DIR # Install the latest io.backtrace.unity package openupm add io.backtrace.unity ``` -------------------------------- ### Clone Cypress Demo Repo (SSH) Source: https://docs.saucelabs.com/web-apps/automated-testing/cypress/quickstart Clones the saucectl-cypress-example repository using SSH. This is an alternative method for cloning the sample project if you have SSH keys configured with GitHub. ```bash git clone git@github.com:saucelabs/saucectl-cypress-example.git ``` -------------------------------- ### Launch Installed App (Ruby) Source: https://docs.saucelabs.com/mobile-apps/automated-testing/appium/test-app-upgrades/index Launches a recently installed application mid-session in Ruby. This example uses the execute_script method to start an Android activity or launch an iOS app, requiring the appropriate 'intent' or 'bundleId'. ```Ruby # Android @driver.execute_script("mobile: startActivity", {"intent" => "com.saucelabs.mydemoapp.rn/.MainActivity"}) # iOS @driver.execute_script("mobile: launchApp", {"bundleId" => "com.saucelabs.mydemoapp.rn"}) ``` -------------------------------- ### Launch Installed App (JavaScript) Source: https://docs.saucelabs.com/mobile-apps/automated-testing/appium/test-app-upgrades/index Launches a recently installed application mid-session using JavaScript. This example demonstrates starting an Android activity or launching an iOS app via the 'execute' command. The 'intent' for Android and 'bundleId' for iOS are required. ```JavaScript // Android driver.execute('mobile: startActivity', {intent: 'com.saucelabs.mydemoapp.rn/.MainActivity'}); // driver.execute('mobile: launchApp', { bundleId: 'com.saucelabs.mydemoapp.rn'}); ``` -------------------------------- ### Start Sauce Connect Proxy Service (Linux) Source: https://docs.saucelabs.com/secure-connections/sauce-connect-4/proxy-tunnels/index This command starts the main Sauce Connect Proxy service unit managed by systemd. If configured correctly, this will initiate the individual proxy instances as defined. ```bash sudo systemctl start sc ``` -------------------------------- ### Launch Installed App (Java) Source: https://docs.saucelabs.com/mobile-apps/automated-testing/appium/test-app-upgrades/index Launches a recently installed application mid-session. This Java example shows how to start an Android activity or launch an iOS application using their respective identifiers. Ensure the correct bundle ID or intent is used. ```Java // Android driver.executeScript("mobile: startActivity", ImmutableMap.of("intent", "com.saucelabs.mydemoapp.rn/.MainActivity")); // iOS driver.executeScript("mobile: launchApp", ImmutableMap.of("bundleId", "com.saucelabs.mydemoapp.rn")); ``` -------------------------------- ### Navigate to Project Directory Source: https://docs.saucelabs.com/web-apps/automated-testing/testcafe/quickstart/index Changes the current directory to the root of the cloned `saucectl-testcafe-example` project. This is a prerequisite for running tests using `saucectl`. ```bash cd saucectl-testcafe-example ``` -------------------------------- ### Download and execute saucectl installer script Source: https://docs.saucelabs.com/dev/cli/saucectl/index Downloads the saucectl installation script, makes it executable, and then runs it with sudo to install saucectl to the specified binary directory. This allows for inspection of the script before execution. ```bash curl -fsSL -o get_saucectl.sh https://saucelabs.github.io/saucectl/install && \ chmod 700 get_saucectl.sh && \ sudo ./get_saucectl.sh -b /usr/local/bin ``` -------------------------------- ### Start vUSB Session with All Flags (Java) Source: https://docs.saucelabs.com/dev/cli/virtual-usb/start-session/index Starts a Virtual USB session with comprehensive configuration, including optional flags for server host, port, and tunnel identification. This example demonstrates a more advanced setup for secure and customized connections. ```bash java -jar virtual-usb-client.jar startSession \ --username $SAUCE_USERNAME \ --accessKey ab015c1e-xxxx-xxxx-xxxx-xxxxxxx \ --deviceName iPhone_XS \ --serverHost http://127.0.0.1 \ --serverPort 8080 \ --tunnelIdentifier tunnel-identifier:my-tunnel,my-owner ``` -------------------------------- ### Example: Credentials from Configuration File (CLI) Source: https://docs.saucelabs.com/dev/cli/saucectl/configure/list/index This example shows the output when Sauce Labs credentials are read from a configuration file. It displays the masked access key and specifies the path to the configuration file. ```bash Currently configured credentials: Username: Access key: ********-****-****-****-********7af7 Collected from: Configuration file(/Users//.sauce/credentials.yml) ``` -------------------------------- ### Install Backtrace Package Mirror on FreeBSD Source: https://docs.saucelabs.com/error-reporting/platform-integrations/coresnap/setup/index This command fetches and installs the Backtrace package mirror configuration file to `/etc/pkg/backtrace.conf`. Replace `` with your license number and `RELEASE` with your FreeBSD major version. This step is crucial for enabling `pkg` to access Backtrace's package repository. ```bash # fetch https://packages.backtrace.io/LICENSE/stork/freebsd/RELEASE/backtrace.conf -o /etc/pkg/backtrace.conf ``` -------------------------------- ### Launch Installed App (C#) Source: https://docs.saucelabs.com/mobile-apps/automated-testing/appium/test-app-upgrades/index Launches a recently installed application mid-session using C#. This example utilizes the ExecuteScript method to start an Android activity or launch an iOS app, specifying the 'intent' or 'bundleId' respectively. Apps must be uploaded to Sauce Storage. ```C# // Android driver.ExecuteScript("mobile: startActivity", new Dictionary { { "intent", "com.saucelabs.mydemoapp.rn/.MainActivity" } }); // iOS driver.ExecuteScript("mobile: launchApp", new Dictionary { { "bundleId", "com.saucelabs.mydemoapp.rn" } }); ``` -------------------------------- ### Sauce Connect Proxy CLI Configuration Example Source: https://docs.saucelabs.com/secure-connections/sauce-connect-5/guides/configuration/index Examples demonstrating how to run Sauce Connect Proxy using a configuration file via the command-line interface on different operating systems. ```bash ./sc run -c ~/sc/config.yml ``` ```bash sauce-connect.exe run -c %HOMEPATH%\sc\config.yml ``` -------------------------------- ### Run Appium Tests using Maven Source: https://docs.saucelabs.com/mobile-apps/automated-testing/appium/quickstart Executes Appium tests from the command line using Maven. This command cleans the project, installs dependencies, and runs the specified TestNG XML file for iOS Real Device tests in the US region. ```bash cd quickstart-appium-java mvn clean install -DtestngXmlFile=appium_ios_rdc_app_test.xml -Dregion=us ``` -------------------------------- ### Run Tests by Tag - Mock Example (GET) Source: https://docs.saucelabs.com/api-testing/on-prem/api/using-the-api A cURL example for mocking a GET request to run tests tagged with a specific identifier. Note: The provided example body in the source text seems misplaced for a GET request and is included as is. ```bash curl -X GET \ https://private-e9aac-apifortressv3.apiary-mock.com/app/api/rest/v3/6de267cd-df01-4782-8046-3seee6f4c093782/tests/tag/staging/run \ -d '{ \ "payload": "{ \"id\":\"123\" }",\ "Content-Type": "application/json",\ "params": { "server":"staging" } \ }' ``` -------------------------------- ### Clone TestCafe Example Project (SSH) Source: https://docs.saucelabs.com/web-apps/automated-testing/testcafe/quickstart/index Clones the `saucectl-testcafe-example` GitHub repository using the SSH protocol. This command requires Git and SSH access to your GitHub account to be configured. ```git git clone git@github.com:saucelabs/saucectl-testcafe-example.git ``` -------------------------------- ### Coroner Client Configuration for Unsecured Communications Source: https://docs.saucelabs.com/error-reporting/advanced/coroner/client-getting-started/index Example configuration for the coroner client when no SSL/TLS is used, enabling unsecured communication. This specifies the universe details and token associations for interacting with the coronerd object store over plain HTTP. ```ini [universe] name = myuniversename write = http://:6097 read = :4097 [token] = ``` -------------------------------- ### Static Device Allocation Example Source: https://docs.saucelabs.com/mobile-apps/automated-testing/appium/real-devices/index Specifies a particular device for testing using its unique ID. This is useful for testing features exclusive to a specific device setup. The device ID can be obtained via the Get Devices API or through the Sauce Labs app interface. ```json { "appium:deviceName": "HTC_One_M8_real" } ``` -------------------------------- ### Initialize Backtrace Unity SDK with Basic Configuration Source: https://docs.saucelabs.com/error-reporting/platform-integrations/unity/configuration Provides an example of initializing the Backtrace Unity SDK directly in C# code using essential parameters like server URL, database path, game object name, and custom attributes. This is the straightforward way to get the SDK running. ```csharp var backtraceClient = BacktraceClient.Initialize( url: serverUrl, databasePath: "${Application.persistentDataPath}/sample/backtrace/path", gameObjectName: "game-object-name", attributes: attributes); ```