Skip to main content

Eggplant Integration

The Eggplant Gateway enables Eggplant Functional to connect directly to devices hosted in the Sauce Labs Real Device Cloud. Typically, the Eggplant Gateway runs on the same machine as on which you have installed Eggplant Functional. The Eggplant Gateway and Eggplant Functional communicate using the VNC protocol (for image-based automation, usually at port 5900) and WebDriver (for Appium-driven automation, usually at port 5000).

The Eggplant Gateway will allocate a device on the Sauce Labs Real Device Cloud using the Sauce Labs API. The Eggplant Gateway connects to the Sauce Labs API using the HTTPS protocol (at port 443) and the Secure WebSockets protocol (at port 443). For more information, see Data Center Endpoints.

The communication flow is similar when running a DAI model on a Sauce Labs device. In this case, DAI connects to an instance of Eggplant Functional, which leverages the Eggplant Gateway to connect to the Sauce Labs Real Device Cloud.

Using Sauce Connect Proxy with Eggplant Gateway​

When using the Eggplant Gateway, the application under test is running on a Sauce Labs device. These devices are located in one of Sauce Labs' data centers. In certain scenarios, these applications may need to connect to corporate systems, such as UAT environments, that are not usually exposed over the public internet. In these scenarios, you can consider using Sauce Connect Proxy to provide your application with access to the corporate systems. For more information, see Sauce Connect Proxy.

You can use the Eggplant Gateway for Sauce Labs Browsers to run Eggplant Functional and Eggplant DAI tests on browsers running in the Sauce Labs cloud.

What You’ll Need

Connecting a Browser to Eggplant

To set up a connection to a browser in the Sauce Labs cloud, run the following command:

./epgw add sauce-browser \
--name <name> \
--user <user> \
--apiKey <apiKey> \
--dataCenter <dataCenter> \
--platformName <platformName> \
--browserName <browserName> \
--browserVersion <browserVersion> \
--screenResolution <screenResolution> \
--url <url>
KeyDescription
nameThe name of the connection you want to create.
userYour Sauce Labs user name. For example, awesome-user.
apiKeyYour Sauce Labs API key (also referred to as Access Key). For example, 33b6cc9e-1cba-4e1e-84d3-eb2a24f5ea28.
dataCenterThe Sauce Labs data center you want to use. For example, us-west-1 or eu-central-1.
platformNameThe platform you want to use. The default is Windows 10.
browserNameThe browser name. The default is chrome.
browserVersionThe browser version. The default is 98.
screenResolutionThe screen resolution. The default is 1400x1050.
urlThe URL to navigate to when the browser launches.

For example, to create a connection that will launch Chrome and navigate to https://www.google.com:

./epgw add sauce-browser \
--name chrome \
--user sauce_user \
--apiKey awesome_key \
--dataCenter eu-central-1 \
--browserName chrome \
--url https://www.google.com

Connecting a Browser to Eggplant Functional

To provision a browser in the Sauce Labs cloud and use it through Eggplant Functional:

  1. Start Eggplant Functional.
  2. Run epgw connect <name>, where name is the name of your Gateway connection. For example, epgw connect chrome.

Setting up a VNC and WebDriver Server

Alternatively, you can set up a VNC and WebDriver server for your browser.

  1. Run epgw vnc <name>, where name is the name of your Gateway connection. For example, epgw vnc chrome.

    The Eggplant Gateway will now provision your browser in the Sauce Labs cloud and start:

    • A VNC server at port 5900
    • A WebDriver server at port 5000
  2. Manually add your device to the connection list in Eggplant Functional.

  3. To run multiple Eggplant Gateways simultaneously, specify a custom VNC port and WebDriver port.

KeyDescription
vncPortThe custom VNC port. The Eggplant Gateway starts a VNC server at the given vncPort.
webDriverPortThe custom WebDriver port. The Eggplant Gateway starts a WebDriver server at the given webDriverPort.

For example, epgw vnc chrome --vncPort 5901 --webDriverPort 5001.

Real Devices

You can use the Eggplant Gateway for the Sauce Labs Real Device Cloud to run Eggplant Functional and Eggplant DAI tests on public and private devices running in the Sauce Labs Real Device Cloud (RDC).

note

Eggplant Functional 22.3 (or later) has built-in support for Sauce Labs devices. You do not need to use the Eggplant Gateway to connect to Sauce Labs devices using these versions of Eggplant Functional. See the Connecting to Sauce Labs Devices and Browsers for more information.

What You'll Need

Connecting a Real Device to Eggplant

To set up a connection to an RDC device, run the following command:

./epgw add sauce-device \
--name <name> \
--user <user> \
--apiKey <apiKey> \
--dataCenter <dataCenter> \
--platformName <platformName> \
--deviceName <deviceName> \
--app <app>
KeyDescription
nameThe name of the connection you want to create.
userYour Sauce Labs user name. For example, awesome-user.
apiKeyYour Sauce Labs API key (also referred to as Access Key). For example, 33b6cc9e-1cba-4e1e-84d3-eb2a24f5ea28.
dataCenterThe Sauce Labs data center you want to use. For example, us-west-1 or eu-central-1.
platformNameThe device platform you want to use (e.g., iOS or Android).
deviceNameThe name of the device you want to connect to (e.g., iPhone 8). You can use static or dynamic device allocation. For more information, see Static and Dynamic Device Allocation.
app(Optional) The app you want to launch on the device. This can be the location of your app in app storage or the URL to a remote location where your app is located. For more information, see Mobile App Storage.

For example, to create a connection that will launch the Swag Labs demo application on an iPhone 8 in the eu-central-1 data center, run the following command:

./epgw add sauce-device \
--name swaglabs-iphone8 \
--user sauce_user \
--apiKey awesome_key \
--dataCenter eu-central-1 \
--platformName iOS \
--deviceName "iPhone 8" \
--app https://github.com/saucelabs/sample-app-mobile/releases/download/2.7.1/iOS.RealDevice.SauceLabs.Mobile.Sample.app.2.7.1.ipa

Connecting a Real Device to Eggplant Functional

To connect a public or private real device to Eggplant Functional:

  1. Start Eggplant Functional.
  2. Run epgw connect <name>, where name is the name of your Gateway connection. For example, epgw connect swaglabs-iphone8.

The Eggplant Gateway will rent the device and add it to the connection list in Eggplant Functional.

Setting up a VNC and WebDriver Server

To set up a VNC and WebDriver for your server:

  1. Run epgw vnc <name>, where name is the name of your Gateway connection. For example, epgw vnc swaglabs-iphone8.

The Eggplant Gateway will rent the device and start:

  • A VNC server at port 5900
  • A WebDriver server at port 5000
  1. Manually add your device to the connection list in Eggplant Functional.
  2. To run multiple Eggplant Gateways simultaneously, specify a custom VNC port and WebDriver port.
KeyDescription
vncPortThe custom VNC port. The Eggplant Gateway starts a VNC server at the given vncPort.
webDriverPortThe custom WebDriver port. The Eggplant Gateway starts a WebDriver server at the given webDriverPort.

For example, epgw vnc swaglabs-iphone8 --vncPort 5901 --webDriverPort 5001.