Update for running for responsive widths in desktop

This commit is contained in:
Ashita Prasad
2024-08-25 23:05:44 +05:30
parent 4bb5afecb6
commit 55ad184a49
8 changed files with 21 additions and 27 deletions

View File

@ -23,9 +23,8 @@ Future<void> runDesktopEnvIntegrationTest() async {
const unknown = "unknown"; const unknown = "unknown";
const expectedCurlCode = "curl --url '$testEndpoint$envVarValue'"; const expectedCurlCode = "curl --url '$testEndpoint$envVarValue'";
await ApidashTestHelper.initialize( apidashWidgetTest(
size: Size(kExpandedWindowWidth, kMinWindowSize.height)); "Testing Environment Manager in desktop end-to-end", kExpandedWindowWidth,
apidashWidgetTest("Testing Environment Manager in desktop end-to-end",
(WidgetTester tester, helper) async { (WidgetTester tester, helper) async {
await tester.pumpUntilFound(find.byType(DashApp)); await tester.pumpUntilFound(find.byType(DashApp));
await Future.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));

View File

@ -1,6 +1,3 @@
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:apidash/app.dart'; import 'package:apidash/app.dart';
import 'package:apidash/consts.dart'; import 'package:apidash/consts.dart';
@ -13,9 +10,8 @@ Future<void> main() async {
} }
Future<void> runDesktopHisIntegrationTest() async { Future<void> runDesktopHisIntegrationTest() async {
await ApidashTestHelper.initialize( apidashWidgetTest(
size: Size(kExpandedWindowWidth, kMinWindowSize.height)); "Testing History of Requests in desktop end-to-end", kExpandedWindowWidth,
apidashWidgetTest("Testing History of Requests in desktop end-to-end",
(WidgetTester tester, helper) async { (WidgetTester tester, helper) async {
await tester.pumpUntilFound(find.byType(DashApp)); await tester.pumpUntilFound(find.byType(DashApp));
await Future.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:spot/spot.dart'; import 'package:spot/spot.dart';
import 'package:apidash/app.dart'; import 'package:apidash/app.dart';
@ -23,9 +22,8 @@ Future<void> runDesktopReqIntegrationTest() async {
"data": "870K" "data": "870K"
}'''; }''';
await ApidashTestHelper.initialize( apidashWidgetTest(
size: Size(kExpandedWindowWidth, kMinWindowSize.height)); "Testing Request Editor in desktop end-to-end", kExpandedWindowWidth,
apidashWidgetTest("Testing Request Editor in desktop end-to-end",
(WidgetTester tester, helper) async { (WidgetTester tester, helper) async {
await tester.pumpUntilFound(find.byType(DashApp)); await tester.pumpUntilFound(find.byType(DashApp));
await Future.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));

View File

@ -24,9 +24,8 @@ Future<void> runMobileEnvIntegrationTest() async {
const unknown = "unknown"; const unknown = "unknown";
const expectedCurlCode = "curl --url '$testEndpoint$envVarValue'"; const expectedCurlCode = "curl --url '$testEndpoint$envVarValue'";
await ApidashTestHelper.initialize( apidashWidgetTest(
size: Size(kCompactWindowWidth, kMinWindowSize.height)); "Testing Environment Manager in mobile end-to-end", kCompactWindowWidth,
apidashWidgetTest("Testing Environment Manager in mobile end-to-end",
(WidgetTester tester, helper) async { (WidgetTester tester, helper) async {
await tester.pumpUntilFound(find.byType(DashApp)); await tester.pumpUntilFound(find.byType(DashApp));
await Future.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));

View File

@ -13,9 +13,8 @@ Future<void> main() async {
} }
Future<void> runMobileHisIntegrationTest() async { Future<void> runMobileHisIntegrationTest() async {
await ApidashTestHelper.initialize( apidashWidgetTest(
size: Size(kCompactWindowWidth, kMinWindowSize.height)); "Testing History of Requests in mobile end-to-end", kCompactWindowWidth,
apidashWidgetTest("Testing History of Requests in mobile end-to-end",
(WidgetTester tester, helper) async { (WidgetTester tester, helper) async {
await tester.pumpUntilFound(find.byType(DashApp)); await tester.pumpUntilFound(find.byType(DashApp));
await Future.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));
@ -29,7 +28,6 @@ Future<void> runMobileHisIntegrationTest() async {
); );
await Future.delayed(const Duration(milliseconds: 200)); await Future.delayed(const Duration(milliseconds: 200));
await helper.reqHelper.sendRequest(); await helper.reqHelper.sendRequest();
await helper.reqHelper.sendRequest();
/// Navigate to History /// Navigate to History
await helper.navigateToHistory(scaffoldKey: kHomeScaffoldKey); await helper.navigateToHistory(scaffoldKey: kHomeScaffoldKey);

View File

@ -23,9 +23,8 @@ Future<void> runMobileReqIntegrationTest() async {
"data": "870K" "data": "870K"
}'''; }''';
await ApidashTestHelper.initialize( apidashWidgetTest(
size: Size(kCompactWindowWidth, kMinWindowSize.height)); "Testing Request Editor in mobile end-to-end", kCompactWindowWidth,
apidashWidgetTest("Testing Request Editor in mobile end-to-end",
(WidgetTester tester, helper) async { (WidgetTester tester, helper) async {
await tester.pumpUntilFound(find.byType(DashApp)); await tester.pumpUntilFound(find.byType(DashApp));
await Future.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));

View File

@ -1,5 +1,4 @@
import 'dart:io'; import 'package:apidash/consts.dart';
import 'desktop/env_manager_test.dart'; import 'desktop/env_manager_test.dart';
import 'desktop/his_request_test.dart'; import 'desktop/his_request_test.dart';
import 'desktop/req_editor_test.dart'; import 'desktop/req_editor_test.dart';
@ -8,11 +7,14 @@ import 'mobile/his_request_test.dart';
import 'mobile/req_editor_test.dart'; import 'mobile/req_editor_test.dart';
Future<void> main() async { Future<void> main() async {
if (Platform.isLinux || Platform.isWindows || Platform.isMacOS) { if (kIsMobile) {
await runMobileReqIntegrationTest();
await runMobileEnvIntegrationTest();
await runMobileHisIntegrationTest();
} else if (kIsMobile || kIsDesktop) {
await runDesktopReqIntegrationTest(); await runDesktopReqIntegrationTest();
await runDesktopEnvIntegrationTest(); await runDesktopEnvIntegrationTest();
await runDesktopHisIntegrationTest(); await runDesktopHisIntegrationTest();
} else if (Platform.isAndroid || Platform.isIOS) {
await runMobileReqIntegrationTest(); await runMobileReqIntegrationTest();
await runMobileEnvIntegrationTest(); await runMobileEnvIntegrationTest();
await runMobileHisIntegrationTest(); await runMobileHisIntegrationTest();

View File

@ -113,11 +113,14 @@ class ApidashTestHelper {
@isTest @isTest
void apidashWidgetTest( void apidashWidgetTest(
String description, String description,
double? width,
Future<void> Function(WidgetTester, ApidashTestHelper) test, Future<void> Function(WidgetTester, ApidashTestHelper) test,
) { ) {
testWidgets( testWidgets(
description, description,
(widgetTester) async { (widgetTester) async {
await ApidashTestHelper.initialize(
size: width != null ? Size(width, kMinWindowSize.height) : null);
await ApidashTestHelper.loadApp(widgetTester); await ApidashTestHelper.loadApp(widgetTester);
await test(widgetTester, ApidashTestHelper(widgetTester)); await test(widgetTester, ApidashTestHelper(widgetTester));
}, },