t.resizeWindow Method


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.


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:


import { Selector } from 'testcafe';

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


test('Image disappears on small screens', async t => {
    await t
        .resizeWindow(200, 100)

test('Should maximize window', async t => {
    await t