Skip to content

Commit

Permalink
Filtered Android tasks should include mokey and pixel 7 pro in dashbo…
Browse files Browse the repository at this point in the history
…ard (#3902)

Update the dashboard so "mokey" and "pixel_7pro"  tasks are filtered/iconed as Android.  flutter/flutter#148085

For example, `Linux_mokey old_gallery__transition_perf` should show up in the dashboard as an Android test, but its icon and filtering counts it as a Linux test:

![Screenshot 2024-09-12 at 9 57 52�AM](https://github.com/user-attachments/assets/b2a090aa-28e3-4495-b781-0717723d318f)
![Screenshot 2024-09-12 at 9 57 48�AM](https://github.com/user-attachments/assets/1aa929d1-045d-49e1-93b4-6cc1fe2f24d9)

Also fix two unrelated warnings.
  • Loading branch information
jmagman authored Sep 13, 2024
1 parent 1b6c14e commit b4b0b2c
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 10 deletions.
5 changes: 4 additions & 1 deletion dashboard/lib/logic/task_grid_filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,12 @@ class TaskGridFilter extends FilterPropertySource {
return false;
}

final bool showAndroid = _allProperties['showAndroid']?.value ?? false;
final LinkedHashMap<String, bool> orderedOSFilter = LinkedHashMap<String, bool>.of({
'ios': _allProperties['showiOS']?.value ?? false,
'android': _allProperties['showAndroid']?.value ?? false,
'android': showAndroid,
'mokey': showAndroid,
'pixel_7pro': showAndroid,
'mac': _allProperties['showMac']?.value ?? false,
'windows': _allProperties['showWindows']?.value ?? false,
'linux': _allProperties['showLinux']?.value ?? false,
Expand Down
1 change: 0 additions & 1 deletion dashboard/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';

import 'build_dashboard_page.dart';
Expand Down
4 changes: 3 additions & 1 deletion dashboard/lib/widgets/task_icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class TaskIcon extends StatelessWidget {
final String matchedName = qualifiedTask.task!.toLowerCase();
final bool isWebTest = matchedName.contains('_web') || matchedName.contains('web_');
final bool isToolTest = matchedName.contains('_tool') || matchedName.contains('tool_');
final bool isAndroidTest =
matchedName.contains('_android') || matchedName.contains('_mokey') || matchedName.contains('_pixel_7pro');

if (matchedName.contains('_fuchsia')) {
return Padding(
Expand All @@ -68,7 +70,7 @@ class TaskIcon extends StatelessWidget {
color: blendFilter,
),
);
} else if (matchedName.contains('_android')) {
} else if (isAndroidTest) {
return Icon(
Icons.android,
color: blendFilter,
Expand Down
11 changes: 10 additions & 1 deletion dashboard/test/logic/task_grid_filter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,21 @@ void main() {
expect(macIosBothTrueFilter.matchesTask(QualifiedTask.fromTask(Task()..builderName = 'Mac_ios')), true);
expect(macIosBothTrueFilter.matchesTask(QualifiedTask.fromTask(Task()..builderName = 'Mac')), true);
expect(androidLinuxFilter.matchesTask(QualifiedTask.fromTask(Task()..builderName = 'Linux_android')), true);
expect(androidLinuxFilter.matchesTask(QualifiedTask.fromTask(Task()..builderName = 'Linux_mokey')), true);
expect(androidLinuxFilter.matchesTask(QualifiedTask.fromTask(Task()..builderName = 'Linux_pixel_7pro')), true);
expect(androidLinuxFilter.matchesTask(QualifiedTask.fromTask(Task()..builderName = 'Linux pixel_test')), false);
expect(androidLinuxFilter.matchesTask(QualifiedTask.fromTask(Task()..builderName = 'Linux')), false);
expect(linuxAndroidFilter.matchesTask(QualifiedTask.fromTask(Task()..builderName = 'Linux_android')), false);
expect(linuxAndroidFilter.matchesTask(QualifiedTask.fromTask(Task()..builderName = 'Linux_mokey')), false);
expect(linuxAndroidFilter.matchesTask(QualifiedTask.fromTask(Task()..builderName = 'Linux_pixel_7pro')), false);
expect(linuxAndroidFilter.matchesTask(QualifiedTask.fromTask(Task()..builderName = 'Linux')), true);
expect(linuxAndroidBothTrueFilter.matchesTask(QualifiedTask.fromTask(Task()..builderName = 'Linux_android')), true);
expect(linuxAndroidBothTrueFilter.matchesTask(QualifiedTask.fromTask(Task()..builderName = 'Linux_android')), true);
expect(linuxAndroidBothTrueFilter.matchesTask(QualifiedTask.fromTask(Task()..builderName = 'Linux_mokey')), true);
expect(
linuxAndroidBothTrueFilter.matchesTask(QualifiedTask.fromTask(Task()..builderName = 'Linux_pixel_7pro')), true);
expect(androidLinuxFilter.matchesTask(QualifiedTask.fromTask(Task()..builderName = 'Windows_android')), true);
expect(androidLinuxFilter.matchesTask(QualifiedTask.fromTask(Task()..builderName = 'Windows_mokey')), true);
expect(androidLinuxFilter.matchesTask(QualifiedTask.fromTask(Task()..builderName = 'Windows_pixel_7pro')), true);
expect(androidFalseFilter.matchesTask(QualifiedTask.fromTask(Task()..builderName = 'Anything_android')), false);
});

Expand Down
3 changes: 2 additions & 1 deletion dashboard/test/widgets/task_grid_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -878,5 +878,6 @@ Future<void> expectTaskBoxColorWithMessage(WidgetTester tester, String message,
expect(pixels!.lengthInBytes, (cellPixelArea * 4).round());
const double padding = 4.0;
final int rgba = pixels.getUint32((((cellPixelSize * (cellSize + padding)) + cellSize + padding).ceil()) * 4);
expect((rgba >> 8) | (rgba << 24) & 0xFFFFFFFF, expectedColor.value);
final Color actualColor = Color((rgba >> 8) | (rgba << 24) & 0xFFFFFFFF);
expect(actualColor, isSameColorAs(expectedColor));
}
18 changes: 13 additions & 5 deletions dashboard/test/widgets/task_icon_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,23 @@ void main() {
await tester.pumpWidget(
const MaterialApp(
home: Material(
child: TaskIcon(
qualifiedTask: QualifiedTask(stage: 'chromebot', task: 'Windows_android test', pool: 'luci.flutter.prod'),
child: Column(
children: <Widget>[
TaskIcon(
qualifiedTask: QualifiedTask(stage: 'chromebot', task: 'Windows_android test'),
),
TaskIcon(
qualifiedTask: QualifiedTask(stage: 'chromebot', task: 'Windows_pixel_7pro test'),
),
TaskIcon(
qualifiedTask: QualifiedTask(stage: 'chromebot', task: 'Windows_mokey test'),
),
],
),
),
),
);

expect(tester.widget(find.byType(Icon)) as Icon, isInstanceOf<Icon>());
expect((tester.widget(find.byType(Icon)) as Icon).icon!.codePoint, const Icon(Icons.android).icon!.codePoint);
expect(find.byIcon(Icons.android), findsExactly(3));
});

testWidgets('TaskIcon shows the right icon for LUCI mac', (WidgetTester tester) async {
Expand Down

0 comments on commit b4b0b2c

Please sign in to comment.