microsoft/playwright-test

No more fixtures mentioned in README, no more baseFolio

srguiwiz opened this issue · 4 comments

@playwright/test 0.1101.0 looks very promising, as it addresses many points around configuration.

Until now we had followed playwright-test and folio README recommendations about using the extend method to make a chain of fixtures, also with override, init, and finally build.

Are there some principles to know or follow when migrating to the new version?

Specifically, our whole test architecture was based on a pattern as outlined here:

// in some.fixture.ts
import { folio as baseFolio } from "@playwright/test";

const builder = baseFolio.extend();

builder.page.override(async ({ page, testConfig }, runTest) => {

  // define a reusable method getMainMenu
  page.constructor.prototype.getMainMenu = async function (): Promise<null | ElementHandle> {
    await this.goto(`https://${testConfig.mainDomain}/dashboard`);
    const toolbar = this.waitForSelector(".MuiAppBar-root:has(a[href='/dashboard/preferences'])");
    // etc …
  };

export const folio = builder.build();

// in some.test.ts
await page.getMainMenu();

One developer in fixtures taught page how to do quite complex stuff that could be easily reused in tests written by others in simple invocations.

How can we now add methods like this to page?

Having a similar problem. Would like more documentation on how to migrate custom fixtures to support page object models.:
#242

Same issues...can we receive some help?

@awoloszynpetdx My issue was resolved. Short answer: more documentation coming soon. Check it out if this helps: #242

This was resolved for us by reading the information in issue #242 and adapting to the new environments. Thank you for this excellent software.