Skip to main content

Get Started

tip

See the introduction to learn more about Gwen before getting started.

Setup

Choose a setup option

Use this option to add Gwen to a JS project.

System requirements

Add Gwen to your JS project and initialise

note

If you don't have a JS project, you can create one by installing node and running npm init in a new directory and use that.

Open a terminal in the root of your project and run the following commands to add Gwen as a dev dependency and initialise your project for Gwen:

Install the gwen-web package:

npm i --save-dev @gweninterpreter/gwen-web

In the scripts section of your package.json file, add the following entry:

{
"scripts": {
"gwen": "gwen"
}
}

Then, initialize Gwen in the project by running:

npm run gwen init

The init command will generate the following files and subdirectories in your project:

 /project                    # Your JS project root
├── gwen.conf # Project settings
└── /gwen
├── .gitignore # Git ignore file
├── README.md
├── /browsers # Browser settings
│ ├── chrome.conf
│ ├── edge.conf
│ ├── firefox.conf
│ ├── safari.conf
│ ├── ie.conf
│ ├── remote.conf # Remote web driver settings
│ └── README.md
├── /env # Environment settings
│ ├── local.conf
│ ├── dev.conf
│ ├── test.conf
│ └── README.md
├── /features # Features and associative meta
│ └── README.md
├── /meta # Optional common/reusable meta
│ └── README.md
└── /samples # Sample features and meta
Automatic Updates

Automatic installs and updates to the latest version of Gwen are enabled by default for JS projects. You can disable them by setting the version field in the gwenWeb section of your package.json file to a specific version.

"gwenWeb": {
"version": "3.1.3"
}

Setting it back to latest will re-enable automatic updates.

Set your default browser

Gwen is configured to use the Chrome browser by default. To change this default, amend the gwen.target.browser setting in your /project/gwen.conf file to load your preferred browser settings instead of chrome.

Amend setting

File: /project/gwen.conf

gwen {
target {
browser = "chrome" # <- Change to firefox, safari, edge, or ie
}
}

Web driver settings

Gwen has an embedded web driver manager which automatically downloads and installs native web drivers for you on most platforms. If however you need to manage this manually, see Web Driver Management and Web Settings for options.

Execute the samples

Launch Gwen

Run the following command in your project to execute the sample feature specs.

npm run gwen -- -b gwen/samples

Where:

  • The -b switch instructs Gwen to exit immediately after executing the samples. Omitting it will open the REPL Console instead of exiting.
  • samples is the directory containing the meta and feature samples to execute

Gwen CLI

A HTML evaluation report will be generated at gwen/output/reports/index.html in your project.