Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ukhomeoffice/asl-functional-testing

Package Overview
Dependencies
Maintainers
9
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ukhomeoffice/asl-functional-testing

Provides some simple wrappers for writing functional tests in wdio

  • 2.14.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
9
Weekly downloads
 
Created
Source

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
    }
  }
};

FAQs

Package last updated on 04 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc