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 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));

View File

@ -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<void> main() async {
}
Future<void> 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));

View File

@ -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<void> 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));

View File

@ -24,9 +24,8 @@ Future<void> 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));

View File

@ -13,9 +13,8 @@ Future<void> main() async {
}
Future<void> 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<void> 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);

View File

@ -23,9 +23,8 @@ Future<void> 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));

View File

@ -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<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 runDesktopEnvIntegrationTest();
await runDesktopHisIntegrationTest();
} else if (Platform.isAndroid || Platform.isIOS) {
await runMobileReqIntegrationTest();
await runMobileEnvIntegrationTest();
await runMobileHisIntegrationTest();

View File

@ -113,11 +113,14 @@ class ApidashTestHelper {
@isTest
void apidashWidgetTest(
String description,
double? width,
Future<void> 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));
},