mirror of
https://github.com/foss42/apidash.git
synced 2025-12-09 14:40:20 +08:00
test: common runner file
This commit is contained in:
@@ -11,7 +11,11 @@ import 'package:apidash/screens/home_page/editor_pane/url_card.dart';
|
||||
import '../../test/extensions/widget_tester_extensions.dart';
|
||||
import '../test_helper.dart';
|
||||
|
||||
void main() async {
|
||||
Future<void> main() async {
|
||||
await runDesktopEnvIntegrationTest();
|
||||
}
|
||||
|
||||
Future<void> runDesktopEnvIntegrationTest() async {
|
||||
const environmentName = "test-env-name";
|
||||
const envVarName = "test-env-var";
|
||||
const envVarValue = "8700000";
|
||||
|
||||
@@ -8,7 +8,11 @@ import 'package:apidash/widgets/widgets.dart';
|
||||
import '../../test/extensions/widget_tester_extensions.dart';
|
||||
import '../test_helper.dart';
|
||||
|
||||
void main() async {
|
||||
Future<void> main() async {
|
||||
await runDesktopHisIntegrationTest();
|
||||
}
|
||||
|
||||
Future<void> runDesktopHisIntegrationTest() async {
|
||||
await ApidashTestHelper.initialize(
|
||||
size: Size(kExpandedWindowWidth, kMinWindowSize.height));
|
||||
apidashWidgetTest("Testing History of Requests in desktop end-to-end",
|
||||
|
||||
@@ -7,7 +7,11 @@ import 'package:apidash/widgets/widgets.dart';
|
||||
import '../../test/extensions/widget_tester_extensions.dart';
|
||||
import '../test_helper.dart';
|
||||
|
||||
void main() async {
|
||||
Future<void> main() async {
|
||||
await runDesktopReqIntegrationTest();
|
||||
}
|
||||
|
||||
Future<void> runDesktopReqIntegrationTest() async {
|
||||
const reqName = "test-req-name";
|
||||
const testEndpoint = "https://api.apidash.dev/humanize/social";
|
||||
const paramKey = "num";
|
||||
|
||||
@@ -11,7 +11,11 @@ import 'package:apidash/screens/home_page/editor_pane/url_card.dart';
|
||||
import '../../test/extensions/widget_tester_extensions.dart';
|
||||
import '../test_helper.dart';
|
||||
|
||||
void main() async {
|
||||
Future<void> main() async {
|
||||
await runMobileEnvIntegrationTest();
|
||||
}
|
||||
|
||||
Future<void> runMobileEnvIntegrationTest() async {
|
||||
const environmentName = "test-env-name";
|
||||
const envVarName = "test-env-var";
|
||||
const envVarValue = "8700000";
|
||||
@@ -73,13 +77,26 @@ void main() async {
|
||||
addTearDown(gesture.removePointer);
|
||||
await tester.pump();
|
||||
|
||||
/// Check if environment variable is shown on hover
|
||||
await gesture.moveTo(tester.getCenter(find.descendant(
|
||||
of: find.byType(URLTextField),
|
||||
matching: find.text('{{$envVarName}}'))));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(envVarValue), findsOneWidget);
|
||||
await gesture.moveBy(const Offset(0, 100));
|
||||
/// Check if environment variable is shown
|
||||
if (kIsMobile) {
|
||||
// TODO: Unable to get Popover to show on mobile
|
||||
// await tester.tapAt(tester.getCenter(find.descendant(
|
||||
// of: find.byType(URLTextField),
|
||||
// matching: find.text('{{$envVarName}}'))));
|
||||
// await tester.pumpAndSettle();
|
||||
// expect(find.text(envVarValue), findsOneWidget);
|
||||
// await tester.tapAt(tester.getCenter(find.descendant(
|
||||
// of: find.byType(URLTextField),
|
||||
// matching: find.byType(WidgetSpan))) +
|
||||
// const Offset(0, 100));
|
||||
} else {
|
||||
await gesture.moveTo(tester.getCenter(find.descendant(
|
||||
of: find.byType(URLTextField),
|
||||
matching: find.text('{{$envVarName}}'))));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(envVarValue), findsOneWidget);
|
||||
await gesture.moveBy(const Offset(0, 100));
|
||||
}
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
|
||||
await helper.navigateToSettings(scaffoldKey: kHomeScaffoldKey);
|
||||
@@ -111,12 +128,21 @@ void main() async {
|
||||
await helper.navigateToRequestEditor(scaffoldKey: kEnvScaffoldKey);
|
||||
await Future.delayed(const Duration(milliseconds: 200));
|
||||
|
||||
/// Check if environment variable is now shown on hover
|
||||
await gesture.moveTo(tester.getCenter(find.descendant(
|
||||
of: find.byType(URLTextField),
|
||||
matching: find.text('{{$envVarName}}'))));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(unknown), findsNWidgets(2));
|
||||
/// Check if environment variable is now shown as unknown
|
||||
if (kIsMobile) {
|
||||
// TODO: Unable to get Popover to show on mobile
|
||||
// await tester.tapAt(tester.getCenter(find.descendant(
|
||||
// of: find.byType(URLTextField),
|
||||
// matching: find.text('{{$envVarName}}'))));
|
||||
// await tester.pumpAndSettle();
|
||||
// expect(find.text(unknown), findsNWidgets(2));
|
||||
} else {
|
||||
await gesture.moveTo(tester.getCenter(find.descendant(
|
||||
of: find.byType(URLTextField),
|
||||
matching: find.text('{{$envVarName}}'))));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(unknown), findsNWidgets(2));
|
||||
}
|
||||
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
});
|
||||
|
||||
@@ -8,7 +8,11 @@ import 'package:apidash/screens/history/history_widgets/history_widgets.dart';
|
||||
import '../../test/extensions/widget_tester_extensions.dart';
|
||||
import '../test_helper.dart';
|
||||
|
||||
void main() async {
|
||||
Future<void> main() async {
|
||||
await runMobileHisIntegrationTest();
|
||||
}
|
||||
|
||||
Future<void> runMobileHisIntegrationTest() async {
|
||||
await ApidashTestHelper.initialize(
|
||||
size: Size(kCompactWindowWidth, kMinWindowSize.height));
|
||||
apidashWidgetTest("Testing History of Requests in mobile end-to-end",
|
||||
|
||||
@@ -7,7 +7,11 @@ import 'package:apidash/widgets/widgets.dart';
|
||||
import '../../test/extensions/widget_tester_extensions.dart';
|
||||
import '../test_helper.dart';
|
||||
|
||||
void main() async {
|
||||
Future<void> main() async {
|
||||
await runMobileReqIntegrationTest();
|
||||
}
|
||||
|
||||
Future<void> runMobileReqIntegrationTest() async {
|
||||
const reqName = "test-req-name";
|
||||
const testEndpoint = "https://api.apidash.dev/humanize/social";
|
||||
const paramKey = "num";
|
||||
|
||||
22
integration_test/runner.dart
Normal file
22
integration_test/runner.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'desktop/env_manager_test.dart';
|
||||
import 'desktop/his_request_test.dart';
|
||||
import 'desktop/req_editor_test.dart';
|
||||
import 'mobile/env_manager_test.dart';
|
||||
import 'mobile/his_request_test.dart';
|
||||
import 'mobile/req_editor_test.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
if (Platform.isLinux || Platform.isWindows || Platform.isMacOS) {
|
||||
await runDesktopReqIntegrationTest();
|
||||
await runDesktopEnvIntegrationTest();
|
||||
await runDesktopHisIntegrationTest();
|
||||
} else if (Platform.isAndroid || Platform.isIOS) {
|
||||
await runMobileReqIntegrationTest();
|
||||
await runMobileEnvIntegrationTest();
|
||||
await runMobileHisIntegrationTest();
|
||||
} else {
|
||||
throw Exception("Unsupported Platform");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user