@ukhomeoffice/asl-functional-testing
Provides some simple wrappers for writing functional tests in wdio
Last updated 5 days ago by lennym .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @ukhomeoffice/asl-functional-testing 
SYNC missed versions from official npm registry.

ASL Functional Testing

Provides some simple wrappers for writing functional tests in wdio

Usage

Create a config file in your project with the following content:

module.exports = {
  // path to your test files
  specs: './tests/functional/specs/**/*.js',
  // the usernames and passwords for any users used in your tests
  users: {
    'username': 'password'
  },
  // the urls for your different environments
  urls: {
    local: 'http://localhost:8080',
    dev: '<dev url>',
    preprod: '<preprod url>'
  }
};

Add the following as a script to the scripts section in your package.json:

asl-test ./path/to/you/config

Run that script.

Test helpers

There is currently a single helper function defined for logging in - withUser - this will start a clean browser session, and then log you in with the user defined.

const assert = require('assert');

describe('Example tests', () => {

  it('can log in', () => {
    browser.withUser('username');
    const title = browser.getTitle();
    assert.equal(title, 'My page title');
  });

});

Screenshots

You can optionally have the test runner create a set of screenshots of particular pages of your app after completing a successful test run. To do this, add a screenshots section to your config as follows:

module.exports = {
  ...
  screenshots: {
    user: '<user to log in as>',
    urls: [
      '/',
      '/details',
      '/places'
    ],
    path: '/path/to/save/screenshots/to'
  }
};

When running tests locally then screenshots will be saved into the path specified. Alternatively they can be saved into AWS S3 by providing additional config for S3. This will save the screenshots for each test run in a subdirectory in S3 corresponding to the test run.

module.exports = {
  ...
  screenshots: {
    user: '<user to log in as>',
    urls: [
      ...
    ],
    s3: {
      region: 'eu-west-2',
      bucket: 'asl-screenshots',
      prefix: 'my-service',
      accessKey: process.env.AWS_ACCESS_KEY,
      secret: process.env.AWS_SECRET
    }
  }
};

Current Tags

  • 2.4.2                                ...           latest (5 days ago)

30 Versions

  • 2.4.2                                ...           5 days ago
  • 2.4.1                                ...           a month ago
  • 2.4.0                                ...           a month ago
  • 2.3.2                                ...           a month ago
  • 2.3.1                                ...           a month ago
  • 2.3.0                                ...           2 months ago
  • 2.2.0                                ...           2 months ago
  • 2.1.1                                ...           2 months ago
  • 2.1.0                                ...           2 months ago
  • 2.0.3                                ...           2 months ago
  • 2.0.2                                ...           2 months ago
  • 2.0.1                                ...           2 months ago
  • 2.0.0                                ...           2 months ago
  • 1.2.15                                ...           3 months ago
  • 1.2.14                                ...           3 months ago
  • 1.2.13                                ...           6 months ago
  • 1.2.12                                ...           9 months ago
  • 1.2.11                                ...           9 months ago
  • 1.2.9                                ...           9 months ago
  • 1.2.8                                ...           9 months ago
  • 1.2.7                                ...           9 months ago
  • 1.2.6                                ...           9 months ago
  • 1.2.5                                ...           9 months ago
  • 1.2.4                                ...           a year ago
  • 1.2.1                                ...           a year ago
  • 1.2.0                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 26
Last Day 0
Last Week 26
Last Month 57
Dependencies (6)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |