fixture Function
Declares a fixture.
fixture( fixtureName ) → this
fixture `fixtureName` → this
Parameter | Type | Description |
---|---|---|
| String | The name of the fixture. |
The fixture
function returns a Fixture object. A fixture is a group of tests with the same starting URL. Every test belongs to a fixture.
The Fixture
object offers methods that configure the following:
- The test page URL
- Custom fixture metadata
- Fixture-wide hooks
- Page caching options
- HTTP basic Authentication options
- Concurrency status
- JavaScript error handling options
fixture `Authentication tests`
.page `https://devexpress.github.io/testcafe/`
.beforeEach(async t => {
await t.click('#button');
});
To populate the fixture with tests, use the test function.
You can also import the fixture into your test file.
import { fixture } from 'testcafe';
fixture`Fixture import`
.page('https://devexpress.github.io/testcafe/example');
test('Click a button', async t => {
await t.click('#submit-button');
});