Skip to content

Commit

Permalink
create good reproducer
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Sep 29, 2023
1 parent 44d6818 commit 848b12c
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 11 deletions.
35 changes: 24 additions & 11 deletions packages/patrol/example/integration_test/example_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,39 @@ import 'package:flutter/material.dart';
import 'common.dart';

void main() {
// WORKS
// 12 + 1 + 180 + 1 = 194
//
// example_test: 12
// space: 1
// alpha * 36: 180
// A: 1
patrol(
// '${"alpha" * 30}ABCDE', / 12 + 1 + 150 = 163
'alpha' * 40,
'${"alpha" * 36}A', // 194
($) async {
await createApp($);

await Future.delayed(Duration(seconds: 5));

await $(FloatingActionButton).tap();
expect($(#counterText).text, '1');
},
);

await $(#textField).enterText('Hello, Flutter!');
expect($('Hello, Flutter!'), findsOneWidget);

await $.native.pressHome();
await $.native.openApp();
// WORKS
// 12 + 1 + 180 + 2 = 195
//
// example_test: 12
// space: 1
// alpha * 36: 180
// A: 2
patrol(
'${"alpha" * 36}AA', // 195
($) async {
await createApp($);

expect($(#counterText).text, '1');
await $(FloatingActionButton).tap();

expect($(#counterText).text, '2');
expect($('Hello, Flutter!'), findsOneWidget);
expect($(#counterText).text, '1');
},
);
}
36 changes: 36 additions & 0 deletions packages/patrol/test/internals_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,42 @@ void main() {
),
);
});

test('smoke test 3 (long test names)', () {
// given
final topLevelGroup = Group.root([
LocalTest('patrol_test_explorer', Metadata.empty, () {}),
Group(
'example_test',
[
_localTest('example_test ${"alpha" * 40}'), // 12 + 1 + 200 = 213
],
),
]);

// when
final dartTestGroup = createDartTestGroup(topLevelGroup);

// then
expect(
dartTestGroup,
equals(
DartGroupEntry(
name: '',
type: GroupEntryType.group,
entries: [
DartGroupEntry(
name: 'example_test',
type: GroupEntryType.group,
entries: [
_testEntry('alpha'),
],
),
],
),
),
);
});
});

group('deduplicateGroupEntryName()', () {
Expand Down

0 comments on commit 848b12c

Please sign in to comment.