Copilot commented on code in PR #3309:
URL: https://github.com/apache/apisix-dashboard/pull/3309#discussion_r2897864126
##########
e2e/tests/consumer_groups.crud-all-fields.spec.ts:
##########
@@ -139,7 +139,7 @@ test('should CRUD Consumer Group with all fields', async ({
page }) => {
await consumerGroupsPom.isIndexPage(page);
// Verify consumer group exists
- await expect(page.getByRole('cell', { name: testId, exact: true
})).toBeVisible();
+ await expect(page.getByRole('cell', { name: new RegExp(`^${testId}`)
})).toBeVisible();
await expect(
Review Comment:
`new RegExp(`^${testId}`)` uses an unescaped string as a regex source, which
can lead to accidental over/under-matching if `testId` changes to include regex
metacharacters. Escape `testId` (or avoid regex entirely) to keep the test
deterministic.
##########
e2e/tests/consumer_groups.crud-required-fields.spec.ts:
##########
@@ -94,7 +94,7 @@ test('should CRUD Consumer Group with required fields', async
({ page }) => {
// Verify consumer group exists in list
await expect(
- page.getByRole('cell', { name: testId, exact: true })
+ page.getByRole('cell', { name: new RegExp(`^${testId}`) })
).toBeVisible();
Review Comment:
`new RegExp(`^${testId}`)` treats `testId` as a regex pattern; if it ever
contains regex metacharacters, the locator can match the wrong row/cell and
make the test flaky. Escape `testId` before building the regex (or use `exact:
true` with a more robust locator that ignores the copy icon).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]