vitalets/playwright-bdd

Bug: Fixture "$scenarioHookFixtures" has unknown parameter

vitalets opened this issue · 3 comments

Given
Define two custom test instances test and test2:

export const test = base.extend<Fixtures>({
  // add your fixtures
});

export const test2 = test.extend<Fixtures>({
  myFixture: async ({}, use) => {
    await use("foo");
  },
});

export const { Given, When, Then } = createBdd(test);
export const { After } = createBdd(test2);

Use test2 only in After hook:

import { After } from "./fixtures";

After(function ({ myFixture }) {
  console.log("After", myFixture);
});

When
Run tests.

Then
Error:

Fixture "$scenarioHookFixtures" has unknown parameter "myFixture".

   at features/homepage.feature.spec.js:16

  14 | // == technical section ==
  15 |
> 16 | test.use({
     |      ^
  17 |   $test: ({}, use) => use(test),
  18 |   $uri: ({}, use) => use("features/homepage.feature"),
  19 |   $bddFileMeta: ({}, use) => use(bddFileMeta),

But I expect
No errors.

is it possible to get this in the next release?

is it possible to get this in the next release?

Yes, I'm already on it.

Currently, the workaround to use single test instance or merge them with mergeTests().