Repository navigation
fix: Refactor Playwright tests for media type validation - #2210
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors Playwright tests for media type validation to address test failures caused by brittle string matching. The changes improve test robustness by using partial string matching instead of exact matching, and implement a centralized cleanup mechanism using test.afterEach.
Key changes:
- Replaced exact string matching with multiple partial assertions to make tests resilient to format variations
- Introduced a
selectorToResettracking variable andtest.afterEachhook for centralized test cleanup - Fixed spelling errors in test descriptions ("disbale" → "disabling") and variable naming (
video→musicin the music test)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| test("Validate photo type by disbale it and check pop up", async ({admin }) => { | ||
| await backend.disableAnySettingAndSave("//label[@for='rtm-form-checkbox-11']"); | ||
|
|
||
| test.afterEach(async ({ admin }) => { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| test("Validate photo type by disbale it and check pop up", async ({admin }) => { | ||
| await backend.disableAnySettingAndSave("//label[@for='rtm-form-checkbox-11']"); | ||
|
|
||
| test.afterEach(async ({ page, admin }) => { |
There was a problem hiding this comment.
[nitpick] The page parameter is declared but never used in the afterEach hook. Consider removing it to keep the parameter list clean, as only admin is needed.
| test.afterEach(async ({ page, admin }) => { | |
| test.afterEach(async ({ admin }) => { |
The Playwright tests for the media type validation keeps failing due to incorrect strings.
This PR fixes the strings and makes the validation robust.