-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dee
committed
Jun 3, 2024
1 parent
8e17751
commit 85ee45b
Showing
7 changed files
with
105 additions
and
11 deletions.
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
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,35 @@ | ||
import 'package:catalyst_voices/app/app.dart'; | ||
import 'package:catalyst_voices/app/view/app_page.dart'; | ||
import 'package:catalyst_voices/configs/main_qa.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 | ||
); | ||
const _patrolTesterConfig = PatrolTesterConfig(); | ||
|
||
Future<void> createApp(PatrolIntegrationTester $) async { | ||
await app.main(); | ||
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,15 @@ | ||
import 'common.dart'; | ||
|
||
void main() { | ||
patrol('Test Landing page', (PatrolIntegrationTester $) async { | ||
// await app.main(); | ||
// await $.pumpWidgetAndSettle(const App()); | ||
await createApp($); | ||
await Future<void>.delayed(const Duration(seconds: 15)); | ||
expect( | ||
$("Project Catalyst is the world's largest decentralized innovation engine for solving real-world challenges."), | ||
findsOneWidget, | ||
); | ||
expect($('Coming'), 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
import 'package:catalyst_voices/app/app.dart'; | ||
import 'package:catalyst_voices/configs/app_bloc_observer.dart'; | ||
import 'package:catalyst_voices/configs/bootstrap.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:go_router/go_router.dart'; | ||
import 'package:url_strategy/url_strategy.dart'; | ||
|
||
void main() async { | ||
await bootstrap(() => const App()); | ||
Future<void> main() async { | ||
GoRouter.optionURLReflectsImperativeAPIs = true; | ||
setPathUrlStrategy(); | ||
Bloc.observer = AppBlocObserver(); | ||
|
||
// await bootstrap(() => const App()); | ||
} |
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