test(tabs): assert tab presence instead of guarding e2e checks#6820
Open
voidmatcha wants to merge 1 commit into
Open
test(tabs): assert tab presence instead of guarding e2e checks#6820voidmatcha wants to merge 1 commit into
voidmatcha wants to merge 1 commit into
Conversation
The issue-823 tab ordering specs wrapped their assertions in if (count > 0) guards, so a selector that matched nothing skipped the body and the test passed without asserting anything. The describe setup already waits for .nav-tabs to render, so the nav links and items are guaranteed present. Replace the guards that depend on that guaranteed state with explicit expect(...).toBeGreaterThan(0) checks so a missing tab strip now fails the test instead of passing silently. Guards over genuinely optional controls (add/remove buttons) and minimum-count paths are left untouched.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
What
The Issue #823 tab-ordering specs in e2e/issues/issue-823.spec.ts wrap their assertions in
if (count > 0) guards. When a selector matches nothing the body is skipped and the test passes
without asserting anything, which hides a real regression (for example the tab strip failing to
render). The describe setup already awaits page.waitForSelector('.nav-tabs'), so the nav links and
items those guards check are guaranteed to be present by the time the body runs.
Change
Replace the guards that depend on that guaranteed state with explicit expect(...).toBeGreaterThan(0)
assertions, so a missing tab strip now fails the test instead of passing silently. Five tests are
updated; the assertions inside each guard are preserved unchanged.
Guards left untouched on purpose:
Testing
Static review only. npm install and the Playwright e2e run were not executed in this environment due
to a time limit, so the spec was not run locally. The change uses the same expect/locator APIs
already present in the file and only converts guards into assertions.
Found while reviewing the test suite with
e2e-skills/e2e-reviewer.