playwrightplaywright-testelectron-vue

PlayWright: Page.title() returning empty value. Trying to add automation in electron-vue project


For automated testing, I'm attempting to incorporate Playwright into my electron-vue project. I run the test, and Page.title() returns "". Here is the code:

test("renders the screen splash", async () => {
  let page: Page;
  page = await electronApp.firstWindow();
  console.log("Title: ", await page.title());
  const title = await page.title()
  expect(title).toBe('Splash')
});

Solution

  • Could you try if it helps?

        test("renders the screen splash", async () => {
          let page: Page;
          page = await electronApp.firstWindow();
          // add the following line
          await page.waitForLoadState();
          console.log("Title: ", await page.title());
          const title = await page.title()
          expect(title).toBe('Splash')
        });