Skip to main content

ProtractorParam

Returns a Protractor configuration parameter specified in protractor.conf.js and identified by name. Protractor configuration parameters can be overridden via the command line.

Warning: this question is Protractor-specific, so using it in your tests will reduce their portability across test integration tools.

// protractor.conf.js
exports.config = {
params: {
login: {
username: 'jane@example.org'
password: process.env.PASSWORD
}
}
// ...
}

Overriding configuration parameter using the command line

npx protractor ./protractor.conf.js --params.login.username="bob@example.org"

Using as QuestionAdapter

import { actorCalled } from '@serenity-js/core'
import { BrowseTheWebWithProtractor, ProtractorParam } from '@serenity-js/protractor'
import { Enter } from '@serenity-js/web'
import { protractor } from 'protractor'

await actorCalled('Jane')
.whoCan( BrowseTheWebWithProtractor.using(protractor.browser))
.attemptsTo(
Enter.theValue(ProtractorParam.called('login').username).into(Form.exampleInput),
)

Specifying path to param as string

import { actorCalled } from '@serenity-js/core'
import { BrowseTheWebWithProtractor, ProtractorParam } from '@serenity-js/protractor'
import { Enter } from '@serenity-js/web'
import { protractor } from 'protractor

await actorCalled('Jane')
.whoCan(BrowseTheWebWithProtractor.using(protractor.browser))
.attemptsTo(
Enter.theValue(ProtractorParam.called('login.username')).into(Form.exampleInput),
);

Learn more

Index

Constructors

Methods

Constructors

constructor

Methods

staticcalled

  • called<Return_Type>(name: Answerable<string>): QuestionAdapter<Return_Type>
  • Name of the parameter to retrieve. This could also be a dot-delimited path, e.g. login.username


    Type parameters

    • Return_Type

    Parameters

    • name: Answerable<string>

    Returns QuestionAdapter<Return_Type>