Fixture.page Method
Specifies the starting URL of the tests in the fixture.
Note
The fixture.page
method may conflict with other test page URL definitions.
fixture.page( url ) → this
fixture.page `url` → this
Parameter | Type | Description |
---|---|---|
url |
String | The starting URL of the tests in the fixture, absolute or relative to the baseUrl. |
Absolute URL Example
fixture`Test structure`
.page`https://devexpress.github.io/testcafe/example`;
test('Test1', async t => {
// Starts at http://devexpress.github.io/testcafe/example
});
Use the file://
URI scheme to test locally stored web pages.
fixture`Fixture.page`
.page`file:///${path.join(__dirname, './index.html')}`;
Relative URL Example
If you set a suite-wide base URL, you can define a relative starting URL for the tests in the fixture. Relative URLs begin with the period character (.
).
For example, if your configuration file contains the following declaration:
"baseUrl": "https://devexpress.github.io/testcafe"
You can define your fixture URL as such:
fixture`Test structure`
.page`./example`;
test('Test1', async t => {
// Starts at http://devexpress.github.io/testcafe/example
});