Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Conversation

@amirh
Copy link
Contributor

@amirh amirh commented Oct 4, 2019

To run the e2e Android tests the same way they would be run on CI:

cd packages/battery/example/android
./gradlew connectedAndroidTest -Ptarget=`pwd`/../../test/battery_e2e.dart

Related Issues

flutter/flutter#41833

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • [] My PR includes unit or integration tests for all changed/updated/fixed behaviors (See [Contributor Guide]).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the [Flutter Style Guide].
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I updated pubspec.yaml with an appropriate new version according to the [pub versioning philosophy].
  • I updated CHANGELOG.md to add a description of the change.
  • I signed the [CLA].
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

this.registrar = registrar;
@Override
public void onAttachedToEngine(FlutterPluginBinding binding) {
applicationContext = binding.getApplicationContext();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is redundant with this.applicationContext = applicationContext; in the other onAttachedToEngine

@amirh amirh force-pushed the battery_embedder_v2 branch from 72475d8 to 541b33b Compare October 14, 2019 19:49
@amirh
Copy link
Contributor Author

amirh commented Oct 14, 2019

I believe this is now ready to land (including bumping the Flutter SDK constraint, adding CI-ready e2e tests, and making sure it builds on stable and master).

@collinjackson @mklim

Copy link
Contributor

@collinjackson collinjackson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few minor comments, lgtm otherwise

void main() {
E2EWidgetsFlutterBinding.ensureInitialized();

testWidgets('Builds and runs', (WidgetTester tester) async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nit and we're not doing it consistently in first-party unit tests but since this is supposed to be a canonical example of an integration tested plugin, I'm wondering if you think we should wrap the test in a group('$Battery', () { ... });

And the description of the test could be 'level' since that's the method you're invoking.

https://github.com/flutter/plugins/blob/master/packages/image_picker/test/image_picker_test.dart

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think group('Battery') adds much as all tests in this file belong to that group...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(renamed the test to 'Can get battery level')

@amirh amirh merged commit 326b21b into flutter:master Oct 14, 2019
@collinjackson
Copy link
Contributor

If you encounter Default interface methods are only supported starting with Android N errors, change connectedAndroidTest to app:connectedAndroidTest

mormih pushed a commit to mormih/plugins that referenced this pull request Nov 17, 2019
sungmin-park pushed a commit to sungmin-park/flutter-plugins that referenced this pull request Dec 17, 2019
julianscheel pushed a commit to jusst-engineering/plugins that referenced this pull request Mar 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants