Test.page Method

Specifies the page where the test starts.

test.page( url ) → this
test.page `url` → this
Parameter Type Description
url String The URL of the webpage at which the test starts.

You can also use the fixture.page function to specify a start page for all tests in the fixture. However, start pages set with test.page override fixture.page.

fixture `MyFixture`
    .page `http://devexpress.github.io/testcafe/example`;

test
    .page `http://devexpress.github.io/testcafe/blog/`
    ('My test', async t => {
        // Starts at http://devexpress.github.io/testcafe/blog/
    });

If the start page is not specified, the default URL is about:blank.

You can use the file URI scheme or relative paths to test web pages in local and network directories.

test
    .page `file://NETWORK-LOCATION/my-website/index.html`
    ('My test', async t => { });

For local files omit the hostname:

test
    .page `file:///user/my-website/index.html`
    ('My test', async t => { });

Relative paths are resolved against a file with tests:

test
    .page `../my-project/index.html`
    ('My test', async t => { });