Skip to content

[Feature] locator for getting an element's description #18332

@kentcdodds

Description

@kentcdodds

I'm testing an error message.

Here's what I have to do now:

  const subjectDescriptionId = await page
    .getByRole('textbox', {name: /subject/i})
    .getAttribute('aria-describedby')
  await expect(page.locator(`id=${subjectDescriptionId}`)).toHaveText(/required/i)

Here's what I'd like to be able to do:

  const subjectDescription = await page
    .getByRole('textbox', {name: /subject/i})
    .getDescription()
  await expect(subjectDescription).toHaveText(/required/i)

Thanks!

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions