Skip to content

Barokas/automation-web-1

Repository files navigation

CircleCI

Project to run WebdriverIO tests with Cucumber and brings true BDD to JavaScript. Instead of writing complicated test code that only developers can understand, Cucumber maps an ordinary language to code and allows to start with the test process in the early stages of your product development.

Quick start

  1. Clone the git repo — git clone https://github.com/airtasker/automation-web.git
  2. npm install
  3. npm run post-task

Configurations

To configure your tests, checkout the wdio.conf.js file in your test directory. It comes with a bunch of documented options you can choose from.

Environment-specific configurations

You can setup multiple configs for specific environments. Let's say you want to have a different baseUrl for your local and pre-deploy tests. Use the wdio.conf.js to set all general configs (like mochaOpts) that don't change. They act as default values. For each different environment you can create a new config with the following name scheme:

wdio.<ENVIRONMENT>.conf.js

Now you can create a specific config for your pre-deploy tests:

wdio.STAGING.conf.js

var config = require('./wdio.conf.js').config;

config.baseUrl = 'http://staging.example.com'

exports.config = config;

Your environment-specific config file will get merged into the default config file and overwrites the values you set. To run a test in a specific environment just add the desired configuration file as the first parameter:

$ wdio wdio.STAGING.conf.js

Running single feature

Sometimes its usefull to only execute a single feature file, to do so use the following command:

$ wdio --spec ./test/features/select.feature

Using tags

If you want to run only specific tests you can mark your features with tags. These tags will be placed before each feature like so:

@Tag
Feature: ...

To run only the tests with specific tag(s) use the --tags= parameter like so:

$ wdio --tags=@Tag,@AnotherTag

You can add multiple tags separated by a comma

Pending test

If you have failing or unimplemented tests you can mark them as "Pending" so they will get skipped.

// skip whole feature file
@Pending
Feature: ...

// only skip a single scenario
@Pending
Scenario: ...

Adding new steps and snippets

The predefined snippets allow you to do a lot of common things but you might need extra snippets which are better aligned with your aims. To do so you will find all step definitions in ./test/steps. They are separated in given, when and then.

You define your snippet using regular expressions. This is pretty powerful as it allows you to create complex sentences with multiple options. Everything that's within "([^"]*)?" gets captured and appended to the callback. The last argument is always a callback function that you need to call when your step is done. You can access the browser and your WebdriverIO instance with browser.

To assert values this boilerplate project comes with a Chai integration.

Comments

You can add additional descriptive comments in your feature files.

###
  This is a
  block comment
###
Feature: As a bystander
    I can watch bottles falling from a wall
    So that I can be mildly amused

# This is a single line comment
Scenario: check if username is present
    Given I login as "roboter" with password "test123"
    Then the username "roboter" should be present in the header

Given steps

todo

Then steps

todo

When steps

todo

Start Airtasker

cd ~/repos/airtasker-web gulp -l ~/repos/airtasker-web/build/airtasker/start.sh

About

Web Automation Framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published