diff --git a/integration_test/desktop/env_manager_test.dart b/integration_test/desktop/env_manager_test.dart index cdd748a2..8b35fe4b 100644 --- a/integration_test/desktop/env_manager_test.dart +++ b/integration_test/desktop/env_manager_test.dart @@ -23,9 +23,8 @@ Future runDesktopEnvIntegrationTest() async { const unknown = "unknown"; const expectedCurlCode = "curl --url '$testEndpoint$envVarValue'"; - await ApidashTestHelper.initialize( - size: Size(kExpandedWindowWidth, kMinWindowSize.height)); - apidashWidgetTest("Testing Environment Manager in desktop end-to-end", + apidashWidgetTest( + "Testing Environment Manager in desktop end-to-end", kExpandedWindowWidth, (WidgetTester tester, helper) async { await tester.pumpUntilFound(find.byType(DashApp)); await Future.delayed(const Duration(seconds: 1)); diff --git a/integration_test/desktop/his_request_test.dart b/integration_test/desktop/his_request_test.dart index b47fe6e7..b643d7e6 100644 --- a/integration_test/desktop/his_request_test.dart +++ b/integration_test/desktop/his_request_test.dart @@ -1,6 +1,3 @@ -import 'dart:ui'; - -import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:apidash/app.dart'; import 'package:apidash/consts.dart'; @@ -13,9 +10,8 @@ Future main() async { } Future runDesktopHisIntegrationTest() async { - await ApidashTestHelper.initialize( - size: Size(kExpandedWindowWidth, kMinWindowSize.height)); - apidashWidgetTest("Testing History of Requests in desktop end-to-end", + apidashWidgetTest( + "Testing History of Requests in desktop end-to-end", kExpandedWindowWidth, (WidgetTester tester, helper) async { await tester.pumpUntilFound(find.byType(DashApp)); await Future.delayed(const Duration(seconds: 1)); diff --git a/integration_test/desktop/req_editor_test.dart b/integration_test/desktop/req_editor_test.dart index abdb24cf..a3f81ddd 100644 --- a/integration_test/desktop/req_editor_test.dart +++ b/integration_test/desktop/req_editor_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:spot/spot.dart'; import 'package:apidash/app.dart'; @@ -23,9 +22,8 @@ Future runDesktopReqIntegrationTest() async { "data": "870K" }'''; - await ApidashTestHelper.initialize( - size: Size(kExpandedWindowWidth, kMinWindowSize.height)); - apidashWidgetTest("Testing Request Editor in desktop end-to-end", + apidashWidgetTest( + "Testing Request Editor in desktop end-to-end", kExpandedWindowWidth, (WidgetTester tester, helper) async { await tester.pumpUntilFound(find.byType(DashApp)); await Future.delayed(const Duration(seconds: 1)); diff --git a/integration_test/mobile/env_manager_test.dart b/integration_test/mobile/env_manager_test.dart index d6544331..0fd810fd 100644 --- a/integration_test/mobile/env_manager_test.dart +++ b/integration_test/mobile/env_manager_test.dart @@ -24,9 +24,8 @@ Future runMobileEnvIntegrationTest() async { const unknown = "unknown"; const expectedCurlCode = "curl --url '$testEndpoint$envVarValue'"; - await ApidashTestHelper.initialize( - size: Size(kCompactWindowWidth, kMinWindowSize.height)); - apidashWidgetTest("Testing Environment Manager in mobile end-to-end", + apidashWidgetTest( + "Testing Environment Manager in mobile end-to-end", kCompactWindowWidth, (WidgetTester tester, helper) async { await tester.pumpUntilFound(find.byType(DashApp)); await Future.delayed(const Duration(seconds: 1)); diff --git a/integration_test/mobile/his_request_test.dart b/integration_test/mobile/his_request_test.dart index c2544bc0..995284e0 100644 --- a/integration_test/mobile/his_request_test.dart +++ b/integration_test/mobile/his_request_test.dart @@ -13,9 +13,8 @@ Future main() async { } Future runMobileHisIntegrationTest() async { - await ApidashTestHelper.initialize( - size: Size(kCompactWindowWidth, kMinWindowSize.height)); - apidashWidgetTest("Testing History of Requests in mobile end-to-end", + apidashWidgetTest( + "Testing History of Requests in mobile end-to-end", kCompactWindowWidth, (WidgetTester tester, helper) async { await tester.pumpUntilFound(find.byType(DashApp)); await Future.delayed(const Duration(seconds: 1)); @@ -29,7 +28,6 @@ Future runMobileHisIntegrationTest() async { ); await Future.delayed(const Duration(milliseconds: 200)); await helper.reqHelper.sendRequest(); - await helper.reqHelper.sendRequest(); /// Navigate to History await helper.navigateToHistory(scaffoldKey: kHomeScaffoldKey); diff --git a/integration_test/mobile/req_editor_test.dart b/integration_test/mobile/req_editor_test.dart index a407db3e..738d2fc4 100644 --- a/integration_test/mobile/req_editor_test.dart +++ b/integration_test/mobile/req_editor_test.dart @@ -23,9 +23,8 @@ Future runMobileReqIntegrationTest() async { "data": "870K" }'''; - await ApidashTestHelper.initialize( - size: Size(kCompactWindowWidth, kMinWindowSize.height)); - apidashWidgetTest("Testing Request Editor in mobile end-to-end", + apidashWidgetTest( + "Testing Request Editor in mobile end-to-end", kCompactWindowWidth, (WidgetTester tester, helper) async { await tester.pumpUntilFound(find.byType(DashApp)); await Future.delayed(const Duration(seconds: 1)); diff --git a/integration_test/runner.dart b/integration_test/runner.dart index a2b88c0d..abd43956 100644 --- a/integration_test/runner.dart +++ b/integration_test/runner.dart @@ -1,5 +1,4 @@ -import 'dart:io'; - +import 'package:apidash/consts.dart'; import 'desktop/env_manager_test.dart'; import 'desktop/his_request_test.dart'; import 'desktop/req_editor_test.dart'; @@ -8,11 +7,14 @@ import 'mobile/his_request_test.dart'; import 'mobile/req_editor_test.dart'; Future main() async { - if (Platform.isLinux || Platform.isWindows || Platform.isMacOS) { + if (kIsMobile) { + await runMobileReqIntegrationTest(); + await runMobileEnvIntegrationTest(); + await runMobileHisIntegrationTest(); + } else if (kIsMobile || kIsDesktop) { await runDesktopReqIntegrationTest(); await runDesktopEnvIntegrationTest(); await runDesktopHisIntegrationTest(); - } else if (Platform.isAndroid || Platform.isIOS) { await runMobileReqIntegrationTest(); await runMobileEnvIntegrationTest(); await runMobileHisIntegrationTest(); diff --git a/integration_test/test_helper.dart b/integration_test/test_helper.dart index a1ce860d..70cafa9d 100644 --- a/integration_test/test_helper.dart +++ b/integration_test/test_helper.dart @@ -113,11 +113,14 @@ class ApidashTestHelper { @isTest void apidashWidgetTest( String description, + double? width, Future Function(WidgetTester, ApidashTestHelper) test, ) { testWidgets( description, (widgetTester) async { + await ApidashTestHelper.initialize( + size: width != null ? Size(width, kMinWindowSize.height) : null); await ApidashTestHelper.loadApp(widgetTester); await test(widgetTester, ApidashTestHelper(widgetTester)); },