chore(html): render locator.fill value (#35457)

This commit is contained in:
Simon Knott 2025-04-02 15:40:37 +02:00 committed by GitHub
parent 92c5d656ab
commit 1206ef64e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 6 deletions

View File

@ -753,14 +753,20 @@ class ArtifactsRecorder {
} }
} }
const paramsToRender = ['url', 'selector', 'text', 'key']; function paramsToRender(apiName: string) {
switch (apiName) {
case 'locator.fill':
return ['value'];
default:
return ['url', 'selector', 'text', 'key'];
}
}
function renderApiCall(apiName: string, params: any) { function renderApiCall(apiName: string, params: any) {
if (apiName === 'tracing.group') if (apiName === 'tracing.group')
return params.name; return params.name;
const paramsArray = []; const paramsArray = [];
if (params) { if (params) {
for (const name of paramsToRender) { for (const name of paramsToRender(apiName)) {
if (!(name in params)) if (!(name in params))
continue; continue;
let value; let value;

View File

@ -1169,7 +1169,7 @@ test('should report api steps', async ({ runInlineTest, server }) => {
let myPage; let myPage;
test.beforeAll(async ({ browser }) => { test.beforeAll(async ({ browser }) => {
myPage = await browser.newPage(); myPage = await browser.newPage();
await myPage.setContent('<button></button>'); await myPage.setContent('<button></button><input/>');
}); });
test('pass1', async () => { test('pass1', async () => {
@ -1178,6 +1178,9 @@ test('should report api steps', async ({ runInlineTest, server }) => {
test('pass2', async () => { test('pass2', async () => {
await myPage.click('button'); await myPage.click('button');
}); });
test('pass3', async () => {
await myPage.getByRole('textbox').fill('foo');
});
test.afterAll(async () => { test.afterAll(async () => {
await myPage.close(); await myPage.close();
@ -1197,8 +1200,11 @@ hook |After Hooks
hook |Before Hooks hook |Before Hooks
pw:api |page.click(button) @ a.test.ts:25 pw:api |page.click(button) @ a.test.ts:25
hook |After Hooks hook |After Hooks
hook | afterAll hook @ a.test.ts:28 hook |Before Hooks
pw:api | page.close @ a.test.ts:29 pw:api |locator.fill(foo) @ a.test.ts:28
hook |After Hooks
hook | afterAll hook @ a.test.ts:31
pw:api | page.close @ a.test.ts:32
hook |Before Hooks hook |Before Hooks
fixture | fixture: browser fixture | fixture: browser
pw:api | browserType.launch pw:api | browserType.launch