diff --git a/integration_test/test.dart b/integration_test/test.dart index 786a2b2..311435a 100644 --- a/integration_test/test.dart +++ b/integration_test/test.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; @@ -14,42 +15,56 @@ void main() { String.fromEnvironment('SCREENSHOT_MODE', defaultValue: 'desktop'); group('Test App', () { - // Test for 'Line' ChoiceChip + // Test for 'Line' Dropdown testWidgets('Test with take screenshot for Line', (tester) async { Widget app = MyApp(); await tester.pumpFrames(app, const Duration(seconds: 5)); + // Open the dropdown + await tester.tap(find.byType(DropdownButton)); + await tester.pumpFrames( + app, const Duration(milliseconds: 500)); // Adjust time as needed + var label = 'Line'; - await tester.tap(find.text(label), warnIfMissed: false); - await tester.pumpFrames(app, const Duration(seconds: 1)); + await tester.tap(find.text(label).last); + await tester.pumpFrames( + app, const Duration(milliseconds: 500)); // Adjust time as needed await takeScreenshot(app, "test-$label-$screenshotMode".replaceAll(" ", "-"), tester, binding); }); - // Test for 'Single Triangle' ChoiceChip + // Test for 'Single Triangle' Dropdown testWidgets('Test with take screenshot for Single Triangle', (tester) async { Widget app = MyApp(); await tester.pumpFrames(app, const Duration(seconds: 5)); + // Open the dropdown + await tester.tap(find.byType(DropdownButton)); + await tester.pumpFrames(app, const Duration(milliseconds: 500)); + var label = 'Single Triangle'; - await tester.tap(find.text(label), warnIfMissed: false); - await tester.pumpFrames(app, const Duration(seconds: 1)); + await tester.tap(find.text(label).last); + await tester.pumpFrames(app, const Duration(milliseconds: 500)); await takeScreenshot(app, "test-$label-$screenshotMode".replaceAll(" ", "-"), tester, binding); }); - // Test for 'Multiple Triangles' ChoiceChip + // Test for 'Multiple Triangles' Dropdown testWidgets('Test with take screenshot for Multiple Triangles', (tester) async { Widget app = MyApp(); await tester.pumpFrames(app, const Duration(seconds: 5)); + // Open the dropdown + await tester.tap(find.byType(DropdownButton)); + await tester.pumpFrames(app, const Duration(milliseconds: 500)); + var label = 'Multiple Triangles'; - await tester.tap(find.text(label), warnIfMissed: false); - await tester.pumpFrames(app, const Duration(seconds: 1)); + await tester.tap(find.text(label).last); + await tester.pumpFrames(app, const Duration(milliseconds: 500)); await takeScreenshot(app, "test-$label-$screenshotMode".replaceAll(" ", "-"), tester, binding);