Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Jun 17, 2022
1 parent 66d2617 commit ece1746
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,7 @@ class ServerInstrumentation {
}
)

val port = UIAutomatorInstrumentation.instance.port
if (port == null) {
Logger.e("Could not start server: port is null")
return
}
val port = UIAutomatorInstrumentation.instance.port ?: throw Exception("Could not start server: port is null")

Logger.i("Starting server on port $port")

Expand Down
4 changes: 4 additions & 0 deletions packages/adb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.4

- Fix wrong order of arguments for `instrument()`

## 0.0.3

- Make it possible to pass arguments to `instrument()` method
Expand Down
2 changes: 1 addition & 1 deletion packages/adb/lib/src/adb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ Future<void> instrument({
'am',
'instrument',
'-w',
'$packageName/$intentClass',
for (final arg in arguments.entries) ...[
'-e',
arg.key,
arg.value,
],
'$packageName/$intentClass',
],
runInShell: true,
);
Expand Down
2 changes: 1 addition & 1 deletion packages/adb/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: adb
description: Simple wrapper for adb.
version: 0.0.3
version: 0.0.4
homepage: https://github.com/leancodepl/maestro

environment:
Expand Down
6 changes: 5 additions & 1 deletion packages/maestro_cli/lib/src/features/drive/adb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,16 @@ Future<void> forwardPorts(int port, {String? device}) async {
progress.complete('Forwarded ports');
}

void runServer({String? device}) {
void runServer({
required String? device,
required String port,
}) {
adb.instrument(
packageName: 'pl.leancode.automatorserver.test',
intentClass: 'androidx.test.runner.AndroidJUnitRunner',
device: device,
onStdout: log.info,
onStderr: log.severe,
arguments: {'MAESTRO_PORT': port},
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,15 @@ class DriveCommand extends Command<int> {

await adb.installApps(device: device, debug: debug);
await adb.forwardPorts(port, device: device);
adb.runServer(device: device);
adb.runServer(device: device, port: portStr);
await flutter_driver.runTestsWithOutput(
driver: driver,
target: target,
host: host,
port: portStr,
device: device,
flavor: flavor as String?,

);

return 0;
Expand Down
2 changes: 1 addition & 1 deletion packages/maestro_cli/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ packages:
name: adb
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.2"
version: "0.0.3"
analyzer:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion packages/maestro_cli/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ environment:
sdk: ">=2.16.0 <3.0.0"

dependencies:
adb: ^0.0.2
adb: ^0.0.3
ansi_styles: ^0.3.2+1
args: ^2.3.1
http: ^0.13.4
Expand Down
2 changes: 1 addition & 1 deletion packages/maestro_test/example/maestro.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[drive]
host = 'localhost'
port = 8081
port = 6969
target = 'integration_test/app_test.dart'
driver = 'test_driver/integration_test.dart'

0 comments on commit ece1746

Please sign in to comment.