Skip to main content

externalEnter

Instructs an actor who has the ability to BrowseTheWeb to enter a value into a form input field.

Example widget

<form>
<input type="text" name="example" id="example" />
</form>

Lean Page Object describing the widget

import { By, PageElement } from '@serenity-js/web'

class Form {
static exampleInput = () =>
PageElement.located(By.id('example'))
.describedAs('example input')
}

Entering the value into a form field

import { actorCalled } from '@serenity-js/core';
import { Enter } from '@serenity-js/web';

await actorCalled('Esme')
.attemptsTo(
Enter.theValue('Hello world!').into(Form.exampleInput()),
)

Handling sensitive information

By design, any data handled by an actor appears in Serenity/JS reports. To prevent the exposure of any sensitive information, such as passwords or tokens, you should use Masked.

import { actorCalled, Masked } from '@serenity-js/core'
import { Enter } from '@serenity-js/web'

await actorCalled('Esme')
.attemptsTo(
Enter.theValue(Masked.valueOf('your little secret').into(Form.exampleInputField()),
)

// Gets reported as: "Esme enters [a masked value] into the example input field"

Learn more

Hierarchy

Index

Methods

staticexternaltheValue

externalinstantiationLocation

  • instantiationLocation(): FileSystemLocation
  • Returns the location where this Activity was instantiated.


    Returns FileSystemLocation

externaldescribedBy

  • Resolves the description of this object in the context of the provided actor.


    Parameters

    Returns Promise<string>

externaltoString

  • toString(): string
  • Returns a human-readable description of this object.


    Returns string

externalperformAs