Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

findByText still fails after adding await. #519

Closed
InduKrish opened this issue Sep 20, 2022 · 2 comments
Closed

findByText still fails after adding await. #519

InduKrish opened this issue Sep 20, 2022 · 2 comments

Comments

@InduKrish
Copy link

InduKrish commented Sep 20, 2022

This is related to ticket #513

with by getByText, the test passed, and attached is the screenshot.

   const header = await this.screen.findByTestId('erow-GroupCode-0');
    console.log(" header" + header)
    const base = this.within(header).getByText("LINEHOLDER")
    console.log("base value" + base);
    const check = this.within(header).getByText("check")
    console.log(" value " + check)
    await expect(base).toContainText(text);

Screen Shot 2022-09-20 at 10 15 18 AM

when I tried to test this findByText with await as suggested by #513, and i see the following error
const header = await this.screen.findByTestId('erow-GroupCode-0');
console.log(" header" + header)

    const base = await this.within(header).findByText("LINEHOLDER")
    console.log("base value" + base);

    const check = await this.within(header).findByText("check")
    console.log(" value " + check)

    await expect(base).toContainText(text);

Screen Shot 2022-09-20 at 10 14 50 AM

html structure:

Screen Shot 2022-09-20 at 10 23 35 AM

@jrolfs
Copy link
Member

jrolfs commented Sep 21, 2022

This is the same issue as #521, see my comment there #521 (comment):

It looks like you're attempting to click on the SVG <title /> element, which is not a visible element.

@jrolfs
Copy link
Member

jrolfs commented Sep 21, 2022

This does bring up an issue of consistency between queryBy + getBy and findBy in that the findBy queries use Playwright's waitFor and default to { state: 'visible' }, but getBy and queryBy don't check the state of the element with Playwright which is effectively equivalent to { state: 'attached' } in Playwright, I think.

This is related to #506, but I will create a separate issue specifically for the consistency issue I described above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants