Skip to content

Provide a way to pass settings from runner to fixtures #2431

@fpoppinga

Description

@fpoppinga

Feature Request

Provide a way to pass configuration from Runner to test fixtures.

What is the current behavior?

There is no way to pass any information from the TestCafé runner to the actual tests.

What is the expected behavior?

For our use case, we want to provide different configuration from various sources to the tests on a per-execution basis. This means that e.g. configuration files as proposed here are not a viable option.

It would be great, if you could pre-fill the fixture context fixtureCtx from the TestCafé runner, like so:

const tc = await createTestCafe();
const runner = tx.createRunner();

await runner
  .src(myFiles)
  .browsers(myBrowsers)
  .fixtureContext({
    mySetting: getSomeValueSomehow()
  })
  .run();

resulting in this test fixtures:

fixture("My fixture")
  .before(fixtureCtx => {
    // fixtureCtx now equals 
    // {mySetting: ...}
  });

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions