I've tried to find a solution online on how to work with playwright and vaadin code but no chance. Playwright is installed in VS Code, is up and running, I have my test explorer installed and node.js. etc...
The FE that I need to automate(and I'm doing this in .ts) has vaadin code. But calling the selectors with xpath or by simple id locator doesn't work. Anybody an idea on how to do so please? This is an example for login:
import { test as setup } from '@playwright/test';
import path from 'path';
const authFile = path.join(__dirname, '../playwright/auth.setup.ts')
setup('authenticate', async ({ page }) => {
await page.goto('https://aservice.somewhere/mypage-ui/login');
await page.locator("xpath=//*[id='vaadinLoginUsername']").fill('_famname');
await page.locator("xpath=//*[id='vaadinLoginPassword']").fill('_passw');
await page.locator("xpath=//button[@part='vaadin-login-submit']").click();
await page.waitForURL('https://aservice.somewhere/mypage-ui/home');
await page.context().storageState({ path: authFile});
})
Even if I add a click() function to it, playwright debugger freezes on the first locator.
Thanks in advance!
#vaadinLoginUsernameis much cleaner and more readable than"xpath=//*[id='vaadinLoginUsername']". Regarding "playwright debugger freezes on the first locator"--does the first.fill()eventually timeout? I suggest sharing the error stack if so.