testingplaywrightdrone.io

How to config drone to fail the Playwright pipeline only on any error on a specific browser


I have a drone pipeline that runs some Playwright tests. I also configured the Playwright to run the tests on 3 different browsers.

But I want it to only fail the pipeline when a test fails on chrome, not on the other 2 browsers, I mean if any test fails on that 2 browsers, just show the error message and not fail the pipeline.

Does anybody have such experience?


Solution

  • I fixed this problem by creating 2 different "playwright.config.ts" files.

    The 1st file uses the 1st set of browsers and the 2nd file uses the 2nd set of browsers.

    Playwright.browser1.config.ts

    ...
    use {
      projects: [
        {
          name: 'chromium',
          use: { ...devices['Desktop Chrome'] },
        },
      ],
    }
    

    Playwright.browser2.config.ts

    ...
    use {
      projects: [
        {
          name: 'firefox',
          use: { ...devices['Desktop Firefox'] },
        },
      ],
    }
    

    Then I divided the playwright test pipeline into 2 different pipelines in the drone config file.

    .drone.yml

    - name: 'E2E Tests on the 1st set of browsers'
      commands:
      - yarn playwright test --config=playwright.browser1.config.ts
    ...other related configs
    
    - name: 'E2E Tests on the 2nd set of browsers'
    failure: ignore
      commands:
      - yarn playwright test --config=playwright.browser2.config.ts
    ...other related configs