“Core” Methods

Mink.defineStep(pattern, fn)

Define a new step inside Mink-Cucumber context for use in .features files.

Arguments

  1. pattern (Regex) The step regex
  2. fn (Function) The step function

Returns

(StepObject) object built by Mink

Mink.defineStep(/^I do something with "([^"]*)" input$/, function(input, cb){
  console.log('My input, input');
  cb();
});

Mink.findStep(input)

Search through all defined step inside Mink context for a matching step with input string.

Arguments

  1. input (String) the input text

Returns

(StepObject) matching step

Mink.findStep('Given I go to the homepage');

Mink.init(Cucumber, parameters)

Mink initialization method and entry point.

Arguments

  1. Cucumber (Object) cucumber runner context
  2. parameters (Object) mink configuration parameters

Returns

(Undefined)

Mink.init(cucumber, {
  driver: {
    baseUrl: 'http://my-app:3000'
    logLevel: 'silent',
    desiredCapabilities: {
      browserName: 'chrome'
    },
    port: 4444
  },
  timeout: 5000
});

Mink.manyStep(source, [callback])

Takes source text and tries to execute each line in series as Cucumber steps.

Arguments

  1. source (String | Array<String>) source text
  2. callback ((optional) Function) called when all steps are done

Returns

(Promise)

Mink.manyStep([
  'I browse "http://localhost:3000/"',
  'I am on the homepage',
  'I should be on the homepage'
], callback);

Mink.metaStep(steps, [callback])

Executes each steps in series.

Arguments

  1. steps (Array<StepObject>) steps to execute
  2. callback ((optional) Function) called when all steps are done

Returns

(Promise)

Mink.metaStep([
  {
    fn:   Ext.Navigation.browse,
    args: ['/form']
  },
  {
    fn:   Ext.Action.click,
    args: ['button[type="submit"]']
  }
], callback);

Mink.registerHooks(Cucumber, Driver)

Register Driver hooks on cucumber context.

Arguments

  1. Cucumber (Object) context
  2. Driver (Object) mink driver

Returns

(Undefined)

Mink.runStep(input, [callback])

Search and execute the step matching input string. Return the executed StepObjet.

Arguments

  1. input (String) the input text
  2. callback ((optional) Function)

Returns

(Promise)

Mink.runStep('I press ".button-missing"', function(err) {
  assert.isNull(err);
});

“Alias” Methods

Mink.Given(pattern, fn)

Alias of Mink.defineStep

Mink.Then(pattern, fn)

Alias of Mink.defineStep

Mink.When(pattern, fn)

Alias of Mink.defineStep