This directory contains example scripts and dependencies for the SauceCon workshop: Creating a Continuous Delivery Pipeline with Automated Testing. Use these scripts to test your Sauce Labs authentication credentials, setup your automated testing environment, try out Sauce Labs features, and complete the in-class Selenium examples. Download the zip file or clone the entire directory to your local environment.
The code in these scripts is provided on an "AS-ISβ basis without warranty of any kind, either express or implied, including without limitation any implied warranties of condition, uninterrupted use, merchantability, fitness for a particular purpose, or non-infringement. These scripts are provided for educational and demonstration purposes only, and should not be used in production. Issues regarding these scripts should be submitted through GitHub. These scripts are maintained by the Technical Services team at Sauce Labs.
In order to complete these exercises you must complete the following prerequisite installation and configuration steps:
- Install Git
- Install Node and NPM
- Install an IDE (IntelliJ, WebStorm, Atom etc.)
- Install WebDriverIO
- Setup Project
- (Optional) Install and Configure Jenkins
Git is a version control system that lets you check out code from a repository, work with that code on your own branch, and then merge that code with any changes that have been made by other developers. Git is an essential tool for distributed development teams, and is a critical component of the continuous integration/continuous development toolchain.
- Go to https://git-scm.com/downloads.
- Under Downloads, click Mac OS X.
- When the download completes, double-click the
.dmg
file open the installer package. - Double-click the installer package to begin the installation.
Security Warning
You may see a warning message that the package can't be opened because it's not from a recognized developer. If this happens, go to System Preferences > Security and Privacy Settings, and click Open Anyway.
- Click Continue for the installation, and enter your local password to authorize the installation.
- Go to https://git-scm.com/downloads
- Under Downloads, click on Windows.
- When the dialog opens asking if you want to allow the app to make changes to your device, click Yes.
- Follow the steps in the setup wizard to complete the installation. You should accept all the default settings.
NPM is the primary package manager that will help to resolve dependency issues.
- Go to https://www.npmjs.com/get-npm](https://www.npmjs.com/get-npm).
- Click the button that reads "Download Node.js and NPM.
- The site will detect which operating system you're currently running and present the requesite packages.
- Choose LTS, and open up the package to run the installer.
- Follow the prompts to complete the installation.
- To ensure NPM and Node.js installed correctly, open a terminal/shell and run the following command:
node -v npm -v
NodeJS lets you develop and deploy JavaScript applications on desktops and servers. If you which to download and install the package manually refer to the following instructions:
- Go to https://nodejs.org/en/download/.
- Under LTS, click Mac OS Installer X.
- When the download completes, double-click the
.pkg
file to open the installer - Follow the prompts to complete the installation.
- Go to https://nodejs.org/en/download/.
- Under LTS, click Windows Installer.
- When the download completes, double-click the
.msi
file to open the installer - Follow the prompts to complete the installation.
It's recommended to install and Integrated Developer Environment, or a text editor, to help manage package dependencies, interperters, and overall code execution. There are several options available, some of them are free and some require payment:
- Atom IDE free, IDE developed by GitHub.
- WebStorm free trial, paid after 30 days, developed by JetBrains.
- Komodo Edit, free, text editor, stripped down version of Komodo IDE (paid version).
- Brackets free, text editor, contains a wealth of community plugins and extensions.
In our examples we use IntelliJ Community version. IntelliJ is an integrated development environment that incorporates several tools for developing and running Java code. You will be using IntelliJ to write and edit the sample Selenium scripts used in the exercises. For these exercises you only need to download the free Community edition.
- Go to https://www.jetbrains.com/idea/
- Click Download.
- On the Downloads page, select macOS.
- Under Community, click Download.
- When the download completes, double-click the .dmg file open the installer package.
- Double-click the installer package to begin the installation.
- Drag and drop the IntelliJ icon into the Applications folder.
- Go to https://www.jetbrains.com/idea/
- Click Download.
- On the Downloads page, select Windows.
- Under Community, click Download.
- When the download completes, double-click the
.exe
file to launch the installation wizard. You should accept all the default settings.
NPM is the primary package manager that will help to resolve dependency issues.
- Go to https://www.npmjs.com/get-npm](https://www.npmjs.com/get-npm).
- Click the button that reads "Download Node.js and NPM.
- The site will detect which operating system you're currently running and present the requesite packages.
- Choose LTS, and open up the package to run the installer.
- Follow the prompts to complete the installation.
- To ensure NPM and Node.js installed correctly, open a terminal/shell and run the following command:
node -v npm -v
NodeJS lets you develop and deploy JavaScript applications on desktops and servers. If you which to download and install the package manually refer to the following instructions:
- Go to https://nodejs.org/en/download/.
- Under LTS, click Mac OS Installer X.
- When the download completes, double-click the
.pkg
file to open the installer - Follow the prompts to complete the installation.
- Go to https://nodejs.org/en/download/.
- Under LTS, click Windows Installer.
- When the download completes, double-click the
.msi
file to open the installer - Follow the prompts to complete the installation.
The GeckoDriver is Mozilla's proxy for W3C WebDriver clients that interact with Gecko-based (firefox) browsers. We use GeckoDriver to ensure we've configured Node and WebdriverIO correctly.
- Go to https://github.com/mozilla/geckodriver/releases.
- Under Assets, select and download the latest
-macos.tar.gz
release. - When the download completes, double-click the
.tar.gz
file to extract the binary - Move the
geckodriver
runtime file into your project dependency folder i.e.lib
.
- Go to https://github.com/mozilla/geckodriver/releases.
- Under Assets, select and download the latest
-win64.zip
release (select-win32.zip
for 32-bit systems). - When the download completes, double-click the
.zip
file to extract the executable - Move the
geckodriver.exe
file into your project dependency folder i.e.lib
.
- If you have internet access you can simply run the following command in an IntelliJ shell/terminal:
$ npm install geckodriver
- Then use the provided driver located in your
bin
directory.
WebDriverIO is the next gen test framework for NodeJS that's an independent implementation of the JSON Wire Protocol that wraps lower level requests into a concise syntax.
Currently NodeJS bindings are available so to install WebDriverIO you must have NPM and internet access:
$ npm install webdriverio
For more information, please refer to the WebDriverIO GitHub Page
- Create a Project Directory:
- Create a directory on your filesystem to store the project files. You can create the directory using the IDE toolbar or the command line. Below is an example of using the command line to create your project directory:
A Jenkins build server is provided during the workshop, if you wish to re-produce the setup on your local machine consult the instructions located in the ./jenkins-guides/ directory.
Additionally, if you wish to deploy and manage Jenkins via Docker containers, consult the instructions located in the ./jenkins-guides/ directory.
Fizz Buzz challenge: The goal of the workshop is to complete one or any of the following challenges.
Create function expressions for integers between 1-100. * If divisible by 3, output "Fizz" * If divisible by 5, output "Buzz" * If divisible by 3 & 5, output "FizzBuzz" * Else, print nothing or null
Print "out of range" and/or "not an integer" error messages
Allow for custom number ranges with outputs
Break into teams of three: One person is tester, one person is ops (manages Jenkins job execution), one person is developer. All individuals must stay in their own realm! The purpose is to simulate how one navigates a siloed work environment and bridge communication gagps