Skip to content

Commit 8e926c0

Browse files
authored
Fix flaky CI tests (#1848)
1 parent 80f8671 commit 8e926c0

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

dwds/test/debug_extension_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// When run locally this test may require a manifest key. This makes it easy to
66
// just skip it.
77
@Tags(['extension'])
8-
@Timeout(Duration(seconds: 60))
8+
@Timeout(Duration(minutes: 2))
99
@OnPlatform({
1010
'windows': Skip('https://github.com/dart-lang/webdev/issues/711'),
1111
})

dwds/test/devtools_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
@Skip('https://github.com/dart-lang/webdev/issues/1845 - Move to cron job.')
56
@Timeout(Duration(minutes: 5))
67
@TestOn('vm')
78
import 'dart:io';

dwds/test/fixtures/context.dart

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,28 @@ class TestContext {
114114

115115
NullSafety nullSafety;
116116

117+
late String dwdsDirectory;
118+
117119
TestContext({
118120
String? directory,
119121
String? entry,
120122
this.nullSafety = NullSafety.sound,
121123
this.path = 'hello_world/index.html',
122124
this.pathToServe = 'example',
123125
}) {
126+
final pathParts = p.split(p.current);
127+
assert(pathParts.contains('dwds'));
128+
dwdsDirectory = p.joinAll(
129+
pathParts.sublist(0, pathParts.indexOf('dwds') + 1),
130+
);
124131
final defaultPackage =
125132
nullSafety == NullSafety.sound ? '_testSound' : '_test';
126133
final defaultDirectory = p.join('..', 'fixtures', defaultPackage);
127134
final defaultEntry = p.join('..', 'fixtures', defaultPackage, 'example',
128135
'append_body', 'main.dart');
129136

130-
workingDirectory = p.normalize(
131-
p.absolute(p.relative(directory ?? defaultDirectory, from: p.current)));
137+
workingDirectory = p.normalize(p.absolute(
138+
p.relative(directory ?? defaultDirectory, from: dwdsDirectory)));
132139

133140
DartUri.currentDirectory = workingDirectory;
134141

@@ -138,7 +145,7 @@ class TestContext {
138145
p.toUri(p.join(workingDirectory, '.dart_tool/package_config.json'));
139146

140147
final entryFilePath = p.normalize(
141-
p.absolute(p.relative(entry ?? defaultEntry, from: p.current)));
148+
p.absolute(p.relative(entry ?? defaultEntry, from: dwdsDirectory)));
142149

143150
_logger.info('Serving: $pathToServe/$path');
144151
_logger.info('Project: $_projectDirectory');
@@ -423,6 +430,12 @@ class TestContext {
423430
}
424431
}
425432

433+
String absoluteDwdsPath(String relativePath) =>
434+
p.normalize(p.absolute(p.relative(
435+
relativePath,
436+
from: dwdsDirectory,
437+
)));
438+
426439
Future<void> startDebugging() async {
427440
debugConnection = await testServer.dwds.debugConnection(appConnection);
428441
_webkitDebugger = WebkitDebugger(WipDebugger(tabConnection));

dwds/test/package_uri_mapper_test.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ import 'package:file/local.dart';
1111
import 'package:path/path.dart' as p;
1212
import 'package:test/test.dart';
1313

14+
import 'fixtures/context.dart';
15+
16+
final testContext = TestContext();
17+
1418
void main() {
1519
for (final useDebuggerModuleNames in [true, false]) {
1620
group(
@@ -28,11 +32,11 @@ void main() {
2832
final resolvedPath =
2933
'/webdev/fixtures/_testPackageSound/lib/test_library.dart';
3034

31-
final testPackageSoundPath = p.normalize(p.absolute(p.join(
35+
final testPackageSoundPath = testContext.absoluteDwdsPath(p.join(
3236
'..',
3337
'fixtures',
3438
'_testPackageSound',
35-
)));
39+
));
3640

3741
final packageConfigFile = Uri.file(p.join(
3842
testPackageSoundPath,

0 commit comments

Comments
 (0)