# Web Testing Configuration

You can configure Gondola using the gondola.json file. After creating a project, it should be located in the project root. To start web testing with Gondola, first check that the configuration in gondola.json matches the JSON below:

# Default Configuration

These are the default gondola.json settings for a Gondola-WebDriver web testing project.

{
  "tests": "./built/**/*_test.js",
  "timeout": 10000,
  "output": "./results",
  "helpers": {
    "WebDriver": {
      "url": "https://demo.gondolatest.com/",
      "browser": "chrome",
      "restart": false,
      "windowSize": "maximize",
      "smartWait": 5000,
      "timeouts": {
        "script": 60000,
        "pageLoad": 10000
      }
    },
    "Mochawesome": {}
  },
  "include": {},
  "bootstrap": false,
  "plugins": {
    "screenshotOnFail": {
      "enabled": true
    },
    "wdio": {
      "services": ["selenium-standalone"],
      "enabled": true
    }
  },
  "mocha": {
    "reporterOptions": {
      "reportDir": "results",
      "inlineAssets": true,
      "timestamp": "isoDateTime",
      "reportFilename": "gondola",
      "autoOpen": true,
      "reportPageTitle": "Gondola Test Result"
    }
  },
  "multiple": {
    "parallel": {
      "chunks": 2,
      "browsers": ["chrome", "firefox"]
    }
  },
  "name": "ts_example"
}

TIP

Gondola changes the default settings based on the project. The default settings above are typical, but may change depending on the project template.

# Common Parameters

Here is an overview of the available options:

  • tests: specifies which test will be executed when you call npm run test. The asterisk are wildcards that locate test files with the pattern *_test.js. Default value: ./built/**/*_test.js
  • timeout: the timeout for requests in milliseconds. Default value: 10000
  • output: directory to store the test results, screenshots, etc. Default value: ./results
  • helpers: specifies which helper(s) is/are enabled.
  • mocha: mocha options. You can configure your reporters here.
  • multiple: options for executing a test in multiple browser instances. Refer to Multiple Execution.
  • grep: pattern to filter tests by name
  • smartWait (optional, default: 5000) : enables SmartWait - wait an amount of time for an element to appear. Time is measured in milliseconds.
    • E.g. : Enable for 5 secs: "smartWait": 5000.
    • List of supported actions :
      • click
      • doubleClick
      • rightClick
      • mouseMove
      • swipe
      • getControlProperty
      • checkControlProperty
      • doesControlExist
      • dragAndDrop
      • enter

# Specific Configuration

# Browsers

WebDriver can be configured to run browser tests in-window, headlessly, on a remote server or in the cloud.

# Locally

By default, Gondola is configured to run WebDriver tests locally with Chrome and Firefox using Selenium Standalone Service

"plugins": {
    "wdio": {
        "services": [
            "selenium-standalone"
        ],
        "enabled": true
    }
}

Sometimes you'll want to use specifics browser driver versions. The example below demonstrates how for several browsers.

  "plugins": {
    "wdio": {
      "services": [
        "selenium-standalone"
      ],
      "seleniumArgs": {
        "drivers": {
          "chrome": {
            "version": "81.0.4044.69"
          },
          "firefox": {
            "version": "0.26.0"
          }
        }
      },
      "seleniumInstallArgs": {
        "drivers": {
          "chrome": {
            "version": "81.0.4044.69"
          },
          "firefox": {
            "version": "0.26.0"
          }
        }
      },
      "enabled": true
    }
  }

You can find browser driver versions here:

You can use the following settings in gondola.json to choose which browser to use for testing.

Chrome

"WebDriver": {
    "url": "https://demo.gondolatest.com/",
    "browser": "chrome",
    "restart": false,
    "windowSize": "maximize",
    "smartWait": 5000
}

Headless Chrome

"WebDriver": {
    "url": "https://demo.gondolatest.com/",
    "browser": "chrome",
    "restart": false,
    "windowSize": "maximize",
    "smartWait": 5000,
    "desiredCapabilities": {
        "chromeOptions": {
            "args": [ "--headless", "--disable-gpu", "--no-sandbox" ]
        }
    }
}

Firefox

"WebDriver": {
    "url": "https://demo.gondolatest.com/",
    "browser": "firefox",
    "restart": false,
    "windowSize": "maximize",
    "smartWait": 5000
}

Microsoft Edge On Windows

  • The Microsoft Edge driver must be installed manually. Links to all the Edge selenium drivers are available here
  • Unzip and copy msedgedriver.exe to any path on your hard drive.
  • Install the webdriver-manager package and start msedgedriver.exe by running the command below:
npm i webdriver-manager
.\\node_modules\\.bin\\webdriver-manager update
.\\node_modules\\.bin\\webdriver-manager start --edge C:/path/to/msedgedriver.exe
  • Set the browser to MicrosoftEdge in your gondola.json file.
"WebDriver": {
    "url": "https://demo.gondolatest.com/",
    "browser": "MicrosoftEdge",
    "restart": false,
    "windowSize": "maximize",
    "smartWait": 5000
}

Safari on MAC OS

"WebDriver": {
    "url": "https://demo.gondolatest.com/",
    "browser": "safari",
    "restart": false,
    "windowSize": "maximize",
    "smartWait": 5000
}

You also need to follow the steps here to setup your system for Safari automation

# Selenium Grid

Grid allows you to

  • Scale by distributing tests on several machines (parallel execution)
  • Manage multiple environments from a central point, making it easy to run the tests against a vast combination of browsers/OS
  • Minimize the maintenance time for the grid by allowing you to implement custom hooks to leverage virtual infrastructure.

In order to setup the Selenium gird, please follow the link here. After that, you can view the status of the hub by opening a browser window and navigating to http://server:port/grid/console. Example: http://localhost:4444/grid/console

You will also need to update the following settings in gondola.json

# Chrome

"WebDriver": {
    "url": "https://demo.gondolatest.com/",
    "browser": "chrome",
    "restart": false,
    "windowSize": "maximize",
    "smartWait": 5000,
    "host":"localhost",
    "port":4444
}

# Headless Chrome

"WebDriver": {
    "url": "https://demo.gondolatest.com/",
    "browser": "chrome",
    "restart": false,
    "windowSize": "maximize",
    "smartWait": 5000,
    "host":"localhost",
    "port":4444,
    "desiredCapabilities": {
        "chromeOptions": {
            "args": [ "--headless", "--disable-gpu", "--no-sandbox" ]
        }
    }
}

# Firefox

"WebDriver": {
    "url": "https://demo.gondolatest.com/",
    "browser": "firefox",
    "restart": false,
    "windowSize": "maximize",
    "smartWait": 5000,
    "host":"localhost",
    "port":4444
}

# Cloud Providers

Gondola supports executing tests against cloud services like Sauce Labs, BrowserStack and TestingBot

To connect to Sauce Labs or BrowserStack, set the user and key parameters. Gondola will automatically know which cloud service provider to connect to.

"WebDriver": {
    "url": "https://demo.gondolatest.com/",
    "user": "YOUR_BROWSERSTACK_USER",
    "key": "YOUR_BROWSERSTACK_KEY",
    "capabilities": {
        "browserName": "chrome"
    }
}

# BrowserStack

In order to connect to BrowserStack, you will have to do the following steps

First, run the command above to install the BrowserStack Service

npm i @wdio/browserstack-service --save

Second, enable wdio plugin in plugins list and add browserstack service in gondola.json

"plugins": {
   "wdio": {
      "enabled": true,
       "services": ["browserstack"],
       "user": ... ,// browserstack username
       "key:" ... // browserstack api key
   }
}

For example

  • Option 1

    "helpers": {
            "WebDriver": {
                "url": "https://demo.gondolatest.com/",
                "browser": "chrome",
                "restart": false,
                "capabilities": {
                    "browserName": "chrome"
                }
            }
        },
        "plugins": {
            "wdio": {
                "services": [
                    "browserstack"
                ],
                "user": "YOUR_BROWSERSTACK_USER",
                "key": "YOUR_BROWSERSTACK_KEY",
                "enabled": true
            }
        }
    
  • Option 2

    "helpers": {
            "WebDriver": {
                "url": "https://demo.gondolatest.com/",
                "browser": "chrome",
                "restart": false,
                "user": "YOUR_BROWSERSTACK_USER",
                "key": "YOUR_BROWSERSTACK_KEY",
                "capabilities": {
                    "browserName": "chrome"
                }
            }
        },
        "plugins": {
            "wdio": {
                "services": [
                    "browserstack"
                ],
                "enabled": true
            }
        }
    

# SauceLabs

In order to connect to SauceLabs, you will have to do the following steps

First, run the command below to install the Sauce Service

npm i @wdio/sauce-service --save

Second, enable the wdio plugin in the plugins list and add the sauce service to gondola.json

"plugins": {
   "wdio": {
      "enabled": true,
       "services": ["sauce"],
       "user": "YOUR_SAUCELABS_USER",
       "key": "YOUR_SAUCELABS_KEY"
   }
}

# TestingBot

In order to connect to TestingBot, you will have to do the following steps

First, run the command below to install the TestingBot Service

npm i @wdio/testingbot-service --save

Second, enable the wdio plugin in plugins list and the add testingbot service to gondola.json

"plugins": {
   "wdio": {
      "enabled": true,
       "services": ["testingbot"],
       "user": "YOUR_TESTINGBOT_USER",
       "key": "YOUR_TESTINGBOT_KEY"
   }
}
Last Updated: 9/11/2020, 8:15:27 AM