Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Serial + Retry : Failed test is marked as flaky even if it never passes #27455

Closed
javamaniac opened this issue Oct 5, 2023 · 1 comment · Fixed by #27762
Closed

[BUG] Serial + Retry : Failed test is marked as flaky even if it never passes #27455

javamaniac opened this issue Oct 5, 2023 · 1 comment · Fixed by #27762
Assignees
Labels

Comments

@javamaniac
Copy link

System info

  • Playwright Version: [v1.38.0]
  • Operating System: [All, Windows 11, Ubuntu 20, macOS 13.2, etc.]
  • Browser: [All, Chromium, Firefox, WebKit]

Source code

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

test.describe.serial("Tests", () => {
  // Flaky test
  test("First test", () => {
    expect(Math.random()).toBeGreaterThan(0.3); // some flaky step
  });

  test("Second test", () => {
    expect(true).toEqual(false);
  });
});

Description
The second test is marked as flaky if tests are in describe.serial block with "retries: 1" settled in tests config file.

Steps
Execute the test until:

  • The second test is executed at least once and the first test failed on the last retry

Expected

  1 failed
    [chromium] › test-serial-retry.spec.ts:8:7 › Tests › Second test (Failed) ──────────
  1 passed (648ms)

Actual
If the second test is executed at least once and the first test failed on the last retry:

Running 2 tests using 1 worker

  ✓  1 [chromium] › test-serial-retry.spec.ts:4:7 › Tests › First test (21ms)
  ✘  2 [chromium] › test-serial-retry.spec.ts:8:7 › Tests › Second test (11ms)
  ✘  3 [chromium] › test-serial-retry.spec.ts:4:7 › Tests › First test (retry #1) (23ms)
  -  4 [chromium] › test-serial-retry.spec.ts:8:7 › Tests › Second test (retry #1)
...
  2 flaky
    [chromium] › test-serial-retry.spec.ts:4:7 › Tests › First test ────────────
    [chromium] › test-serial-retry.spec.ts:8:7 › Tests › Second test ──────────

If the second test is executed on the last retry:

Running 2 tests using 1 worker

  ✓  1 [chromium] › test-serial-retry.spec.ts:4:7 › Tests › First test (21ms)
  ✘  2 [chromium] › test-serial-retry.spec.ts:8:7 › Tests › Second test (11ms)
  ✓  3 [chromium] › test-serial-retry.spec.ts:4:7 › Tests › First test (retry #1) (21ms)
  ✘  4 [chromium] › test-serial-retry.spec.ts:8:7 › Tests › Second test (retry #1) (11ms)
...
  1 failed
    [chromium] › test-serial-retry.spec.ts:8:7 › Tests › Second test ──────────
  1 passed (648ms)
@javamaniac
Copy link
Author

❤️

Germandrummer92 pushed a commit to OctoMind-dev/playwright that referenced this issue Oct 27, 2023
dgozman added a commit that referenced this issue Apr 25, 2024
There are plenty of edge cases in this area:
- interrupted test run;
- did not run because of serial mode failure;
- failed before `test.skip()` call (e.g. in `beforeEach`) in one of the
retries;
- and more...

Related issues: #28322, #28321, #27455, #17652.
Prior changes: #27762, #26385, #28360, probably more.

There is still some duplication between `outcome()` and similar logic in
`base.ts`, which might be deduped in a follow-up.

Fixes #28322.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants