Rayrun
← Back to Discord Forum

Global setup and teardown

As explained in the doc I am trying to configure a setup and teardown test file.

It works fine only when the setup project is named "setup", any other name doesn't works, I mean it doesn't even appears in the UI.

Also the teardown for the same reason doesn't work.

Configuration:

export default defineConfig({
  testDir: './tests',
  testMatch: '**/*.@(spec|test).?(c|m)[jt]s?(x)', 
  projects: [
    {
      name: 'setup',
      testMatch: /global\.setup\.ts/,
      teardown: 'teardown',
    },
    {
      name: 'teardown',
      testMatch: /global\.teardown\.ts/,
    },
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'] },
      dependencies: ['setup'],
    },
  ],
});```

This thread is trying to answer question "Why does the setup and teardown configuration only work with specific project names and why don't they appear in the UI?"

1 reply

Ok.. it seem that they don't appear in the UI , but with headless mode and in the HTML report, I can see teardown is executed..

Related Discord Threads

TwitterGitHubLinkedIn
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 [email protected].