Skip to content

Commit

Permalink
Merge branch 'master' into feature/run_process
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Nov 25, 2022
2 parents cee6922 + b1f7a5a commit d2b0542
Show file tree
Hide file tree
Showing 34 changed files with 473 additions and 645 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/patrol-prepare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
fail-fast: false
matrix:
include:
- version: 3.0.0
- channel: stable
- channel: beta
#- version: 3.0.0
#- channel: beta

defaults:
run:
Expand All @@ -42,7 +42,7 @@ jobs:
run: flutter pub get

- name: flutter test
run: flutter test
run: flutter test --coverage

- name: flutter analyze
run: flutter analyze
Expand All @@ -65,3 +65,8 @@ jobs:
- name: flutter test (example app)
working-directory: ./packages/patrol/example
run: flutter test

- name: Upload code coverage
uses: codecov/codecov-action@v3
with:
flags: patrol
18 changes: 8 additions & 10 deletions .github/workflows/patrol_cli-prepare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,13 @@ jobs:
channel: ${{ matrix.channel }}
flutter-version: ${{ matrix.version }}

# - name: Install Java
# uses: actions/setup-java@v3
# with:
# distribution: "temurin"
# java-version: "11"

# - name: Setup Android SDK
# uses: android-actions/setup-android@v2

- name: dart pub get
run: dart pub get

- name: dart test
run: dart test
run: |
dart test --coverage coverage
dart run coverage:format_coverage --lcov --in coverage --out coverage/lcov.info --report-on lib
- name: dart analyze
run: dart analyze
Expand All @@ -77,3 +70,8 @@ jobs:
cd example
patrol bootstrap --template counter
flutter analyze
- name: Upload code coverage
uses: codecov/codecov-action@v3
with:
flags: patrol_cli
28 changes: 28 additions & 0 deletions codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
coverage:
status:
project:
default:
target: auto
patrol:
target: auto
flags:
- patrol
patrol_cli:
target: auto
flags:
- patrol_cli

comment:
layout: "header, flags, files, footer"
behavior: default
require_changes: false
require_base: no
require_head: yes

flags:
patrol:
paths: ["packages/patrol"]
carryforward: true
patrol_cli:
paths: ["packages/patrol_cli"]
carryforward: true
2 changes: 1 addition & 1 deletion packages/patrol/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ build/
pubspec.lock

.vscode
coverage
/coverage
11 changes: 11 additions & 0 deletions packages/patrol/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## Unreleased

- Revamp configuration of testers, letting for more granural setup (#640):
- Rename `PatrolTestConfig` to `PatrolTesterConfig`
- Introduce `NativeAutomatorConfig`
- Introduce `HostAutomatorConfig`

## 0.7.4

- Fix minor bug with custom binding initialization (#636)

## 0.7.3

- Add `patrolIntegrationDriver`, which extends the default `integrationDriver`
Expand Down
2 changes: 0 additions & 2 deletions packages/patrol/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ include: package:leancode_lint/analysis_options_package.yaml

analyzer:
exclude:
- lib/**/*.freezed.dart
- lib/**/*.g.dart
- lib/**/*.pb.dart
- lib/**/*.pbenum.dart
- lib/**/*.pbjson.dart
Expand Down
7 changes: 5 additions & 2 deletions packages/patrol/example/integration_test/config.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import 'package:patrol/patrol.dart';

const patrolConfig = PatrolTestConfig(
appName: 'Example App',
const patrolConfig = PatrolTesterConfig(appName: 'Example App');

final nativeAutomatorConfig = NativeAutomatorConfig(
packageName: 'pl.leancode.patrol.example',
bundleId: 'pl.leancode.patrol.Example',
);

const hostAutomatorConfig = HostAutomatorConfig();
2 changes: 1 addition & 1 deletion packages/patrol/example/test/loading_screen_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ void main() {
);
});
},
config: PatrolTestConfig(visibleTimeout: Duration(milliseconds: 100)),
config: PatrolTesterConfig(visibleTimeout: Duration(milliseconds: 100)),
);
}
3 changes: 3 additions & 0 deletions packages/patrol/lib/patrol.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
/// flutter_driver.
library patrol;

export 'src/binding.dart';
export 'src/common.dart';
export 'src/custom_finders/custom_finders.dart';
export 'src/host/host_automator.dart';
export 'src/native/native.dart';
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:meta/meta.dart';
import 'package:patrol/src/custom_finders/patrol_test_config.dart';
import 'package:patrol/src/binding.dart';
import 'package:patrol/src/custom_finders/patrol_tester.dart';
import 'package:patrol/src/host/host_automator.dart';
import 'package:patrol/src/native/native.dart';
Expand Down Expand Up @@ -38,37 +38,35 @@ void patrolTest(
bool semanticsEnabled = true,
TestVariant<Object?> variant = const DefaultTestVariant(),
dynamic tags,
PatrolTestConfig config = const PatrolTestConfig(),
PatrolTesterConfig config = const PatrolTesterConfig(),
NativeAutomatorConfig nativeAutomatorConfig = const NativeAutomatorConfig(),
HostAutomatorConfig hostAutomatorConfig = const HostAutomatorConfig(),
bool nativeAutomation = false,
BindingType bindingType = BindingType.patrol,
}) {
TestWidgetsFlutterBinding? binding;
HostAutomator? hostAutomator;
NativeAutomator? nativeAutomator;

if (nativeAutomation) {
switch (bindingType) {
case BindingType.patrol:
binding = PatrolBinding.ensureInitialized();
final binding = PatrolBinding.ensureInitialized();

hostAutomator = HostAutomator(
config: hostAutomatorConfig,
binding: binding,
);

nativeAutomator = NativeAutomator(config: nativeAutomatorConfig);
break;
case BindingType.integrationTest:
binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
break;
case BindingType.none:
break;
}
}

HostAutomator? hostAutomator;
NativeAutomator? nativeAutomator;
if (nativeAutomation) {
if (binding is PatrolBinding) {
hostAutomator = HostAutomator(binding: binding);
}

nativeAutomator = NativeAutomator(
packageName: config.packageName,
bundleId: config.bundleId,
);
}

testWidgets(
description,
skip: skip,
Expand Down
3 changes: 1 addition & 2 deletions packages/patrol/lib/src/custom_finders/custom_finders.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export 'common.dart';
export '../common.dart';
export 'exceptions.dart';
export 'patrol_finder.dart';
export 'patrol_test_config.dart';
export 'patrol_tester.dart';
2 changes: 1 addition & 1 deletion packages/patrol/lib/src/custom_finders/patrol_finder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:meta/meta.dart';
import 'package:patrol/src/custom_finders/common.dart';
import 'package:patrol/src/common.dart';
import 'package:patrol/src/custom_finders/exceptions.dart';
import 'package:patrol/src/custom_finders/patrol_tester.dart';
import 'package:patrol/src/extensions.dart';
Expand Down
48 changes: 0 additions & 48 deletions packages/patrol/lib/src/custom_finders/patrol_test_config.dart

This file was deleted.

Loading

0 comments on commit d2b0542

Please sign in to comment.