File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed
packages/trace-viewer/src/ui Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -223,7 +223,7 @@ function mergeActionsAndUpdateTimingSameTrace(contexts: ContextEntry[]) {
223
223
// library context actions.
224
224
// - In the older versions the step id is not stored and the match is perfomed based on
225
225
// action name and wallTime.
226
- const matchByStepId = libraryContexts . some ( c => c . actions . some ( a => ! ! a . stepId ) ) ;
226
+ const matchByStepId = ! libraryContexts . length || libraryContexts . some ( c => c . actions . some ( a => ! ! a . stepId ) ) ;
227
227
228
228
for ( const context of libraryContexts ) {
229
229
for ( const action of context . actions ) {
Original file line number Diff line number Diff line change @@ -1118,6 +1118,39 @@ test('trace:retain-on-first-failure should create trace if request context is di
1118
1118
expect ( result . failed ) . toBe ( 1 ) ;
1119
1119
} ) ;
1120
1120
1121
+ test ( 'should not corrupt actions when no library trace is present' , async ( { runInlineTest } ) => {
1122
+ const result = await runInlineTest ( {
1123
+ 'a.spec.ts' : `
1124
+ import { test as base, expect } from '@playwright/test';
1125
+ const test = base.extend({
1126
+ foo: async ({}, use) => {
1127
+ expect(1).toBe(1);
1128
+ await use();
1129
+ expect(2).toBe(2);
1130
+ },
1131
+ });
1132
+ test('fail', async ({ foo }) => {
1133
+ expect(1).toBe(2);
1134
+ });
1135
+ ` ,
1136
+ } , { trace : 'on' } ) ;
1137
+ expect ( result . exitCode ) . toBe ( 1 ) ;
1138
+ expect ( result . failed ) . toBe ( 1 ) ;
1139
+
1140
+ const tracePath = test . info ( ) . outputPath ( 'test-results' , 'a-fail' , 'trace.zip' ) ;
1141
+ const trace = await parseTrace ( tracePath ) ;
1142
+ expect ( trace . actionTree ) . toEqual ( [
1143
+ 'Before Hooks' ,
1144
+ ' fixture: foo' ,
1145
+ ' expect.toBe' ,
1146
+ 'expect.toBe' ,
1147
+ 'After Hooks' ,
1148
+ ' fixture: foo' ,
1149
+ ' expect.toBe' ,
1150
+ 'Worker Cleanup' ,
1151
+ ] ) ;
1152
+ } ) ;
1153
+
1121
1154
test ( 'should record trace in workerStorageState' , async ( { runInlineTest } ) => {
1122
1155
test . info ( ) . annotations . push ( { type : 'issue' , description : 'https://github.com/microsoft/playwright/issues/30287' } ) ;
1123
1156
You can’t perform that action at this time.
0 commit comments