import {StartLocalServer} from '@serenity-js/local-server/lib/screenplay/interactions'
public class | source

StartLocalServer

Starts local server so that a test can interact with it.

Static Method Summary

Static Public Methods
public static

onOneOfThePreferredPorts(preferredPorts: Answerable<number[]>): Interaction

this method was deprecated. Use `StartLocalServer.onPort` or `StartLocalServer.onRandomPortBetween`

Instructs the Actor to start a local test server on one of the preferred ports.

public static

onPort(preferredPort: Answerable<number>): Interaction

Instructs the Actor to start a local test server on a preferredPort, or a random one if that's not available.

public static

Starts local test server on a random available ports.

public static

onRandomPortBetween(lowestPort: Answerable<number>, highestPort: Answerable<number>): Interaction

Instructs the Actor to start a local test server on a random port between lowestPort and highestPort.

Static Public Methods

public static onOneOfThePreferredPorts(preferredPorts: Answerable<number[]>): Interaction source

this method was deprecated. Use `StartLocalServer.onPort` or `StartLocalServer.onRandomPortBetween`

Instructs the Actor to start a local test server on one of the preferred ports.

Please note: this method is kept for backwards compatibility. However, its behaviour has changed and is currently identical to calling StartLocalServer.onPort with the first of preferredPorts passed as an argument.

Params:

NameTypeAttributeDescription
preferredPorts Answerable<number[]>

A list of preferred ports. Please note that only the first one will be used!

Returns:

Interaction

public static onPort(preferredPort: Answerable<number>): Interaction source

Instructs the Actor to start a local test server on a preferredPort, or a random one if that's not available.

Params:

NameTypeAttributeDescription
preferredPort Answerable<number>

preferred port

Returns:

Interaction

See:

public static onRandomPort(): Interaction source

Starts local test server on a random available ports.

Returns:

Interaction

public static onRandomPortBetween(lowestPort: Answerable<number>, highestPort: Answerable<number>): Interaction source

Instructs the Actor to start a local test server on a random port between lowestPort and highestPort.

Params:

NameTypeAttributeDescription
lowestPort Answerable<number>

Lower bound of the preferred port range

highestPort Answerable<number>

Upper bound of the preferred port range

Returns:

Interaction