Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ jobs:
env: PKGS="dwds example webdev"
script: ./tool/travis.sh dartanalyzer_1
- stage: unit_test
name: "SDK: 2.2.1-dev.2.0; PKG: dwds; TASKS: `pub run test`"
name: "SDK: 2.2.1-dev.2.0; PKG: dwds; TASKS: `pub run test -j 1`"
dart: "2.2.1-dev.2.0"
env: PKGS="dwds"
script: ./tool/travis.sh test_0
- stage: unit_test
name: "SDK: dev; PKG: dwds; TASKS: `pub run test`"
name: "SDK: dev; PKG: dwds; TASKS: `pub run test -j 1`"
dart: dev
env: PKGS="dwds"
script: ./tool/travis.sh test_0
Expand Down
4 changes: 0 additions & 4 deletions dwds/example/hello_world/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

<head>
<script defer src="main.dart.js"></script>
<script>
window.$dartAppId = 'id-for-testing';
window.$dartAppInstanceId = 'instance-id-for-testing';
</script>
</head>

</html>
2 changes: 1 addition & 1 deletion dwds/mono_pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ stages:
- dartanalyzer: --fatal-warnings .
dart: [2.2.1-dev.2.0]
- unit_test:
- test:
- test: -j 1
22 changes: 16 additions & 6 deletions dwds/test/test_context.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:dwds/service.dart';
import 'package:dwds/src/chrome_proxy_service.dart';
import 'package:dwds/src/helpers.dart';
import 'package:dwds/service.dart';
import 'package:http/http.dart' as http;
import 'package:test/test.dart';
import 'package:webdriver/io.dart';
Expand Down Expand Up @@ -36,12 +37,18 @@ class TestContext {
webdev.stderr
.transform(const Utf8Decoder())
.transform(const LineSplitter())
.listen(printOnFailure);
await webdev.stdout
.listen(print);
var assetReadyCompleter = Completer();
webdev.stdout
.transform(const Utf8Decoder())
.transform(const LineSplitter())
.takeWhile((line) => !line.contains('$port'))
.drain();
.listen((line) {
if (line.contains('$port') && !assetReadyCompleter.isCompleted) {
assetReadyCompleter.complete();
}
printOnFailure(line);
});
await assetReadyCompleter.future;
appUrl = 'http://localhost:$port/hello_world/';
var debugPort = await findUnusedPort();
webDriver = await createDriver(desired: {
Expand Down Expand Up @@ -71,8 +78,11 @@ class TestContext {
return result.body;
};

var instanceId =
await tabConnection.runtime.evaluate(r'window.$dartAppInstanceId');

debugService = await DebugService.start(
'localhost', connection, assetHandler, 'instance-id-for-testing');
'localhost', connection, assetHandler, instanceId.value.toString());
}

Future<Null> tearDown() async {
Expand Down
4 changes: 2 additions & 2 deletions tool/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ for PKG in ${PKGS}; do
;;
test_0) echo
echo -e '\033[1mTASK: test_0\033[22m'
echo -e 'pub run test'
pub run test || EXIT_CODE=$?
echo -e 'pub run test -j 1'
pub run test -j 1 || EXIT_CODE=$?
;;
test_1) echo
echo -e '\033[1mTASK: test_1\033[22m'
Expand Down