nanlabs / automation-seed

Automation Seed is a e2e automation framework built on top of WebdriverIO v7 and Selenium that uses Selenoid for execution
https://nanlabs.github.io/automation-seed/
MIT License
19 stars 3 forks source link
automation hacktoberfest selenium selenoid typescript wdio webdriverio webdriverio-framework

Automation Seed

[Docs](#) | [Contributing](https://github.com/nanlabs/automation-seed/blob/main/CONTRIBUTING.md)
[![Awesome](https://awesome.re/mentioned-badge.svg)](https://github.com/nanlabs/awesome-nan) [![Periodic Check][workflowbadge]][workflowurl] [![Report Deployment][deploydocsbadge]][deploydocsurl] [![License: MIT][licensebadge]][licenseurl]

This project was generated using create-awesome-node-app. DON'T USE THIS TEMPLATE AS IT! Generate yours using the command and following the options in the interactive menu. Check the docs for more information!

The Automation Seed project template is designed to expedite, simplify, and secure the automation of User Acceptance Testing. Pre-configured with Webdriver & Selenium and entirely containerized with Docker, it's a plug & play solution that saves time and eliminates the need for cumbersome setup and configuration. Plus, with no hardcoded system or user credentials, it's a more secure solution for your QA automation needs.

Motivation

Tired of dealing with outdated and sluggish QA automation frameworks? We were too. That's why we created this repository to solve some of the common pain points, including:

Features


Quickstart

You’ll need to have Node 16.13.2 or later on your local development machine (but it’s not required on the server). You can use fnm to easily switch Node versions between different projects.

$ git clone git@github.com:nanlabs/automation-seed.git
$ cd automation-seed
$ fnm use
$ yarn
$ yarn test --help

Dependencies

This installation guide assumes you have chocolatey for Windows, brew for Mac OS, or are running a Debian based Linux distro. Additionally, you should have FNM and yarn installed on your system.

Executing Tests

You can specify the suites within ./config/wdio.suites.conf.ts.

Available Scripts

Execute Suite

Example:

FIREFOX=1 yarn test:local --suite ci.periodic

Execute Spec Files

Example:

FIREFOX=1 yarn test:local --spec "./test/specs/**/*.ts"

Capabilities

You can specify the following environment variables to set the capabilities you want to use:

# Will use upto one instance of chrome, upto three instances of firefox and 2 instances of safari
# locally
CHROME=1 FIREFOX=3 SAFARI=2 yarn test:local --suite ci.periodic

# Will use upto two instances of chrome and one instance of firefox in the remote server
CHROME=2 FIREFOX=1 yarn test:remote --suite ci.periodic

Environment Variables

Example:

FIREFOX=1
BROWSER_VISIBLE=true
export FIREFOX BROWSER_VISIBLE
yarn test:local --suite ci.periodic

Remote Tests execution using Selenoid

When using the remote execution mode it is needed to provide a url and port for a running Selenium Hub. For that we hightly recommend using Selenoid.

You can give it a try locally as follows:

yarn selenoid --start --ui # access to `http://localhost:8080` to see the Selenoid Dashboard
FIREFOX=1 yarn test:remote --suite ci.periodic

you can learn more about the selenoid script by running yarn selenoid --help.

It is possible to specify another Selenium Hub with the env variables SELENIUM_HUB_HOST and SELENIUM_HUB_PORT.

CI/CD

We have different workflows that will be used on CI/CD using Github Actions. The workflows will be executed using Selenoid so it is needed to only use the yarn test:remote script inside them:

You can go to Actions to see the list of available workflows.

For example, you can use the Custom Workflow Execution to execute any specific suite on Github Actions using Selenoid:

image


Config Files

Config files are used to specify the settings for the browser, logging, reporter and other configurations. Each config is setup for a different environment with the server or local runner set and the browers to run the tests on defined.

The different configs can be found under ./config/. Each config inherits from wdio.common.conf.ts but a config property set in the main config can be overwritten in any inherited config.

Reporters

We use two different reporters in this framework. This allows to have results displayed either to the terminal used for executing tests or sent directly to GitHub Pages.

Spec

Test reporter, that prints detailed results to console and is useful for running and debugging tests locally.

Creating Tests

You can read the full documentation about how to create tests, the existing tools and design patterns we use here