Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abdelaziz-mahdy committed Dec 22, 2023
1 parent 05f2218 commit 62003cb
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions integration_test/test.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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);
Expand Down

0 comments on commit 62003cb

Please sign in to comment.