raptatinha / tau-introduction-to-playwright

Course Introduction to Playwright by Renata Andrade for Test Automation University
https://testautomationu.applitools.com/
128 stars 606 forks source link

Search term on playwright.dev not working when running the test #24

Open Zorry-Serafimova opened 1 year ago

Zorry-Serafimova commented 1 year ago

๐Ÿž Describe the question: I used codegen to grab the locators for the search exercise. However when I ran it from VS Code using the UI mode it successfully gets fills in the search term but it says there are no results available. my code can be found https://github.com/Zorry-Serafimova/tau-introduction-to-playwright-ts/blob/main/tests/search-test.spec.ts and the page https://github.com/Zorry-Serafimova/tau-introduction-to-playwright-ts/blob/main/pages/search-term-page.ts ๐Ÿ“ธ Screenshots/GIFs/Videos: If applicable, add screenshots to help explain your needs. test-failed-1 ๐Ÿ› Additional context: Add any other context here.

๐ŸŽก A picture of your pet or a toy or something really cool:

Zorry-Serafimova commented 1 year ago

found a workaround where i click on the no result and then back into the search box, now it brings results but the arrowdown option is not working

raptatinha commented 1 year ago

Hi @Zorry-Serafimova so sorry for the delayed response. I believe this could be an issue on Playwright itself. This repo is only for the training issues. :) Would you please report it on https://github.com/microsoft/playwright or on their discord channel: https://discord.com/servers/playwright-807756831384403968 (may be faster via discord). Thank you for getting in touch!

arickmm90 commented 1 year ago

This is still hapening to me, not working with any browser. Anyone knows why?

raptatinha commented 11 months ago

Hi @arickmm90, would you please share more details about the issue you are facing? If you could open a new issue here with your info, I'm happy to help you. Thank you!

flynnbops commented 10 months ago

I had similar issues, but not consistently. It's most likely a quirk of the playwright site search than an issue with your test.

May be worth trying a to interact with a simpler page as a comparison. e.g. do a search on google

Working sample code

I've provided a simple test implementation that seems fine for me. May be useful to you.

test.describe('Playwright search function', () => {
    test('Search for JavaScript', async ({page}) => {
        await page.goto('https://playwright.dev/');

        //Enter a search term.
        await page.getByRole('button', { name: 'Search' }).click();
        await page.getByPlaceholder('Search docs').fill("JavaScript");

        // Choose a search result.
        await page.getByRole('link', { name: 'Introductionโ€‹ Evaluating JavaScript' }).click();

        //Simple assertion we are on the correct new page.
        await expect(page).toHaveTitle('Evaluating JavaScript | Playwright');
    });
});
coding-umr commented 4 months ago

If it is inconsistent or not getting results, it would be an issue from the playwright's website.

I am working on the search exercise and I do not see this issue.