t.maximizeWindow Method

Important

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

Resizes the browser window to fill the screen. The method is chainable.

Note

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

The t.maximizeWindow method does not trigger the browser’s full-screen mode. Use the --start-fullscreen CLI flag to enable the full-screen mode in compatible browsers.

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

t.maximizeWindow() → this | Promise<any>

Example

import { Selector } from 'testcafe';

const submitButton = Selector('#submit-button');

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

test('Submit button is displayed in full screen', async t => {
    await t
        .maximizeWindow()
        .expect(submitButton.visible).ok();
});