Skip to content

Feature request: support project dependencies #28

@catgoose

Description

@catgoose

Using Neovim 0.10 and playwright 1.44.1

I select 'chromium' using NeotestPlaywrightProject then try to run playwright tests:

image
image

My lazy.nvim config:

return {
  "nvim-neotest/neotest",
  dependencies = {
    "nvim-neotest/nvim-nio",
    "nvim-lua/plenary.nvim",
    "antoinemadec/FixCursorHold.nvim",
    "nvim-treesitter/nvim-treesitter",
    "marilari88/neotest-vitest",
    "thenbe/neotest-playwright",
  },
  config = function()
    require("neotest").setup({
      adapters = {
        require("neotest-vitest")({
          filter_dir = function(name)
            return name ~= "node_modules" and name ~= "e2e"
          end,
        }),
        require("neotest-playwright").adapter({
          options = {
            persist_project_selection = true,
            enable_dynamic_test_discovery = true,
            is_test_file = function(file_path)
              return string.match(file_path, "e2e/tests")
            end,
          },
        }),
      },
      consumers = {
        playwright = require("neotest-playwright.consumers").consumers,
      },
    })
  end,
  cmd = {
    "Neotest",
    "NeotestPlaywrightProject",
    "NeotestPlaywrightPreset",
    "NeotestPlaywrightRefresh",
  },
  keys = {
    m("<leader>m", "Neotest summary"),
    m("<leader>n", "Neotest run file"),
  },
}

My playwright.config.ts

...
  reporter: ci
    ? [['list', { printSteps: true }]]
    : [
        ['html', { outputFolder: 'e2e/report' }],
        ['json', { outputFile: 'e2e/test-results.json' }],
      ],
  use: {
    actionTimeout: 0,
    baseURL,
    trace: 'on-first-retry',
    headless: true,
  },
  outputDir: 'e2e/test-results',
  projects: [
    {
      name: 'setup',
      testMatch: msalEnabled ? /.*\.setup\.ts/ : undefined,
    },
    {
      name: 'chromium',
      use: {
        ...devices['Desktop Chrome'],
        storageState: 'e2e/.auth/user.json',
      },
      dependencies,
    },
    {
      name: 'firefox',
      use: {
        ...devices['Desktop Firefox'],
        storageState: 'e2e/.auth/user.json',
      },
      dependencies,
    },
    {
      name: 'webkit',
      use: {
        ...devices['Desktop Safari'],
        storageState: 'e2e/.auth/user.json',
      },
      dependencies,
    },
  ],
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions