work around trace viewer limitation

This commit is contained in:
Simon Knott 2024-12-20 13:18:07 +01:00
parent 9039219e47
commit dc2d34dc8f
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC
2 changed files with 10 additions and 1 deletions

View file

@ -421,8 +421,15 @@ export class TestInfoImpl implements TestInfo {
private _attach(attachment: TestInfo['attachments'][0], stepId: string | undefined) { private _attach(attachment: TestInfo['attachments'][0], stepId: string | undefined) {
const index = this._attachmentsPush(attachment) - 1; const index = this._attachmentsPush(attachment) - 1;
if (stepId) if (stepId) {
this._stepMap.get(stepId)!.attachmentIndices.push(index); this._stepMap.get(stepId)!.attachmentIndices.push(index);
} else {
// trace viewer has no means of representing attachments outside of a step, so we create an artificial action
const callId = `attach@${++this._lastStepId}`;
this._tracing.appendBeforeActionForStep(callId, this._findLastStageStep(this._steps)?.stepId, `attach "${attachment.name}"`, undefined, []);
this._tracing.appendAfterActionForStep(callId, undefined, [attachment]);
}
this._onAttach({ this._onAttach({
testId: this.testId, testId: this.testId,
name: attachment.name, name: attachment.name,

View file

@ -426,6 +426,7 @@ test('attachments tab shows all but top-level .push attachments', async ({ runUI
- treeitem /step/: - treeitem /step/:
- group: - group:
- treeitem /attach \\"foo-attach\\"/ - treeitem /attach \\"foo-attach\\"/
- treeitem /attach \\"bar-push\\"/
- treeitem /attach \\"bar-attach\\"/ - treeitem /attach \\"bar-attach\\"/
`); `);
await page.getByRole('tab', { name: 'Attachments' }).click(); await page.getByRole('tab', { name: 'Attachments' }).click();
@ -433,6 +434,7 @@ test('attachments tab shows all but top-level .push attachments', async ({ runUI
- tabpanel: - tabpanel:
- button /foo-push/ - button /foo-push/
- button /foo-attach/ - button /foo-attach/
- button /bar-push/
- button /bar-attach/ - button /bar-attach/
`); `);
}); });