← Back to Discord Forum

"import/prefer-default-export": "on"

Hello guys,

Is it recommended or mandatory to not set a default export on POM classes?

I've never seen any example with a default export

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

export default class CookieBanner {

  readonly banner: Locator;

  readonly acceptButton: Locator;

  readonly rejectButton: Locator;

  readonly closeButton: Locator;

  constructor(public readonly page: Page) {
    this.page = page;
    this.banner = page.locator('#banner');
    this.acceptButton = page.locator('#accept');
    this.rejectButton = page.locator('#decline');
    this.closeButton = page.locator('#close');

  async accept() {
    await this.acceptButton.click();

  async reject() {
    await this.rejectButton.click();

  async close() {
    await this.closeButton.click();

This thread is trying to answer question "Is it recommended or mandatory to not set a default export on POM classes in Playwright tests?"

1 reply

This is up to your team and design choices, I personally also like default experts!

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.