-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add patrol poc #524
Closed
Closed
feat: add patrol poc #524
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
85ee45b
feat: add patrol test
09d55e2
Merge branch 'draft' into feat/329-add-patrol-poc
16d5c8c
fix: spelling
03eab8b
fix: flutter intl
caf3a5e
fix: revert version
bdcf780
fix: flutter analyze
3cbb4cb
Merge branch 'main' into feat/329-add-patrol-poc
e29316e
Merge branch 'main' into feat/329-add-patrol-poc
8717333
feat: create new main_qa and use localization asset in test
c0517d8
Merge branch 'main' into feat/329-add-patrol-poc
7f46b26
refactor: cleanup boostrap
dtscalac 3d8c0d0
docs: improve
dtscalac File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 27 additions & 7 deletions
34
...ndroidTest/java/androidTest/java/io/projectcatalyst/catalyst_voices/MainActivityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,32 @@ | ||
package io.projectcatalyst.catalyst_voices; | ||
|
||
import androidx.test.rule.ActivityTestRule; | ||
import dev.flutter.plugins.integration_test.FlutterTestRunner; | ||
import org.junit.Rule; | ||
import androidx.test.platform.app.InstrumentationRegistry; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
import org.junit.runners.Parameterized.Parameters; | ||
import pl.leancode.patrol.PatrolJUnitRunner; | ||
|
||
@RunWith(FlutterTestRunner.class) | ||
@RunWith(Parameterized.class) | ||
public class MainActivityTest { | ||
@Rule | ||
public ActivityTestRule<MainActivity> rule = new ActivityTestRule<>(MainActivity.class, true, false); | ||
} | ||
|
||
@Parameters(name = "{0}") | ||
public static Object[] testCases() { | ||
PatrolJUnitRunner instrumentation = (PatrolJUnitRunner) InstrumentationRegistry.getInstrumentation(); | ||
instrumentation.setUp(MainActivity.class); | ||
instrumentation.waitForPatrolAppService(); | ||
return instrumentation.listDartTests(); | ||
} | ||
|
||
public MainActivityTest(String dartTestName) { | ||
this.dartTestName = dartTestName; | ||
} | ||
|
||
private final String dartTestName; | ||
|
||
@Test | ||
public void runDartTest() { | ||
PatrolJUnitRunner instrumentation = (PatrolJUnitRunner) InstrumentationRegistry.getInstrumentation(); | ||
instrumentation.runDartTest(dartTestName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import 'package:catalyst_voices/app/app.dart'; | ||
import 'package:catalyst_voices/app/view/app_page.dart'; | ||
import 'package:catalyst_voices/configs/bootstrap.dart' as app; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:patrol/patrol.dart'; | ||
|
||
export 'package:flutter_test/flutter_test.dart'; | ||
export 'package:patrol/patrol.dart'; | ||
|
||
const _nativeAutomatorConfig = NativeAutomatorConfig( | ||
findTimeout: Duration(seconds: 30), // 10 seconds is too short for some CIs | ||
); | ||
|
||
Future<void> createApp(PatrolIntegrationTester $) async { | ||
await app.bootstrapForTests(); | ||
await $.pumpWidgetAndSettle(const App()); | ||
} | ||
|
||
void patrol( | ||
String description, | ||
Future<void> Function(PatrolIntegrationTester) callback, { | ||
bool? skip, | ||
NativeAutomatorConfig? nativeAutomatorConfig, | ||
LiveTestWidgetsFlutterBindingFramePolicy framePolicy = | ||
LiveTestWidgetsFlutterBindingFramePolicy.fadePointers, | ||
}) { | ||
patrolTest( | ||
description, | ||
nativeAutomatorConfig: nativeAutomatorConfig ?? _nativeAutomatorConfig, | ||
framePolicy: framePolicy, | ||
skip: skip, | ||
callback, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'package:catalyst_voices_localization/generated/catalyst_voices_localizations.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'common.dart'; | ||
|
||
void main() { | ||
patrol('Test Landing page', (PatrolIntegrationTester $) async { | ||
await createApp($); | ||
await Future<void>.delayed(const Duration(seconds: 15)); | ||
final BuildContext context = $.tester.element(find.byType(Container).first); | ||
final localization = VoicesLocalizations.of(context); | ||
final comingSoonText = localization?.comingSoonDescription; | ||
final comingSoonTitle1 = localization?.comingSoonTitle1; | ||
final comingSoonTitle2 = localization?.comingSoonTitle2; | ||
expect($(comingSoonText), findsOneWidget); | ||
expect($(comingSoonTitle1), findsOneWidget); | ||
expect($(comingSoonTitle2), findsOneWidget); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a section in catalyst_voices/README.md how to run the patrol test?