import {ResizeBrowserWindow} from '@serenity-js/protractor/lib/screenplay/interactions'
public class | source

ResizeBrowserWindow

Instructs the Actor to resize the browser window.

Please note that another way to set the size of the browser window is to configure it in protractor.conf.js.

See also:

Static Method Summary

Static Public Methods
public static

to(width: number, height: number): Interaction

Instantiates a version of this Interaction setting the size of the browser window to given width and height

public static

Instantiates a version of this Interaction setting the size of the browser window to maximum.

Static Public Methods

public static to(width: number, height: number): Interaction source

Instantiates a version of this Interaction setting the size of the browser window to given width and height

Params:

NameTypeAttributeDescription
width number

Desired new width of the browser window

height number

Desired new height of the browser window

Returns:

Interaction

Examples:

Setting specific window size
 import { actorCalled } from '@serenity-js/core';
 import { BrowseTheWeb, Navigate, ResizeBrowserWindow } from '@serenity-js/protractor';
 import { protractor } from 'protractor';

 actorCalled('Ventana')
     .whoCan(BrowseTheWeb.using(protractor.browser))
     .attemptsTo(
         Navigate.to('/app'),
         ResizeBrowserWindow.to(828, 1792),
     );

public static toMaximum(): Interaction source

Instantiates a version of this Interaction setting the size of the browser window to maximum.

Returns:

Interaction

Examples:

Maximising browser window
 import { actorCalled } from '@serenity-js/core';
 import { BrowseTheWeb, Navigate, ResizeBrowserWindow, Window } from '@serenity-js/protractor';
 import { Ensure, isGreaterThan } from '@serenity-js/assertions';
 import { protractor } from 'protractor';

 actorCalled('Ventana')
     .whoCan(BrowseTheWeb.using(protractor.browser))
     .attemptsTo(
         Navigate.to('/app'),
         ResizeBrowserWindow.toMaximum(),
         Ensure.that(Window.size(), property('width', isGreaterThan(1024))),
     );