Skip to content

Latest commit

 

History

History
77 lines (64 loc) · 19 KB

File metadata and controls

77 lines (64 loc) · 19 KB

playwright config

Config for projects using Playwright for testing.

🏗️ Setup

  1. If you haven't already, make sure to install @code-pushup/eslint-config and its required peer dependencies.

  2. Since this plugin requires additional peer dependencies, you have to install them as well:

    npm install -D eslint-plugin-playwright
  3. Add to your eslint.config.js file:

    import playwright from '@code-pushup/eslint-config/playwright.js';
    import { defineConfig } from 'eslint/config';
    
    export default defineConfig(...playwright);

📏 Rules (42)

🔧 Automatically fixable by the --fix CLI option.
💡 Manually fixable by editor suggestions.

🚨 Errors (11)

Plugin Rule Options Autofix Overrides
playwright missing-playwright-await
Identify false positives when async Playwright APIs are not properly awaited.
🔧
playwright no-networkidle
Prevent usage of the networkidle option
playwright no-unsafe-references
Prevent unsafe variable references in page.evaluate() and page.addInitScript()
🔧
playwright no-unused-locators
Disallow usage of page locators that are not used
playwright no-wait-for-navigation
Prevent usage of page.waitForNavigation()
💡
playwright prefer-web-first-assertions
Prefer web first assertions
🔧
playwright valid-describe-callback
Enforce valid describe() callback
playwright valid-expect
Enforce valid expect() usage
playwright valid-expect-in-promise
Require promises that have expectations in their chain to be valid
playwright valid-test-tags
Enforce valid tag format in Playwright test blocks and titles
playwright valid-title
Enforce valid titles
🔧

⚠️ Warnings (31)

Plugin Rule Options Autofix Overrides
playwright consistent-spacing-between-blocks
Enforces a blank line between Playwright test blocks (e.g., test, test.step, test.beforeEach, etc.).
🔧
playwright expect-expect
Enforce assertion to be made in a test body
playwright max-nested-describe
Enforces a maximum depth to nested describe calls
playwright no-commented-out-tests
Disallow commented out tests
playwright no-conditional-expect
Disallow calling expect conditionally
playwright no-conditional-in-test
Disallow conditional logic in tests
playwright no-duplicate-hooks
Disallow duplicate setup and teardown hooks
playwright no-element-handle
The use of ElementHandle is discouraged, use Locator instead
💡
playwright no-eval
The use of page.$eval and page.$$eval are discouraged, use locator.evaluate or locator.evaluateAll instead
playwright no-focused-test
Prevent usage of .only() focus test annotation
💡
playwright no-force-option
Prevent usage of { force: true } option.
playwright no-nested-step
Disallow nested test.step() methods
playwright no-page-pause
Prevent usage of page.pause()
playwright no-skipped-test
Prevent usage of the .skip() skip test annotation.
💡
playwright no-standalone-expect
Disallow using expect outside of test blocks
🔧
playwright no-useless-await
Disallow unnecessary awaits for Playwright methods
🔧
playwright no-useless-not
Disallow usage of 'not' matchers when a more specific matcher exists
🔧
playwright no-wait-for-selector
Prevent usage of page.waitForSelector()
💡
playwright no-wait-for-timeout
Prevent usage of page.waitForTimeout()
💡
playwright prefer-comparison-matcher
Suggest using the built-in comparison matchers
🔧
playwright prefer-equality-matcher
Suggest using the built-in equality matchers
💡
playwright prefer-hooks-in-order
Prefer having hooks in a consistent order
playwright prefer-hooks-on-top
Suggest having hooks before any test cases
playwright prefer-locator
Suggest locators over page methods
playwright prefer-native-locators
Prefer native locator functions
🔧
playwright prefer-to-be
Suggest using toBe() for primitive literals
🔧
playwright prefer-to-contain
Suggest using toContain()
🔧
playwright prefer-to-have-count
Suggest using toHaveCount()
🔧
playwright prefer-to-have-length
Suggest using toHaveLength()
🔧
playwright require-hook
Require setup and teardown code to be within a hook
playwright require-to-throw-message
Require a message for toThrow()