0

I'm in the process of migrating some test suites from Protractor to Playwright but keep getting this error when I try to run the Playwright tests with this command:

npx playwright test --project=testProject

Error: No named projects are specified in the configuration file

Any ideas what I'm missing here?

This is what my playwright.config.ts looks like:


const config: PlaywrightTestConfig = {
  reporter: [['list'], ['html', { outputFolder: 'playwright-report' }]],
  timeout: 60000,
  use: {
    channel: 'chrome',
    headless: true,
    screenshot: 'only-on-failure',
  },

  projects: [
    {
      name: 'testProject',
      testDir: './path/to/playwright-tests',
      use: { baseURL: 'https://url.com/' },
    },
  ],
};

export default config;
snoom
  • 1
  • 2

3 Answers3

0

I moved the Playwright config to the project root folder and it seems to be working now

snoom
  • 1
  • 2
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 07 '22 at 22:24
0

I have faced the same issue and is been resolved by moving projects object in config to the starting of the object like below:

import { devices, PlaywrightTestConfig } from "@playwright/test";

const config: PlaywrightTestConfig = {
    projects:[{
        name: 'testPro',
        use: {
            baseURL: 'https://github.com/'
        }
    }],
    globalSetup: require.resolve('./global-setup'),
    use: {
        // baseURL: 'https://github.com/',
        headless: false,
        viewport: {
            width: 1700,
            height: 1000
        },
        screenshot: 'on',
        video: 'on',
        trace: 'on',
        storageState: './state.json'
    }
}
export default config;

Now just run command 'npx playwright test --project=testPro' started working as expected.

Sreenivasulu
  • 494
  • 2
  • 7
0

I have faced the same problem but it seems, I missed some part of the command, try this instead might help you too:

npx playwright test --config=playwright.config.ts --project=testProject

Hana
  • 1
  • 2