playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[BUG] Test mistakenly identified as flaky

Open agoldis opened this issue 1 year ago • 4 comments
trafficstars

System info

  • Playwright Version: v1.39.0
  • Operating System: All
  • Browser: All
  • Other info:

Source code

  • [x] I provided the exact source code that allows reproducing the issue locally.

Test file (self-contained)

import { expect, test } from "@playwright/test";

test.describe.configure({ mode: "serial", retries: 3 });

test("A", async ({ page }, { retry }) => {
  if (retry === 0 || retry === 2) {
    throw new Error("oh!");
  }
  if (retry === 1 || retry === 3) {
    expect(true).toBe(true);
  }
});

test("B", async ({ page }, { retry }) => {
  throw new Error("oh!");
});

Steps

  • Run the test npx playwright test
  • See both tests identified as flaky
  • CLI exit status is 0

1.39 produces the following outcome for attempts:

  • Test A: failed, passed, failed, passed
  • Test B: skipped, failed, skipped, failed

Expected

  • Test B should not be flaky, it should be failed. All the non-skipped attempts do not match the expected status - i.e. the test never produces the expected passed status.
  • CLI exit status should not be 0 to mark

Actual

  • Both tests are identified as flaky
  • CLI exit status is 0 and the CI passes

agoldis avatar Nov 24 '23 02:11 agoldis

hmm same, so bump, any news? After bump to 1.40.1 seems like it's the same case

403-html avatar Jan 02 '24 19:01 403-html

In our company we also has been affected by this (potentially related to latest serial mode switch).

Unless missing something, it seems like https://github.com/microsoft/playwright/pull/26385 was targeted towards fixing https://github.com/microsoft/playwright/issues/17652#issuecomment-1260552486 which seem to have introduced current edge case regression with serial mode.

On the other hand I read that serial mode usage is not recommended(for a different reason though).

I would rather expect that all tests that are not specifically marked as skipped(test.skip) to pass at least once before being marked as Flaky.

(I see current ticket is marked as feature, but potentially might-be regression)

@aslushnikov @dgozman - can you please confirm if this is expected behavior of how playwright tests suppose to run?

Manvel avatar Feb 22 '24 16:02 Manvel

We have a similar issue. When retry is set to > 0 its marking the test a flaky and not a failure. Even though it failed on the retry: CleanShot 2024-03-07 at 07 19 54@2x

scottwalter-nice avatar Mar 07 '24 13:03 scottwalter-nice

@mxschmitt is this considered to be a bug? Has there been any prioritization for it?

scottfwalter avatar Mar 14 '24 19:03 scottfwalter