Skip to content

Commit 62d2b12

Browse files
Connor ClarkDevtools-frontend LUCI CQ
authored andcommitted
Set timeout for all SnapshotTester tests.
Bug: 449129415 Change-Id: I354a3862254d9592c4dd67cbea3149d82f2efab3 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7097518 Auto-Submit: Connor Clark <[email protected]> Reviewed-by: Paul Irish <[email protected]> Commit-Queue: Connor Clark <[email protected]>
1 parent 7b7183b commit 62d2b12

File tree

10 files changed

+22
-19
lines changed

10 files changed

+22
-19
lines changed

front_end/core/sdk/RehydratingConnection.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,11 @@ describe('RehydratingSession', () => {
193193
});
194194
});
195195

196-
describeWithEnvironment('RehydratingConnection emittance', () => {
196+
describeWithEnvironment('RehydratingConnection emittance', function() {
197197
let snapshotTester: SnapshotTester;
198198

199199
before(async () => {
200-
snapshotTester = new SnapshotTester(import.meta);
200+
snapshotTester = new SnapshotTester(this, import.meta);
201201
await snapshotTester.load();
202202

203203
// Create fake popup opener as rehydrating connection needs it.

front_end/models/ai_assistance/AiHistoryStorage.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,10 +546,10 @@ describe('AiHistoryStorage', () => {
546546
});
547547
});
548548

549-
describe('getConversationMarkdown', () => {
549+
describe('getConversationMarkdown', function() {
550550
let snapshotTester: SnapshotTester;
551551
before(async () => {
552-
snapshotTester = new SnapshotTester(import.meta);
552+
snapshotTester = new SnapshotTester(this, import.meta);
553553
await snapshotTester.load();
554554
});
555555

front_end/models/ai_assistance/agents/StylingAgent.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import * as AiAssistance from '../ai_assistance.js';
1717

1818
const {StylingAgent, AiAgent} = AiAssistance;
1919

20-
describeWithEnvironment('StylingAgent', () => {
20+
describeWithEnvironment('StylingAgent', function() {
2121
function mockHostConfig(
2222
modelId?: string, temperature?: number, userTier?: string,
2323
executionMode?: Root.Runtime.HostConfigFreestylerExecutionMode, multimodal?: boolean) {
@@ -62,7 +62,7 @@ describeWithEnvironment('StylingAgent', () => {
6262

6363
let snapshotTester: SnapshotTester;
6464
before(async () => {
65-
snapshotTester = new SnapshotTester(import.meta);
65+
snapshotTester = new SnapshotTester(this, import.meta);
6666
await snapshotTester.load();
6767
});
6868

front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describeWithLocale('PerformanceInsightFormatter', function() {
1616

1717
let snapshotTester: SnapshotTester;
1818
before(async () => {
19-
snapshotTester = new SnapshotTester(import.meta);
19+
snapshotTester = new SnapshotTester(this, import.meta);
2020
await snapshotTester.load();
2121
});
2222

front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ async function createFormatter(context: Mocha.Context|Mocha.Suite|null, name: st
2323
}
2424

2525
describeWithLocale('PerformanceTraceFormatter', function() {
26-
this.timeout(20000);
27-
2826
let snapshotTester: SnapshotTester;
2927
before(async () => {
30-
snapshotTester = new SnapshotTester(import.meta);
28+
snapshotTester = new SnapshotTester(this, import.meta);
3129
await snapshotTester.load();
3230
});
3331

front_end/models/ai_assistance/performance/AICallTree.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import {AICallTree} from '../ai_assistance.js';
1111

1212
const NODE_NAME_INDEX = 2;
1313

14-
describeWithEnvironment('AICallTree', () => {
14+
describeWithEnvironment('AICallTree', function() {
1515
let snapshotTester: SnapshotTester;
1616
before(async () => {
17-
snapshotTester = new SnapshotTester(import.meta);
17+
snapshotTester = new SnapshotTester(this, import.meta);
1818
await snapshotTester.load();
1919
});
2020

front_end/panels/ai_assistance/AiAssistancePanel.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,10 +1738,10 @@ describeWithMockConnection('AI Assistance Panel', () => {
17381738
});
17391739
});
17401740

1741-
describe('getResponseMarkdown', () => {
1741+
describe('getResponseMarkdown', function() {
17421742
let snapshotTester: SnapshotTester;
17431743
before(async () => {
1744-
snapshotTester = new SnapshotTester(import.meta);
1744+
snapshotTester = new SnapshotTester(this, import.meta);
17451745
await snapshotTester.load();
17461746
});
17471747

front_end/testing/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ To add snapshot tests to a new test file, add a before and after hook to the des
101101
```
102102
let snapshotTester: SnapshotTester;
103103
before(async () => {
104-
snapshotTester = new SnapshotTester(import.meta);
104+
snapshotTester = new SnapshotTester(this, import.meta);
105105
await snapshotTester.load();
106106
});
107107

front_end/testing/SnapshotTester.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44

55
import {SnapshotTester} from './SnapshotTester.js';
66

7-
// Started failing and blocking CfT rolls since 143.0.7447.0
8-
describe.skip('[crbug.com/449129415]: SnapshotTester', () => {
7+
describe('SnapshotTester', function() {
98
let snapshotTester: SnapshotTester;
109
before(async () => {
11-
snapshotTester = new SnapshotTester(import.meta);
10+
snapshotTester = new SnapshotTester(this, import.meta);
1211
await snapshotTester.load();
1312
});
1413

front_end/testing/SnapshotTester.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ class BaseSnapshotTester {
3737
#anyFailures = false;
3838
#newTests = false;
3939

40-
constructor(meta: ImportMeta) {
40+
constructor(context: Mocha.Suite, meta: ImportMeta) {
41+
if (context.timeout() > 0) {
42+
// The first usage of SnapshotTester in a test seems to take an extraordinary
43+
// amount of time, so let's bump the timeout for all snapshot tests.
44+
context.timeout(Math.max(context.timeout(), 45000));
45+
}
46+
4147
// out/Default/gen/third_party/devtools-frontend/src/front_end/testing/SnapshotTester.test.js?8ee4f2b123e221040a4aa075a28d0e5b41d3d3ed
4248
// ->
4349
// front_end/testing/SnapshotTester.snapshot.txt

0 commit comments

Comments
 (0)