t.resizeWindow Method

Important

Make sure that your testing environment meets the necessary requirements before you add this method to your test suite.

Resizes a window to match the height and width parameters. The method is chainable.

Note

Browser windows retain their size between tests and fixtures. Reset window size at the beginning of tests if necessary.

t.resizeWindow(width, height) → this | Promise<any>
Parameter Type Description
width Number Width in pixels.
height Number Height in pixels.

See the Resize Windows section of the Test Actions guide to learn about other methods that resize windows:

Example

import { Selector } from 'testcafe';

const image = Selector('.qa-guy');

fixture`TestController.resizeWindow`
    .page`https://devexpress.github.io/testcafe/`;

test('Image disappears on small screens', async t => {
    await t
        .resizeWindow(200, 100)
        .expect(image.getStyleProperty('display')).eql('none');
});

test('Should maximize window', async t => {
    await t
        .maximizeWindow();
});