Skip to content

[regression] 1.32 beta POMs don't work #21794

Closed

Description

Repro:

import { test, expect, Page } from '@playwright/test';

class MyPOM {
  constructor(private readonly page: Page) {}
  complexButton = this.page.locator('complex-button');
}

test('has title', async ({ page }) => {
  // make sure to add some 'a's here so the transcompilation cache is invalidated
  await page.goto('https://playwright.dev/aa');
  const myPOM = new MyPOM(page);
  await expect(myPOM.complexButton).toBeHidden();
});
    TypeError: Cannot read properties of undefined (reading 'locator')

      3 | class MyPOM {
      4 |   constructor(private readonly page: Page) {}
    > 5 |   complexButton = this.page.locator('complex-button');
        |                             ^
      6 | }
      7 |
      8 | test('has title', async ({ page }) => {

        at MyPOM (/Users/maxschmitt/Developer/tmp/pwtest070/tests/example.spec.ts:5:29)
        at /Users/maxschmitt/Developer/tmp/pwtest070/tests/example.spec.ts:10:17

Range: 6a7347f...6769a31
Good: @playwright/[email protected]
Bad: @playwright/[email protected]
a1ba675 broke it

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions