cherry-pick(#31938): chore(trace-viewer): do not shrink metadata view (#31943)

Avoids the following effect:


![image](https://github.com/user-attachments/assets/694de773-acc0-4266-87f2-eab67a3c7ce2)
This commit is contained in:
Yury Semikhatsky 2024-07-31 17:58:02 -07:00 committed by GitHub
parent ca9ddff7ca
commit 7ff46d4596
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 4 deletions

View File

@ -24,7 +24,8 @@ export const MetadataView: React.FunctionComponent<{
}> = ({ model }) => {
if (!model)
return <></>;
return <div className='metadata-view vbox'>
return <div data-testid='metadata-view' className='vbox' style={{ flexShrink: 0 }}>
<div className='call-section' style={{ paddingTop: 2 }}>Time</div>
{!!model.wallTime && <div className='call-line'>start time:<span className='call-value datetime' title={new Date(model.wallTime).toLocaleString()}>{new Date(model.wallTime).toLocaleString()}</span></div>}
<div className='call-line'>duration:<span className='call-value number' title={msToString(model.endTime - model.startTime)}>{msToString(model.endTime - model.startTime)}</span></div>

View File

@ -58,7 +58,7 @@ class TraceViewerPage {
this.stackFrames = page.getByTestId('stack-trace-list').locator('.list-view-entry');
this.networkRequests = page.getByTestId('network-list').locator('.list-view-entry');
this.snapshotContainer = page.locator('.snapshot-container iframe.snapshot-visible[name=snapshot]');
this.metadataTab = page.locator('.metadata-view');
this.metadataTab = page.getByTestId('metadata-view');
}
async actionIconsText(action: string) {

View File

@ -804,7 +804,7 @@ test('should follow redirects', async ({ page, runAndTrace, server, asset }) =>
test('should include metainfo', async ({ showTraceViewer }) => {
const traceViewer = await showTraceViewer([traceFile]);
await traceViewer.page.locator('text=Metadata').click();
const callLine = traceViewer.page.locator('.metadata-view .call-line');
const callLine = traceViewer.metadataTab.locator('.call-line');
await expect(callLine.getByText('start time')).toHaveText(/start time:[\d/,: ]+/);
await expect(callLine.getByText('duration')).toHaveText(/duration:[\dms]+/);
await expect(callLine.getByText('engine')).toHaveText(/engine:[\w]+/);

View File

@ -83,7 +83,7 @@ for (const useIntermediateMergeReport of [false] as const) {
await expect(page.getByTestId('overall-duration'), 'should contain humanized total time with at most 1 decimal place').toContainText(/^Total time: \d+(\.\d)?(ms|s|m)$/);
await expect(page.getByTestId('project-name'), 'should contain project name').toContainText('project-name');
await expect(page.locator('.metadata-view')).not.toBeVisible();
await expect(page.getByTestId('metadata-view')).not.toBeVisible();
});
test('should allow navigating to testId=test.id', async ({ runInlineTest, page, showReport }) => {