fix: replace no-op assertions in Playwright E2E tests - #90
Merged
Conversation
The LMS and compliance E2E tests had multiple assertions that could
never fail, giving false confidence in the test suite. This commit
fixes all three issues:
1. Course count check: changed expect(count).toBeGreaterThanOrEqual(0)
to expect(count).toBeGreaterThan(0). A count of zero means no
courses loaded - the test should catch that.
2. Enrollment test: removed the if (isVisible()) guard. The test was
silently passing when the enroll button was missing. Now uses
waitFor({ state: 'visible' }) so the test fails with a clear
timeout error if no enroll button exists.
3. Compliance URL assertions: removed the |.*compliance.* fallback
from both URL regex patterns. The old patterns matched the starting
URL /dashboard/compliance even when no navigation occurred. Now
the audit test checks for /.*audit.*/i and the policies test
checks for /.*policies.*|.*policy.*/i, which only match after
a real navigation.
Fixes #52
Collaborator
Author
|
@Senthil455 Please review this fix for #52. |
Collaborator
Author
|
Thanks for the thorough review, @Senthil455. Agreed on the timeout -- will bump to 10s if we see flakiness in CI, but 5s should be fine for now since the page and buttons are already loaded by the time those assertions run. |
Senthil455
reviewed
Jun 17, 2026
Senthil455
left a comment
Owner
There was a problem hiding this comment.
gh: Not Found (HTTP 404)
{"message":"Not Found","documentation_url":"https://docs.github.com/rest/issues/comments#get-an-issue-comment","status":"404"}
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.
Three Playwright E2E tests had assertions that could never fail, giving false confidence in CI and letting regressions slip through undetected.
Changes
1. Course catalog count (lms-workflow.spec.ts)
Changed expect(count).toBeGreaterThanOrEqual(0) to expect(count).toBeGreaterThan(0). An empty page with zero course cards would have passed the old assertion. Now it correctly fails if no courses are rendered.
2. Enrollment test (lms-workflow.spec.ts)
Removed the if (await enrollButton.isVisible()) guard that let the test silently pass when the enroll button was missing. Replaced with �wait enrollButton.waitFor({ state: 'visible', timeout: 5000 }) so the test fails with a clear timeout if no enroll button exists on the page.
3. Compliance URL assertions (compliance.spec.ts)
Fixes #52