diff --git a/app/lib/features/artifacts/actions/artifact_file_actions.dart b/app/lib/features/artifacts/actions/artifact_file_actions.dart index ee24e616..ea54b0dc 100644 --- a/app/lib/features/artifacts/actions/artifact_file_actions.dart +++ b/app/lib/features/artifacts/actions/artifact_file_actions.dart @@ -2,7 +2,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../ui/adaptive/glass_bar.dart'; -import '../../../ui/adaptive/host.dart'; import '../domain/artifact_record.dart'; import '../domain/artifact_url.dart'; import '../ui/artifact_viewer_fetch.dart'; @@ -81,19 +80,15 @@ class _ArtifactFileActionsState extends State { listenable: _controller, builder: (context, _) => widget.compact ? _IconActions(controller: _controller) - : _ActionBar( - controller: _controller, - cupertino: usesCupertinoHost(context), - ), + : _ActionBar(controller: _controller), ); } } class _ActionBar extends StatelessWidget { - const _ActionBar({required this.controller, required this.cupertino}); + const _ActionBar({required this.controller}); final ArtifactFileActionsController controller; - final bool cupertino; @override Widget build(BuildContext context) { @@ -142,14 +137,11 @@ class _ActionBar extends StatelessWidget { child: Row( mainAxisSize: MainAxisSize.min, children: [ - if (cupertino) - const CupertinoActivityIndicator(radius: 8) - else - const SizedBox( - width: 14, - height: 14, - child: CircularProgressIndicator(strokeWidth: 2), - ), + const SizedBox( + width: 14, + height: 14, + child: CircularProgressIndicator(strokeWidth: 2), + ), const SizedBox(width: 8), Flexible(child: Text(status)), ], @@ -182,9 +174,6 @@ class _ActionBar extends StatelessWidget { required IconData icon, required VoidCallback? onPressed, }) { - if (cupertino) { - return CupertinoButton(onPressed: onPressed, child: Text(label)); - } return TextButton.icon( onPressed: onPressed, icon: Icon(icon, size: 18), @@ -241,28 +230,15 @@ class ArtifactIconAction extends StatelessWidget { final String label; final IconData icon; + + /// Retained for callers that still pass the Cupertino glyph; the Material + /// action always draws [icon]. final IconData cupertinoIcon; final VoidCallback? onPressed; final bool busy; @override Widget build(BuildContext context) { - if (usesCupertinoHost(context)) { - return Semantics( - button: true, - label: label, - child: CupertinoButton( - // One square touch target, like the top bar's other actions, so a - // round pill is centred on it and a glass bar's edge gaps hold. - padding: EdgeInsets.zero, - minimumSize: GlassBarMetrics.cupertinoMinimumSize(), - onPressed: onPressed, - child: busy - ? const CupertinoActivityIndicator(radius: 9) - : Icon(cupertinoIcon, size: GlassBarMetrics.iconSize(true)), - ), - ); - } return IconButton( tooltip: label, constraints: GlassBarMetrics.materialConstraints(), diff --git a/app/lib/features/artifacts/ui/artifact_controls_overlay.dart b/app/lib/features/artifacts/ui/artifact_controls_overlay.dart index bc58f4c4..f0c8bf5d 100644 --- a/app/lib/features/artifacts/ui/artifact_controls_overlay.dart +++ b/app/lib/features/artifacts/ui/artifact_controls_overlay.dart @@ -1,10 +1,7 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; - /// Open, Copy and the file actions float over the top of the content: shown /// when the page opens and whenever the content is touched, hidden again after /// a few seconds without use, so nothing needs scrolling to reach them. @@ -55,14 +52,9 @@ class _ArtifactControlsOverlayState extends State { @override Widget build(BuildContext context) { - final cupertino = usesCupertinoHost(context); - final surface = cupertino - ? CupertinoColors.systemBackground - .resolveFrom(context) - .withValues(alpha: 0.92) - : Theme.of( - context, - ).colorScheme.surfaceContainerHigh.withValues(alpha: 0.94); + final surface = Theme.of( + context, + ).colorScheme.surfaceContainerHigh.withValues(alpha: 0.94); return Stack( children: [ // Any touch on the content brings the controls back. diff --git a/app/lib/features/artifacts/ui/artifact_document_section.dart b/app/lib/features/artifacts/ui/artifact_document_section.dart index bb5a4631..631000f8 100644 --- a/app/lib/features/artifacts/ui/artifact_document_section.dart +++ b/app/lib/features/artifacts/ui/artifact_document_section.dart @@ -1,8 +1,5 @@ -import '../../../ui/layout/section_heading.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; import '../domain/artifact_document.dart'; import '../domain/artifact_groups.dart'; import 'artifact_record_row.dart'; @@ -50,23 +47,14 @@ class ArtifactDocumentSection extends StatelessWidget { children: rows, ); } - // Flat rows under a quiet label on both hosts: the section sits inside - // the visit's Session page, which is itself flat, so a Cupertino inset - // group here would be a group nested in a group. - final cupertino = usesCupertinoHost(context); + // Flat rows under a quiet label: the section sits inside the visit's + // Session page, which is itself flat. return Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Padding( padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 4), - child: Semantics( - container: true, - header: true, - child: Text( - title, - style: cupertino ? SectionHeadingStyle.of(context).title : null, - ), - ), + child: Semantics(container: true, header: true, child: Text(title)), ), ...rows, ], @@ -98,42 +86,15 @@ class _AbsentDocumentRow extends StatelessWidget { @override Widget build(BuildContext context) { - if (!usesCupertinoHost(context)) { - // The absence line is informational product content, so it keeps the - // theme's normal secondary label colour. A disabled tile would paint both - // lines at the disabled colour (about 2.7:1 in light mode); no `onTap` - // keeps the row non-actionable without dimming it. - return ListTile( - title: Text(document.name), - subtitle: Text( - document.absence, - style: TextStyle( - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ), - ); - } - final textTheme = CupertinoTheme.of(context).textTheme; - final absenceStyle = textTheme.textStyle.copyWith( - color: CupertinoColors.secondaryLabel.resolveFrom(context), - ); - return Semantics( - container: true, - child: SizedBox( - width: double.infinity, - child: Padding( - padding: kCupertinoButtonPadding[CupertinoButtonSize.large]!, - child: DefaultTextStyle.merge( - style: textTheme.textStyle, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(document.name), - Text(document.absence, style: absenceStyle), - ], - ), - ), - ), + // The absence line is informational product content, so it keeps the + // theme's normal secondary label colour. A disabled tile would paint both + // lines at the disabled colour (about 2.7:1 in light mode); no `onTap` + // keeps the row non-actionable without dimming it. + return ListTile( + title: Text(document.name), + subtitle: Text( + document.absence, + style: TextStyle(color: Theme.of(context).colorScheme.onSurfaceVariant), ), ); } diff --git a/app/lib/features/artifacts/ui/artifact_fullscreen.dart b/app/lib/features/artifacts/ui/artifact_fullscreen.dart index dd31aa15..3ac2d334 100644 --- a/app/lib/features/artifacts/ui/artifact_fullscreen.dart +++ b/app/lib/features/artifacts/ui/artifact_fullscreen.dart @@ -30,12 +30,13 @@ class ArtifactFullscreenScope extends InheritedWidget { /// The full-screen view's route, pushed on the root navigator so it covers /// the shell's bars and list pane. A full-screen dialog route: its bar shows /// the platform's Close, and the system back gesture leaves it. +/// +/// [cupertino] is retained for callers that still pass it; the route is always +/// the Material one. Route artifactFullscreenRoute({ required bool cupertino, required WidgetBuilder builder, -}) => cupertino - ? CupertinoPageRoute(fullscreenDialog: true, builder: builder) - : MaterialPageRoute(fullscreenDialog: true, builder: builder); +}) => MaterialPageRoute(fullscreenDialog: true, builder: builder); /// The zoom factors Zoom in and Zoom out step through. const List artifactHtmlZoomSteps = [ diff --git a/app/lib/features/artifacts/ui/artifact_fullscreen_host.dart b/app/lib/features/artifacts/ui/artifact_fullscreen_host.dart index 5593e8a7..48aea5d9 100644 --- a/app/lib/features/artifacts/ui/artifact_fullscreen_host.dart +++ b/app/lib/features/artifacts/ui/artifact_fullscreen_host.dart @@ -1,6 +1,5 @@ import 'package:flutter/widgets.dart'; -import '../../../ui/adaptive/host.dart'; import 'artifact_fullscreen.dart'; /// Lets a viewer page open its own content as the full-screen view. @@ -42,7 +41,7 @@ mixin ArtifactFullscreenHost on State { if (_fullscreen != null) return; htmlZoom.value = 1; final route = artifactFullscreenRoute( - cupertino: usesCupertinoHost(context), + cupertino: false, builder: (_) => ArtifactFullscreenScope( htmlZoom: htmlZoom, child: ListenableBuilder( diff --git a/app/lib/features/artifacts/ui/artifact_gallery_action.dart b/app/lib/features/artifacts/ui/artifact_gallery_action.dart index 0cd7ebc6..49ee0983 100644 --- a/app/lib/features/artifacts/ui/artifact_gallery_action.dart +++ b/app/lib/features/artifacts/ui/artifact_gallery_action.dart @@ -1,9 +1,7 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../core/api_gateway.dart'; import '../../../core/transport/pipelines_client.dart'; -import '../../../ui/adaptive/host.dart'; import 'artifact_external_open.dart'; import 'artifact_gallery_page.dart'; @@ -58,14 +56,6 @@ class RunArtifactsButton extends StatelessWidget { executing: _runExecuting(run), configuredEndpoint: configuredGatewayEndpoint(gateway), ); - if (usesCupertinoHost(context)) { - return CupertinoButton.tinted( - sizeStyle: CupertinoButtonSize.small, - key: runArtifactsButtonKey, - onPressed: open, - child: const Text(artifactGalleryTitle), - ); - } return OutlinedButton.icon( key: runArtifactsButtonKey, onPressed: open, @@ -92,9 +82,7 @@ Future showArtifactGallery( configuredEndpoint: configuredEndpoint, openExternal: openExternal, ); - return Navigator.of(context).push( - usesCupertinoHost(context) - ? CupertinoPageRoute(builder: (_) => page) - : MaterialPageRoute(builder: (_) => page), - ); + return Navigator.of( + context, + ).push(MaterialPageRoute(builder: (_) => page)); } diff --git a/app/lib/features/artifacts/ui/artifact_gallery_page.dart b/app/lib/features/artifacts/ui/artifact_gallery_page.dart index 99b400db..adb1dd8c 100644 --- a/app/lib/features/artifacts/ui/artifact_gallery_page.dart +++ b/app/lib/features/artifacts/ui/artifact_gallery_page.dart @@ -1,10 +1,8 @@ import '../../../ui/adaptive/segmented_bar.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import '../../../core/api_gateway.dart'; -import '../../../ui/adaptive/host.dart'; import '../../chat/ui/transcript/chat_markdown_view.dart'; import '../../graph/domain/stage_visits.dart'; import '../actions/artifact_file_actions.dart'; @@ -289,29 +287,17 @@ class _ArtifactGalleryPageState extends State { ]; final previousFocus = FocusManager.instance.primaryFocus; await Navigator.of(context).push( - usesCupertinoHost(context) - ? CupertinoPageRoute( - builder: (_) => ArtifactViewerPage( - groups: viewerGroups, - selectedIdentity: identity, - configuredEndpoint: widget.configuredEndpoint, - openExternal: widget.openExternal, - fetch: widget.fetch, - markdownBuilder: widget.markdownBuilder, - fileBridge: widget.fileBridge, - ), - ) - : MaterialPageRoute( - builder: (_) => ArtifactViewerPage( - groups: viewerGroups, - selectedIdentity: identity, - configuredEndpoint: widget.configuredEndpoint, - openExternal: widget.openExternal, - fetch: widget.fetch, - markdownBuilder: widget.markdownBuilder, - fileBridge: widget.fileBridge, - ), - ), + MaterialPageRoute( + builder: (_) => ArtifactViewerPage( + groups: viewerGroups, + selectedIdentity: identity, + configuredEndpoint: widget.configuredEndpoint, + openExternal: widget.openExternal, + fetch: widget.fetch, + markdownBuilder: widget.markdownBuilder, + fileBridge: widget.fileBridge, + ), + ), ); if (!mounted) return; if (previousFocus != null && previousFocus.canRequestFocus) { @@ -350,32 +336,6 @@ class _ArtifactGalleryPageState extends State { ], ], ); - if (usesCupertinoHost(context)) { - return showCupertinoDialog( - context: context, - builder: (dialogContext) => CupertinoAlertDialog( - title: Text(artifactDisplayName(artifact)), - content: content, - actions: [ - CupertinoDialogAction( - onPressed: () => Navigator.of(dialogContext).pop(), - child: const Text('Close'), - ), - if (resolved != null) - CupertinoDialogAction( - onPressed: () => _copyLink(resolved, dialogContext), - child: const Text('Copy link'), - ), - if (resolved != null) - CupertinoDialogAction( - isDefaultAction: true, - onPressed: () => _open(resolved, dialogContext), - child: const Text('Open in browser'), - ), - ], - ), - ); - } return showDialog( context: context, builder: (dialogContext) => AlertDialog( @@ -509,17 +469,11 @@ class _ArtifactGalleryPageState extends State { /// one line per recorded fact, never clamped or shortened. Widget _header(BuildContext context, String summary, {Widget? action}) { final notes = _captureNotes(); - final cupertino = usesCupertinoHost(context); - final textStyle = cupertino - ? CupertinoTheme.of(context).textTheme.textStyle - : Theme.of(context).textTheme.bodyMedium ?? const TextStyle(); - final headingStyle = cupertino - ? textStyle.copyWith(fontWeight: FontWeight.w600) - : Theme.of(context).textTheme.titleSmall; + final textStyle = + Theme.of(context).textTheme.bodyMedium ?? const TextStyle(); + final headingStyle = Theme.of(context).textTheme.titleSmall; final noteStyle = textStyle.copyWith( - color: cupertino - ? CupertinoColors.secondaryLabel.resolveFrom(context) - : Theme.of(context).colorScheme.onSurfaceVariant, + color: Theme.of(context).colorScheme.onSurfaceVariant, ); return Padding( padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 4), @@ -557,33 +511,21 @@ class _ArtifactGalleryPageState extends State { Widget _debugToggle(BuildContext context) { final showing = _showTurnDocuments; final label = showing ? 'Hide debugging files' : 'Show debugging files'; - // Cupertino's bundled icon font has no bug glyph; retain the universally - // recognisable Material bug icon inside its native Cupertino button. final icon = showing ? Icons.bug_report : Icons.bug_report_outlined; void onPressed() => setState(() => _showTurnDocuments = !showing); - final button = usesCupertinoHost(context) - ? CupertinoButton( - key: const Key('artifact-debug-toggle'), - padding: EdgeInsets.zero, - onPressed: onPressed, - child: Icon(icon), - ) - : IconButton( - key: const Key('artifact-debug-toggle'), - isSelected: showing, - tooltip: label, - onPressed: onPressed, - icon: Icon(icon), - ); - final semanticButton = Semantics( + final button = IconButton( + key: const Key('artifact-debug-toggle'), + isSelected: showing, + tooltip: label, + onPressed: onPressed, + icon: Icon(icon), + ); + return Semantics( label: label, button: true, toggled: showing, child: button, ); - return usesCupertinoHost(context) - ? Tooltip(message: label, child: semanticButton) - : semanticButton; } @override @@ -617,18 +559,6 @@ class _ArtifactGalleryPageState extends State { onRevealed: _revealed, ); if (widget.embedded) return body; - if (usesCupertinoHost(context)) { - // Flat sections on the page colour, as in the run and stage details; - // their pinned headings take the same colour. - return CupertinoPageScaffold( - navigationBar: SegmentedBar( - cupertino: true, - title: artifactGalleryTitle, - actions: [_debugToggle(context)], - ), - child: SafeArea(top: false, bottom: false, child: body), - ); - } return Scaffold( extendBodyBehindAppBar: true, appBar: SegmentedBar( diff --git a/app/lib/features/artifacts/ui/artifact_record_row.dart b/app/lib/features/artifacts/ui/artifact_record_row.dart index a3181228..d1838524 100644 --- a/app/lib/features/artifacts/ui/artifact_record_row.dart +++ b/app/lib/features/artifacts/ui/artifact_record_row.dart @@ -1,16 +1,13 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; import '../domain/artifact_groups.dart'; import '../domain/artifact_record.dart'; import 'artifact_row_labels.dart'; /// One recorded artifact row in a gallery section. /// -/// Material draws a standard [ListTile]; Cupertino draws the same content in a -/// grouped-row button. The row only reports the selection; it never resolves a -/// url, opens a preview, downloads, shares or filters. +/// Material draws a standard [ListTile]. The row only reports the selection; it +/// never resolves a url, opens a preview, downloads, shares or filters. class ArtifactRecordRow extends StatelessWidget { const ArtifactRecordRow({ super.key, @@ -31,58 +28,13 @@ class ArtifactRecordRow extends StatelessWidget { @override Widget build(BuildContext context) { - if (!usesCupertinoHost(context)) { - return ListTile( - selected: selected, - leading: leading, - title: Text(artifactDisplayName(artifact)), - subtitle: Text(artifactFactsLabel(artifact)), - trailing: selected ? const Icon(Icons.check) : null, - onTap: onSelected == null ? null : () => onSelected!(group, artifact), - ); - } - final textTheme = CupertinoTheme.of(context).textTheme; - final factsStyle = textTheme.textStyle.copyWith( - color: CupertinoColors.secondaryLabel.resolveFrom(context), - ); - final content = DefaultTextStyle.merge( - style: textTheme.textStyle, - child: Row( - children: [ - if (leading != null) ...[leading!, const SizedBox(width: 12)], - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(artifactDisplayName(artifact)), - Text(artifactFactsLabel(artifact), style: factsStyle), - ], - ), - ), - if (selected) const Icon(CupertinoIcons.check_mark), - ], - ), - ); - // `container` makes this row its own semantics node, so the section - // heading stays a separate header node and never covers the row. - return Semantics( - container: true, + return ListTile( selected: selected, - child: SizedBox( - width: double.infinity, - // A read-only row is not a button: a disabled CupertinoButton would - // still expose a button role to assistive technology. - child: onSelected == null - ? Padding( - padding: kCupertinoButtonPadding[CupertinoButtonSize.large]!, - child: content, - ) - : CupertinoButton( - alignment: AlignmentDirectional.centerStart, - onPressed: () => onSelected!(group, artifact), - child: content, - ), - ), + leading: leading, + title: Text(artifactDisplayName(artifact)), + subtitle: Text(artifactFactsLabel(artifact)), + trailing: selected ? const Icon(Icons.check) : null, + onTap: onSelected == null ? null : () => onSelected!(group, artifact), ); } } diff --git a/app/lib/features/artifacts/ui/artifact_selection_facts.dart b/app/lib/features/artifacts/ui/artifact_selection_facts.dart index 4b191f9a..ba947e05 100644 --- a/app/lib/features/artifacts/ui/artifact_selection_facts.dart +++ b/app/lib/features/artifacts/ui/artifact_selection_facts.dart @@ -1,8 +1,6 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../core/api_gateway.dart'; -import '../../../ui/adaptive/host.dart'; import '../../graph/domain/stage_visits.dart'; import '../domain/artifact_groups.dart'; import '../domain/artifact_record.dart'; @@ -53,14 +51,10 @@ class ArtifactSelectionFacts extends StatelessWidget { Widget build(BuildContext context) { final recordedStep = step; final url = resolved; - final cupertino = usesCupertinoHost(context); - final primaryStyle = cupertino - ? CupertinoTheme.of(context).textTheme.textStyle - : Theme.of(context).textTheme.bodyMedium ?? const TextStyle(); + final primaryStyle = + Theme.of(context).textTheme.bodyMedium ?? const TextStyle(); final secondaryStyle = primaryStyle.copyWith( - color: cupertino - ? CupertinoColors.secondaryLabel.resolveFrom(context) - : Theme.of(context).colorScheme.onSurfaceVariant, + color: Theme.of(context).colorScheme.onSurfaceVariant, ); return Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/app/lib/features/artifacts/ui/artifact_table_view.dart b/app/lib/features/artifacts/ui/artifact_table_view.dart index 38d028ee..300adbb5 100644 --- a/app/lib/features/artifacts/ui/artifact_table_view.dart +++ b/app/lib/features/artifacts/ui/artifact_table_view.dart @@ -1,7 +1,5 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; import '../domain/artifact_table.dart'; /// The truncation note for a capped table preview. @@ -31,13 +29,8 @@ class ArtifactTableView extends StatelessWidget { child: Text('The table is empty.'), ); } - final cupertino = usesCupertinoHost(context); - final border = cupertino - ? CupertinoColors.separator.resolveFrom(context) - : Theme.of(context).dividerColor; - final header = cupertino - ? CupertinoColors.secondarySystemFill.resolveFrom(context) - : Theme.of(context).colorScheme.surfaceContainerHighest; + final border = Theme.of(context).dividerColor; + final header = Theme.of(context).colorScheme.surfaceContainerHighest; final columns = table.columnCount; Widget cell(String value, {bool head = false}) => Padding( padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6), diff --git a/app/lib/features/artifacts/ui/artifact_tile.dart b/app/lib/features/artifacts/ui/artifact_tile.dart index 20ff6dcd..b0f06421 100644 --- a/app/lib/features/artifacts/ui/artifact_tile.dart +++ b/app/lib/features/artifacts/ui/artifact_tile.dart @@ -1,7 +1,5 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; import '../domain/artifact_groups.dart'; import '../domain/artifact_kind.dart'; import '../domain/artifact_record.dart'; @@ -37,21 +35,12 @@ class ArtifactTile extends StatefulWidget { class _ArtifactTileState extends State { @override Widget build(BuildContext context) { - final cupertino = usesCupertinoHost(context); final artifact = widget.artifact; - final secondary = cupertino - ? CupertinoColors.secondaryLabel.resolveFrom(context) - : Theme.of(context).colorScheme.onSurfaceVariant; - final surface = cupertino - ? CupertinoColors.tertiarySystemFill.resolveFrom(context) - : Theme.of(context).colorScheme.surfaceContainerHighest; + final secondary = Theme.of(context).colorScheme.onSurfaceVariant; + final surface = Theme.of(context).colorScheme.surfaceContainerHighest; final border = widget.selected - ? (cupertino - ? CupertinoTheme.of(context).primaryColor - : Theme.of(context).colorScheme.primary) - : (cupertino - ? CupertinoColors.separator.resolveFrom(context) - : Theme.of(context).colorScheme.outlineVariant); + ? Theme.of(context).colorScheme.primary + : Theme.of(context).colorScheme.outlineVariant; final preview = ArtifactThumbnail( artifact: artifact, configuredEndpoint: widget.configuredEndpoint, @@ -102,20 +91,14 @@ class _ArtifactTileState extends State { label: '$name, $facts', excludeSemantics: true, onTap: onSelected == null ? null : tap, - child: cupertino - ? GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: onSelected == null ? null : tap, - child: decorated, - ) - : Material( - type: MaterialType.transparency, - child: InkWell( - borderRadius: BorderRadius.circular(12), - onTap: onSelected == null ? null : tap, - child: decorated, - ), - ), + child: Material( + type: MaterialType.transparency, + child: InkWell( + borderRadius: BorderRadius.circular(12), + onTap: onSelected == null ? null : tap, + child: decorated, + ), + ), ); } } @@ -168,13 +151,10 @@ class _ArtifactThumbnailState extends State @override Widget build(BuildContext context) { super.build(context); - final cupertino = usesCupertinoHost(context); final icon = Icon( - artifactKindIcon(widget.artifact, cupertino: cupertino), + artifactKindIcon(widget.artifact, cupertino: false), size: widget.iconSize, - color: cupertino - ? CupertinoColors.secondaryLabel.resolveFrom(context) - : Theme.of(context).colorScheme.onSurfaceVariant, + color: Theme.of(context).colorScheme.onSurfaceVariant, ); if (_image == null) return Center(child: icon); return FutureBuilder( @@ -210,30 +190,26 @@ class _ArtifactThumbnailState extends State } /// The icon for an artifact's kind of file, when it has no thumbnail. +/// +/// [cupertino] is retained for callers that still pass it; the icon is always +/// the Material glyph the app draws. IconData artifactKindIcon(ArtifactRecord artifact, {required bool cupertino}) { final name = artifact.name.toLowerCase(); final format = artifactPreviewFormat(artifact.contentType, artifact.name); if (name.endsWith('.zip') || name.endsWith('.tar') || name.endsWith('.gz')) { - return cupertino ? CupertinoIcons.archivebox : Icons.folder_zip_outlined; + return Icons.folder_zip_outlined; } if (name.endsWith('.pdf')) { - return cupertino ? CupertinoIcons.doc_richtext : Icons.picture_as_pdf; + return Icons.picture_as_pdf; } return switch (format) { - ArtifactPreviewFormat.image => - cupertino ? CupertinoIcons.photo : Icons.image_outlined, - ArtifactPreviewFormat.video => - cupertino ? CupertinoIcons.film : Icons.movie_outlined, - ArtifactPreviewFormat.audio => - cupertino ? CupertinoIcons.music_note : Icons.audio_file_outlined, - ArtifactPreviewFormat.markdown => - cupertino ? CupertinoIcons.doc_text : Icons.article_outlined, - ArtifactPreviewFormat.text => - cupertino ? CupertinoIcons.doc_plaintext : Icons.description_outlined, - ArtifactPreviewFormat.table => - cupertino ? CupertinoIcons.table : Icons.table_chart_outlined, - ArtifactPreviewFormat.html => cupertino ? CupertinoIcons.globe : Icons.html, - ArtifactPreviewFormat.none => - cupertino ? CupertinoIcons.doc : Icons.insert_drive_file_outlined, + ArtifactPreviewFormat.image => Icons.image_outlined, + ArtifactPreviewFormat.video => Icons.movie_outlined, + ArtifactPreviewFormat.audio => Icons.audio_file_outlined, + ArtifactPreviewFormat.markdown => Icons.article_outlined, + ArtifactPreviewFormat.text => Icons.description_outlined, + ArtifactPreviewFormat.table => Icons.table_chart_outlined, + ArtifactPreviewFormat.html => Icons.html, + ArtifactPreviewFormat.none => Icons.insert_drive_file_outlined, }; } diff --git a/app/lib/features/artifacts/ui/artifact_video_player.dart b/app/lib/features/artifacts/ui/artifact_video_player.dart index 526087c2..b679430d 100644 --- a/app/lib/features/artifacts/ui/artifact_video_player.dart +++ b/app/lib/features/artifacts/ui/artifact_video_player.dart @@ -1,9 +1,6 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:video_player/video_player.dart'; -import '../../../ui/adaptive/host.dart'; - /// Creates the player for one media url; tests inject a fake controller. typedef ArtifactVideoControllerFactory = VideoPlayerController Function(Uri uri); @@ -84,7 +81,6 @@ class _ArtifactVideoPlayerState extends State { @override Widget build(BuildContext context) { if (_failed) return const Center(child: Text(artifactVideoError)); - final cupertino = usesCupertinoHost(context); return ValueListenableBuilder( valueListenable: _controller, builder: (context, value, _) { @@ -92,20 +88,12 @@ class _ArtifactVideoPlayerState extends State { return const Center(child: Text(artifactVideoError)); } if (!value.isInitialized) { - return Center( - child: cupertino - ? const CupertinoActivityIndicator() - : const CircularProgressIndicator(), - ); + return const Center(child: CircularProgressIndicator()); } final label = value.isPlaying ? (widget.audio ? artifactAudioPauseLabel : artifactVideoPauseLabel) : (widget.audio ? artifactAudioPlayLabel : artifactVideoPlayLabel); - final icon = cupertino - ? (value.isPlaying - ? CupertinoIcons.pause_fill - : CupertinoIcons.play_fill) - : (value.isPlaying ? Icons.pause : Icons.play_arrow); + final icon = value.isPlaying ? Icons.pause : Icons.play_arrow; return Column( key: Key(widget.audio ? 'artifact-audio' : 'artifact-video'), mainAxisSize: MainAxisSize.min, @@ -126,18 +114,12 @@ class _ArtifactVideoPlayerState extends State { padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), child: Row( children: [ - cupertino - ? CupertinoButton( - key: const Key('artifact-video-toggle'), - onPressed: _toggle, - child: Icon(icon, semanticLabel: label), - ) - : IconButton( - key: const Key('artifact-video-toggle'), - tooltip: label, - onPressed: _toggle, - icon: Icon(icon), - ), + IconButton( + key: const Key('artifact-video-toggle'), + tooltip: label, + onPressed: _toggle, + icon: Icon(icon), + ), Expanded( child: VideoProgressIndicator( _controller, diff --git a/app/lib/features/artifacts/ui/artifact_viewer_bar.dart b/app/lib/features/artifacts/ui/artifact_viewer_bar.dart index b82adb2e..fa6a7c61 100644 --- a/app/lib/features/artifacts/ui/artifact_viewer_bar.dart +++ b/app/lib/features/artifacts/ui/artifact_viewer_bar.dart @@ -4,7 +4,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../ui/adaptive/glass_bar.dart'; -import '../../../ui/adaptive/host.dart'; import '../../../ui/navigation/chevron_pager.dart'; import '../actions/artifact_file_actions.dart'; import '../actions/artifact_file_bridge.dart'; @@ -60,11 +59,8 @@ class ArtifactViewerBar extends StatelessWidget { @override Widget build(BuildContext context) { - final cupertino = usesCupertinoHost(context); final actions = _actions(resolved, onFullscreen); - final pagerMin = count > 1 - ? 2 * GlassBarMetrics.controlExtent(cupertino) - : 0.0; + final pagerMin = count > 1 ? 2 * GlassBarMetrics.controlExtent(false) : 0.0; final pager = ChevronPager( index: index, count: count, @@ -87,7 +83,7 @@ class ArtifactViewerBar extends StatelessWidget { alignment: AlignmentDirectional.centerStart, heightFactor: 1, child: GlassControlBar( - cupertino: cupertino, + cupertino: false, child: LayoutBuilder( builder: (context, constraints) => Row( key: const Key('artifact-viewer-actions'), diff --git a/app/lib/features/artifacts/ui/artifact_viewer_body.dart b/app/lib/features/artifacts/ui/artifact_viewer_body.dart index 4c711c98..c890866d 100644 --- a/app/lib/features/artifacts/ui/artifact_viewer_body.dart +++ b/app/lib/features/artifacts/ui/artifact_viewer_body.dart @@ -3,7 +3,6 @@ import 'dart:typed_data'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; import '../../../ui/adaptive/floating_bar_layout.dart'; import '../actions/artifact_file_actions.dart'; import '../actions/artifact_file_bridge.dart'; @@ -170,20 +169,6 @@ class ArtifactViewerInfoAction extends StatelessWidget { final Widget facts; void _show(BuildContext context) { - if (usesCupertinoHost(context)) { - showCupertinoModalPopup( - context: context, - builder: (context) => CupertinoPopupSurface( - child: SafeArea( - child: SingleChildScrollView( - padding: const EdgeInsets.all(16), - child: facts, - ), - ), - ), - ); - return; - } showModalBottomSheet( context: context, showDragHandle: true, diff --git a/app/lib/features/artifacts/ui/artifact_viewer_content.dart b/app/lib/features/artifacts/ui/artifact_viewer_content.dart index b7aba945..64d27932 100644 --- a/app/lib/features/artifacts/ui/artifact_viewer_content.dart +++ b/app/lib/features/artifacts/ui/artifact_viewer_content.dart @@ -1,10 +1,7 @@ import 'dart:typed_data'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; - import '../domain/artifact_preview.dart'; import 'artifact_html_view.dart'; import 'artifact_table_view.dart'; @@ -219,24 +216,12 @@ class _ZoomableImageState extends State<_ZoomableImage> { PositionedDirectional( top: 8, end: 8, - child: usesCupertinoHost(context) - ? Tooltip( - message: 'Reset image zoom', - child: CupertinoButton( - key: const Key('artifact-image-reset-zoom'), - sizeStyle: CupertinoButtonSize.small, - onPressed: _reset, - child: const Icon( - CupertinoIcons.arrow_down_right_arrow_up_left, - ), - ), - ) - : IconButton( - key: const Key('artifact-image-reset-zoom'), - tooltip: 'Reset image zoom', - onPressed: _reset, - icon: const Icon(Icons.zoom_out_map), - ), + child: IconButton( + key: const Key('artifact-image-reset-zoom'), + tooltip: 'Reset image zoom', + onPressed: _reset, + icon: const Icon(Icons.zoom_out_map), + ), ), ], ); @@ -272,7 +257,6 @@ class _Message extends StatelessWidget { @override Widget build(BuildContext context) { final retry = onRetry; - final cupertino = usesCupertinoHost(context); return Center( child: Padding( padding: const EdgeInsets.all(16), @@ -282,18 +266,11 @@ class _Message extends StatelessWidget { Text(message, textAlign: TextAlign.center), if (retry != null) ...[ const SizedBox(height: 12), - cupertino - ? CupertinoButton.tinted( - key: artifactPreviewRetryKey, - sizeStyle: CupertinoButtonSize.small, - onPressed: retry, - child: const Text('Retry'), - ) - : FilledButton.tonal( - key: artifactPreviewRetryKey, - onPressed: retry, - child: const Text('Retry'), - ), + FilledButton.tonal( + key: artifactPreviewRetryKey, + onPressed: retry, + child: const Text('Retry'), + ), ], ], ), diff --git a/app/lib/features/artifacts/ui/artifact_viewer_scaffold.dart b/app/lib/features/artifacts/ui/artifact_viewer_scaffold.dart index e1a17a3b..d26b47d0 100644 --- a/app/lib/features/artifacts/ui/artifact_viewer_scaffold.dart +++ b/app/lib/features/artifacts/ui/artifact_viewer_scaffold.dart @@ -1,12 +1,9 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; import '../../../ui/adaptive/segmented_bar.dart'; -import '../../../ui/theme/app_theme.dart'; -/// The viewer's page structure on either host: its [SegmentedBar] (the -/// platform's Back, or Close on the full-screen route) over [body]. +/// The viewer's page structure: its [SegmentedBar] (the platform's Back, or +/// Close on the full-screen route) over [body]. class ArtifactViewerScaffold extends StatelessWidget { const ArtifactViewerScaffold({ super.key, @@ -23,20 +20,12 @@ class ArtifactViewerScaffold extends StatelessWidget { @override Widget build(BuildContext context) { - final cupertino = usesCupertinoHost(context); final bar = SegmentedBar( - cupertino: cupertino, + cupertino: false, title: title, subtitle: subtitle, actions: actions, ); - if (cupertino) { - return CupertinoPageScaffold( - backgroundColor: AppColors.groupedBackground, - navigationBar: bar, - child: body, - ); - } return Scaffold(extendBodyBehindAppBar: true, appBar: bar, body: body); } } diff --git a/app/lib/features/artifacts/ui/artifact_visit_list.dart b/app/lib/features/artifacts/ui/artifact_visit_list.dart index f9bb2199..6aef1c5e 100644 --- a/app/lib/features/artifacts/ui/artifact_visit_list.dart +++ b/app/lib/features/artifacts/ui/artifact_visit_list.dart @@ -1,9 +1,7 @@ import 'dart:math' as math; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; import '../domain/artifact_groups.dart'; import '../../../ui/layout/section_heading.dart'; import '../../../ui/layout/sticky_section.dart'; @@ -29,11 +27,10 @@ export 'artifact_row_labels.dart' /// artifacts. When [showTurnDocuments] is on, its debugging documents follow /// those artifacts in the same visit. Every recorded row shows its recorded /// filename, content type and size; a turn document the visit did not record -/// stays a non-actionable row with the exact absence wording. Rendering uses the host's -/// own controls: Material list tiles under [MaterialApp] and grouped Cupertino -/// list sections under [CupertinoApp]. An optional [header] leads the same -/// scroll view. It never resolves a url, opens a preview, downloads, shares or -/// filters. +/// stays a non-actionable row with the exact absence wording. Rendering uses +/// the host's own controls: Material list tiles under [MaterialApp]. An +/// optional [header] leads the same scroll view. It never resolves a url, +/// opens a preview, downloads, shares or filters. /// How the gallery lays out each visit's artifacts. enum ArtifactGalleryMode { grid, list } @@ -257,43 +254,24 @@ class _ArtifactVisitListState extends State { ); Widget _modeSwitch(BuildContext context) { - final cupertino = usesCupertinoHost(context); - final control = cupertino - ? CupertinoSlidingSegmentedControl( - key: const Key('artifact-gallery-mode'), - groupValue: _mode, - onValueChanged: (mode) { - if (mode != null) _setMode(mode); - }, - children: const { - ArtifactGalleryMode.grid: Icon( - CupertinoIcons.square_grid_2x2, - semanticLabel: 'Grid', - ), - ArtifactGalleryMode.list: Icon( - CupertinoIcons.list_bullet, - semanticLabel: 'List', - ), - }, - ) - : SegmentedButton( - key: const Key('artifact-gallery-mode'), - showSelectedIcon: false, - segments: const [ - ButtonSegment( - value: ArtifactGalleryMode.grid, - icon: Icon(Icons.grid_view), - tooltip: 'Grid', - ), - ButtonSegment( - value: ArtifactGalleryMode.list, - icon: Icon(Icons.view_list), - tooltip: 'List', - ), - ], - selected: {_mode}, - onSelectionChanged: (mode) => _setMode(mode.single), - ); + final control = SegmentedButton( + key: const Key('artifact-gallery-mode'), + showSelectedIcon: false, + segments: const [ + ButtonSegment( + value: ArtifactGalleryMode.grid, + icon: Icon(Icons.grid_view), + tooltip: 'Grid', + ), + ButtonSegment( + value: ArtifactGalleryMode.list, + icon: Icon(Icons.view_list), + tooltip: 'List', + ), + ], + selected: {_mode}, + onSelectionChanged: (mode) => _setMode(mode.single), + ); return Padding( padding: const EdgeInsetsDirectional.fromSTEB(16, 4, 16, 4), child: Align(alignment: AlignmentDirectional.centerEnd, child: control), @@ -303,9 +281,7 @@ class _ArtifactVisitListState extends State { /// Rows keep a Material surface for their ink, as the section body's own /// surface was when it was one box around every row. Widget _inkSurface(BuildContext context, Widget child) => - usesCupertinoHost(context) - ? child - : Material(type: MaterialType.transparency, child: child); + Material(type: MaterialType.transparency, child: child); /// The list view: one row per artifact with a small thumbnail beside it. Widget _list(ArtifactGroup group) => SliverList.builder( diff --git a/app/test/features/artifacts/actions/artifact_file_actions_test.dart b/app/test/features/artifacts/actions/artifact_file_actions_test.dart index 7532a6a3..36569c10 100644 --- a/app/test/features/artifacts/actions/artifact_file_actions_test.dart +++ b/app/test/features/artifacts/actions/artifact_file_actions_test.dart @@ -1,6 +1,5 @@ import 'dart:typed_data'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -59,7 +58,6 @@ Future _fetch(Uri uri) async => ArtifactFetchResult(status: 200, bytes: _bytes); Widget _row({ - required bool cupertino, ArtifactFileBridge? bridge, ArtifactRecord? artifact, ArtifactFetch? fetch, @@ -70,19 +68,11 @@ Widget _row({ fetch: fetch ?? _fetch, bridge: bridge ?? _bridge(), ); - return cupertino - ? CupertinoApp( - home: CupertinoPageScaffold( - child: SafeArea( - child: Padding(padding: const EdgeInsets.all(8), child: actions), - ), - ), - ) - : MaterialApp( - home: Scaffold( - body: Padding(padding: const EdgeInsets.all(8), child: actions), - ), - ); + return MaterialApp( + home: Scaffold( + body: Padding(padding: const EdgeInsets.all(8), child: actions), + ), + ); } TextButton _materialButton(WidgetTester tester, String label) => @@ -92,24 +82,12 @@ TextButton _materialButton(WidgetTester tester, String label) => .first, ); -CupertinoButton _cupertinoButton(WidgetTester tester, String label) => - tester.widget( - find - .ancestor( - of: find.text(label), - matching: find.byType(CupertinoButton), - ) - .first, - ); - void main() { testWidgets('Download saves the exact named bytes and reports it', ( tester, ) async { final saved = []; - await tester.pumpWidget( - _row(cupertino: false, bridge: _bridge(saved: saved)), - ); + await tester.pumpWidget(_row(bridge: _bridge(saved: saved))); await tester.tap(find.text('Download')); await tester.pumpAndSettle(); @@ -123,9 +101,7 @@ void main() { testWidgets('Share starts one file transfer, not a link', (tester) async { final shared = []; - await tester.pumpWidget( - _row(cupertino: false, bridge: _bridge(shared: shared)), - ); + await tester.pumpWidget(_row(bridge: _bridge(shared: shared))); await tester.tap(find.text('Share')); await tester.pumpAndSettle(); @@ -140,10 +116,7 @@ void main() { ) async { final saved = []; await tester.pumpWidget( - _row( - cupertino: false, - bridge: _bridge(saved: saved, shareSupported: false), - ), + _row(bridge: _bridge(saved: saved, shareSupported: false)), ); expect(find.text('No share on this host.'), findsOneWidget); @@ -160,7 +133,6 @@ void main() { ) async { await tester.pumpWidget( _row( - cupertino: false, bridge: _bridge(), fetch: (_) => Future.delayed( const Duration(seconds: 30), @@ -183,9 +155,7 @@ void main() { await tester.pump(const Duration(seconds: 31)); }); - testWidgets('both hosts keep the file actions whole at 320/2x dark', ( - tester, - ) async { + testWidgets('the file actions stay whole at 320/2x dark', (tester) async { tester.view.physicalSize = const Size(640, 1200); tester.view.devicePixelRatio = 2; tester.platformDispatcher.textScaleFactorTestValue = 2; @@ -195,20 +165,12 @@ void main() { addTearDown(tester.platformDispatcher.clearTextScaleFactorTestValue); addTearDown(tester.platformDispatcher.clearPlatformBrightnessTestValue); - for (final cupertino in [false, true]) { - await tester.pumpWidget(_row(cupertino: cupertino)); - await tester.pumpAndSettle(); - expect(tester.takeException(), isNull); - expect(find.text('Download'), findsOneWidget); - expect(find.text('Share'), findsOneWidget); - if (cupertino) { - expect(_cupertinoButton(tester, 'Download').onPressed, isNotNull); - expect(find.byType(TextButton), findsNothing); - } else { - expect(_materialButton(tester, 'Download').onPressed, isNotNull); - expect(find.byType(CupertinoButton), findsNothing); - } - } + await tester.pumpWidget(_row()); + await tester.pumpAndSettle(); + expect(tester.takeException(), isNull); + expect(find.text('Download'), findsOneWidget); + expect(find.text('Share'), findsOneWidget); + expect(_materialButton(tester, 'Download').onPressed, isNotNull); }); testWidgets('the gallery selection offers both file actions in its dialog', ( @@ -315,44 +277,27 @@ void main() { ], ), ]; - for (final cupertino in [false, true]) { - await tester.pumpWidget( - cupertino - ? CupertinoApp( - theme: const CupertinoThemeData(brightness: Brightness.dark), - home: ArtifactGalleryPage( - steps: steps, - configuredEndpoint: _endpoint, - fetch: _fetch, - fileBridge: _bridge(), - ), - ) - : MaterialApp( - theme: ThemeData(brightness: Brightness.dark), - home: ArtifactGalleryPage( - steps: steps, - configuredEndpoint: _endpoint, - fetch: _fetch, - fileBridge: _bridge(), - ), - ), - ); - await tester.pumpAndSettle(); - await tester.tap(find.text('report.zip')); - await tester.pumpAndSettle(); + await tester.pumpWidget( + MaterialApp( + theme: ThemeData(brightness: Brightness.dark), + home: ArtifactGalleryPage( + steps: steps, + configuredEndpoint: _endpoint, + fetch: _fetch, + fileBridge: _bridge(), + ), + ), + ); + await tester.pumpAndSettle(); + await tester.tap(find.text('report.zip')); + await tester.pumpAndSettle(); - expect(tester.takeException(), isNull); - expect(find.text('Download'), findsOneWidget); - expect(find.text('Share'), findsOneWidget); - expect( - cupertino - ? find.byType(CupertinoAlertDialog) - : find.byType(AlertDialog), - findsOneWidget, - ); - await tester.tap(find.text('Close')); - await tester.pumpAndSettle(); - } + expect(tester.takeException(), isNull); + expect(find.text('Download'), findsOneWidget); + expect(find.text('Share'), findsOneWidget); + expect(find.byType(AlertDialog), findsOneWidget); + await tester.tap(find.text('Close')); + await tester.pumpAndSettle(); }); testWidgets( diff --git a/app/test/features/artifacts/ui/artifact_fullscreen_test.dart b/app/test/features/artifacts/ui/artifact_fullscreen_test.dart index 2a06125c..7accb49a 100644 --- a/app/test/features/artifacts/ui/artifact_fullscreen_test.dart +++ b/app/test/features/artifacts/ui/artifact_fullscreen_test.dart @@ -1,6 +1,5 @@ import 'dart:convert'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -33,9 +32,8 @@ final ArtifactGroup _group = visitGroup(artifacts: [_report, _log]); typedef _Rendered = List<(String, bool)>; Future<({_Rendered rendered, List opened})> _pump( - WidgetTester tester, { - bool cupertino = false, -}) async { + WidgetTester tester, +) async { final rendered = <(String, bool)>[]; final opened = []; final page = ArtifactViewerPage( @@ -61,17 +59,13 @@ Future<({_Rendered rendered, List opened})> _pump( children: [ Expanded( child: Navigator( - onGenerateRoute: (_) => cupertino - ? CupertinoPageRoute(builder: (_) => page) - : MaterialPageRoute(builder: (_) => page), + onGenerateRoute: (_) => MaterialPageRoute(builder: (_) => page), ), ), const SizedBox(key: _shellBar, height: 56, child: Text('Tabs')), ], ); - await tester.pumpWidget( - cupertino ? CupertinoApp(home: shell) : MaterialApp(home: shell), - ); + await tester.pumpWidget(MaterialApp(home: shell)); await tester.pumpAndSettle(); return (rendered: rendered, opened: opened); } @@ -81,61 +75,53 @@ Future _enter(WidgetTester tester) async { await tester.pumpAndSettle(); } -/// A bar control by its accessible name: the Material button's tooltip, the -/// Cupertino button's semantics label. -Finder _named(bool cupertino, String name) => - cupertino ? find.bySemanticsLabel(name) : find.byTooltip(name); +/// A bar control by its Material tooltip. +Finder _named(String name) => find.byTooltip(name); void main() { - for (final cupertino in [false, true]) { - final host = cupertino ? 'Cupertino' : 'Material'; + testWidgets('the bottom actions offer Full screen', (tester) async { + final result = await _pump(tester); + final bar = find.byKey(const Key('artifact-viewer-actions')); + expect( + find.descendant(of: bar, matching: find.byKey(artifactFullscreenKey)), + findsOneWidget, + ); + expect(_named('Full screen'), findsOneWidget); + expect(result.rendered.single, ('

Hi

', false)); + }); - testWidgets('$host: the bottom actions offer Full screen', (tester) async { - final result = await _pump(tester, cupertino: cupertino); - final bar = find.byKey(const Key('artifact-viewer-actions')); - expect( - find.descendant(of: bar, matching: find.byKey(artifactFullscreenKey)), - findsOneWidget, - ); - expect(_named(cupertino, 'Full screen'), findsOneWidget); - expect(result.rendered.single, ('

Hi

', false)); - }); + testWidgets('full screen covers the shell, keeps the actions and ' + 'renders the fetched document in the app', (tester) async { + final result = await _pump(tester); + await _enter(tester); - testWidgets('$host: full screen covers the shell, keeps the actions and ' - 'renders the fetched document in the app', (tester) async { - final result = await _pump(tester, cupertino: cupertino); - await _enter(tester); + expect(find.byKey(_shellBar), findsNothing); + // The same document, fetched once with the app's session, now in the + // full-screen scope; nothing was handed to the system browser. + expect(result.rendered.last, ('

Hi

', true)); + expect(result.opened, isEmpty); + final bar = find.byKey(const Key('artifact-viewer-actions')); + expect(bar, findsOneWidget); + for (final key in const [ + Key('artifact-open'), + Key('artifact-copy-link'), + artifactPreviousKey, + artifactNextKey, + ]) { + expect(find.descendant(of: bar, matching: find.byKey(key)), findsOne); + } + expect(_named('Exit full screen'), findsOneWidget); + expect(_named('Open in browser'), findsOneWidget); + }); - expect(find.byKey(_shellBar), findsNothing); - // The same document, fetched once with the app's session, now in the - // full-screen scope; nothing was handed to the system browser. - expect(result.rendered.last, ('

Hi

', true)); - expect(result.opened, isEmpty); - final bar = find.byKey(const Key('artifact-viewer-actions')); - expect(bar, findsOneWidget); - for (final key in const [ - Key('artifact-open'), - Key('artifact-copy-link'), - artifactPreviousKey, - artifactNextKey, - ]) { - expect(find.descendant(of: bar, matching: find.byKey(key)), findsOne); - } - expect(_named(cupertino, 'Exit full screen'), findsOneWidget); - expect(_named(cupertino, 'Open in browser'), findsOneWidget); - }); - - testWidgets('$host: Exit full screen returns to the viewer', ( - tester, - ) async { - await _pump(tester, cupertino: cupertino); - await _enter(tester); - await tester.tap(find.byKey(artifactFullscreenKey)); - await tester.pumpAndSettle(); - expect(find.byKey(_shellBar), findsOneWidget); - expect(_named(cupertino, 'Full screen'), findsOneWidget); - }); - } + testWidgets('Exit full screen returns to the viewer', (tester) async { + await _pump(tester); + await _enter(tester); + await tester.tap(find.byKey(artifactFullscreenKey)); + await tester.pumpAndSettle(); + expect(find.byKey(_shellBar), findsOneWidget); + expect(_named('Full screen'), findsOneWidget); + }); testWidgets('Escape and the system back leave full screen', (tester) async { await _pump(tester); diff --git a/app/test/features/artifacts/ui/artifact_gallery_debug_files_test.dart b/app/test/features/artifacts/ui/artifact_gallery_debug_files_test.dart index 2cc8edc3..73e7baec 100644 --- a/app/test/features/artifacts/ui/artifact_gallery_debug_files_test.dart +++ b/app/test/features/artifacts/ui/artifact_gallery_debug_files_test.dart @@ -1,6 +1,5 @@ import 'dart:typed_data'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -9,8 +8,6 @@ import 'package:pipelines_app/features/artifacts/ui/artifact_viewer_fetch.dart'; import '../domain/artifact_fixtures.dart'; -enum _Platform { material, cupertino } - JsonMap _file(String name, String group) => artifact( name, contentType: 'text/markdown', @@ -36,7 +33,7 @@ List _steps() => [ ), ]; -Future _pump(WidgetTester tester, _Platform platform) async { +Future _pump(WidgetTester tester) async { tester.view.physicalSize = const Size(900, 2600); tester.view.devicePixelRatio = 1; addTearDown(tester.view.resetPhysicalSize); @@ -49,43 +46,37 @@ Future _pump(WidgetTester tester, _Platform platform) async { ArtifactFetchResult(status: 200, bytes: Uint8List.fromList([35])), markdownBuilder: (context, value) => Text(value), ); - await tester.pumpWidget( - platform == _Platform.material - ? MaterialApp(home: page) - : CupertinoApp(home: page), - ); + await tester.pumpWidget(MaterialApp(home: page)); await tester.pumpAndSettle(); } void main() { - for (final platform in _Platform.values) { - testWidgets('${platform.name}: only deliverables show until Debugging ' - 'files is revealed', (tester) async { - await _pump(tester, platform); - expect(find.text('public/report.md'), findsOneWidget); - for (final name in [ - 'history.md', - 'memory.md', - 'input.md', - 'private/scratch.md', - ]) { - expect(find.text(name), findsNothing, reason: name); - } - expect(find.text('Debugging files'), findsNothing); + testWidgets('only deliverables show until Debugging ' + 'files is revealed', (tester) async { + await _pump(tester); + expect(find.text('public/report.md'), findsOneWidget); + for (final name in [ + 'history.md', + 'memory.md', + 'input.md', + 'private/scratch.md', + ]) { + expect(find.text(name), findsNothing, reason: name); + } + expect(find.text('Debugging files'), findsNothing); - await tester.tap(find.byKey(const Key('artifact-debug-toggle'))); - await tester.pumpAndSettle(); - expect(find.text('Debugging files'), findsOneWidget); - for (final name in [ - 'history.md', - 'memory.md', - 'input.md', - 'output.md', - 'private/scratch.md', - ]) { - expect(find.text(name), findsOneWidget, reason: name); - } - expect(find.text('public/report.md'), findsOneWidget); - }); - } + await tester.tap(find.byKey(const Key('artifact-debug-toggle'))); + await tester.pumpAndSettle(); + expect(find.text('Debugging files'), findsOneWidget); + for (final name in [ + 'history.md', + 'memory.md', + 'input.md', + 'output.md', + 'private/scratch.md', + ]) { + expect(find.text(name), findsOneWidget, reason: name); + } + expect(find.text('public/report.md'), findsOneWidget); + }); } diff --git a/app/test/features/artifacts/ui/artifact_gallery_documents_test.dart b/app/test/features/artifacts/ui/artifact_gallery_documents_test.dart index 177558aa..3c6852c2 100644 --- a/app/test/features/artifacts/ui/artifact_gallery_documents_test.dart +++ b/app/test/features/artifacts/ui/artifact_gallery_documents_test.dart @@ -1,6 +1,5 @@ import 'dart:typed_data'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -11,8 +10,6 @@ import 'package:pipelines_app/features/artifacts/ui/artifact_viewer_page.dart'; import '../domain/artifact_fixtures.dart'; -enum _Platform { material, cupertino } - const String _endpoint = 'ws://127.0.0.1:8081/connect'; JsonMap _recorded( @@ -48,8 +45,7 @@ List _steps() => [ ]; Future _pump( - WidgetTester tester, - _Platform platform, { + WidgetTester tester, { List? steps, ArtifactFetch? fetch, ArtifactExternalOpen? openExternal, @@ -72,11 +68,7 @@ Future _pump( ), markdownBuilder: (context, value) => Text(value), ); - await tester.pumpWidget( - platform == _Platform.material - ? MaterialApp(home: page) - : CupertinoApp(home: page), - ); + await tester.pumpWidget(MaterialApp(home: page)); await tester.pumpAndSettle(); } @@ -85,230 +77,194 @@ Future _showTurnDocuments(WidgetTester tester) async { await tester.pumpAndSettle(); } -Finder _dialog(_Platform platform, String text) => find.descendant( - of: find.byType( - platform == _Platform.material ? AlertDialog : CupertinoAlertDialog, - ), - matching: find.text(text), -); +Finder _dialog(String text) => + find.descendant(of: find.byType(AlertDialog), matching: find.text(text)); void main() { - for (final platform in _Platform.values) { - testWidgets('${platform.name}: debug hides documents by default and shows ' - 'each visit when enabled', (tester) async { - await _pump(tester, platform); - expect(find.text('input.md'), findsNothing); - expect(find.textContaining('Turn documents'), findsNothing); - expect(find.byTooltip('Show debugging files'), findsOneWidget); - await _showTurnDocuments(tester); - expect(find.byTooltip('Hide debugging files'), findsOneWidget); - expect(find.text('input.md'), findsNWidgets(2)); - expect(find.text('output.md'), findsNWidgets(2)); - expect(find.text('session.html'), findsNWidgets(2)); - expect(find.text('memory.md'), findsNWidgets(2)); - expect(find.text('text/markdown · 120\u00a0B'), findsOneWidget); - expect(find.text('text/plain · 512\u00a0B'), findsOneWidget); - }); + testWidgets('debug hides documents by default and shows ' + 'each visit when enabled', (tester) async { + await _pump(tester); + expect(find.text('input.md'), findsNothing); + expect(find.textContaining('Turn documents'), findsNothing); + expect(find.byTooltip('Show debugging files'), findsOneWidget); + await _showTurnDocuments(tester); + expect(find.byTooltip('Hide debugging files'), findsOneWidget); + expect(find.text('input.md'), findsNWidgets(2)); + expect(find.text('output.md'), findsNWidgets(2)); + expect(find.text('session.html'), findsNWidgets(2)); + expect(find.text('memory.md'), findsNWidgets(2)); + expect(find.text('text/markdown · 120\u00a0B'), findsOneWidget); + expect(find.text('text/plain · 512\u00a0B'), findsOneWidget); + }); - testWidgets('${platform.name}: missing documents show exact wording', ( + testWidgets('missing documents show exact wording', (tester) async { + await _pump(tester); + await _showTurnDocuments(tester); + expect(find.text('No memory recorded for this visit.'), findsOneWidget); + expect(find.text('No output recorded.'), findsOneWidget); + expect(find.text('This visit has no harness session.'), findsOneWidget); + expect(find.text('No input recorded.'), findsNothing); + }); + + testWidgets('markdown opens the existing renderer', (tester) async { + await _pump(tester); + await _showTurnDocuments(tester); + await tester.tap(find.text('input.md').first); + await tester.pumpAndSettle(); + expect(find.byType(ArtifactViewerPage), findsOneWidget); + expect(find.text('# Recorded input'), findsOneWidget); + await tester.tap(find.byKey(const Key('artifact-info'))); + await tester.pumpAndSettle(); + expect(find.text('review · visit 1'), findsOneWidget); + expect(find.text('text/markdown · 120\u00a0B'), findsOneWidget); + }); + + testWidgets('absent rows are informational, not controls', (tester) async { + await _pump(tester); + await _showTurnDocuments(tester); + final absence = find.text('No output recorded.'); + expect(absence, findsOneWidget); + // Not disabled: the absence line is content, not a skipped action, and + // is painted with the normal secondary label colour. + final tile = tester.widget( + find.ancestor(of: absence, matching: find.byType(ListTile)), + ); + expect(tile.enabled, isTrue); + expect(tile.onTap, isNull); + expect( + tester.widget(absence).style?.color, + Theme.of(tester.element(absence)).colorScheme.onSurfaceVariant, + ); + await tester.tap(absence); + await tester.pumpAndSettle(); + expect(find.byType(ArtifactViewerPage), findsNothing); + expect(find.byType(AlertDialog), findsNothing); + }); + + testWidgets('session.html stays external-only', (tester) async { + final opened = []; + await _pump( tester, - ) async { - await _pump(tester, platform); - await _showTurnDocuments(tester); - expect(find.text('No memory recorded for this visit.'), findsOneWidget); - expect(find.text('No output recorded.'), findsOneWidget); - expect(find.text('This visit has no harness session.'), findsOneWidget); - expect(find.text('No input recorded.'), findsNothing); - }); - - testWidgets('${platform.name}: markdown opens the existing renderer', ( - tester, - ) async { - await _pump(tester, platform); - await _showTurnDocuments(tester); - await tester.tap(find.text('input.md').first); - await tester.pumpAndSettle(); - expect(find.byType(ArtifactViewerPage), findsOneWidget); - expect(find.text('# Recorded input'), findsOneWidget); - await tester.tap(find.byKey(const Key('artifact-info'))); - await tester.pumpAndSettle(); - expect(find.text('review · visit 1'), findsOneWidget); - expect(find.text('text/markdown · 120\u00a0B'), findsOneWidget); - }); - - testWidgets( - '${platform.name}: absent rows are informational, not controls', - (tester) async { - await _pump(tester, platform); - await _showTurnDocuments(tester); - final absence = find.text('No output recorded.'); - expect(absence, findsOneWidget); - if (platform == _Platform.material) { - // Not disabled: the absence line is content, not a skipped action, and - // is painted with the normal secondary label colour. - final tile = tester.widget( - find.ancestor(of: absence, matching: find.byType(ListTile)), - ); - expect(tile.enabled, isTrue); - expect(tile.onTap, isNull); - expect( - tester.widget(absence).style?.color, - Theme.of(tester.element(absence)).colorScheme.onSurfaceVariant, - ); - } else { - expect( - find.ancestor(of: absence, matching: find.byType(CupertinoButton)), - findsNothing, - ); - } - await tester.tap(absence); - await tester.pumpAndSettle(); - expect(find.byType(ArtifactViewerPage), findsNothing); - expect(find.byType(AlertDialog), findsNothing); - expect(find.byType(CupertinoAlertDialog), findsNothing); + openExternal: (uri) async { + opened.add(uri); + return true; }, + fetch: (_) async => throw StateError('x'), + ); + await _showTurnDocuments(tester); + await tester.tap(find.text('session.html').first); + await tester.pumpAndSettle(); + expect(find.byType(ArtifactViewerPage), findsNothing); + expect(_dialog('session.html'), findsOneWidget); + expect(_dialog('text/plain · 512\u00a0B'), findsOneWidget); + await tester.tap(_dialog('Open in browser')); + await tester.pumpAndSettle(); + expect(find.byType(ArtifactViewerPage), findsNothing); + expect(opened, [ + Uri.parse('http://127.0.0.1:8081/artifacts/1/1/session.html'), + ]); + }); + + testWidgets('a stage artifact pages only through stage ' + 'artifacts while Debug is off', (tester) async { + await _pump(tester); + + // report.csv (visit 1) and notes.md (visit 2) are the only stage + // artifacts; the visits' turn documents stay out of the viewer. + await tester.tap(find.text('report.csv')); + await tester.pumpAndSettle(); + expect(find.byType(ArtifactViewerPage), findsOneWidget); + expect(find.text('1 of 2 · text/csv'), findsOneWidget); + }); + + testWidgets('with Debug on, a stage artifact pages ' + 'through turn documents too', (tester) async { + await _pump(tester); + await _showTurnDocuments(tester); + + await tester.tap(find.text('report.csv')); + await tester.pumpAndSettle(); + expect(find.byType(ArtifactViewerPage), findsOneWidget); + // Both stage artifacts plus the recorded viewer documents + // (session.html opens externally only). + expect(find.text('1 of 6 · text/csv'), findsOneWidget); + }); + + testWidgets('documents do not count as artifacts and ' + 'viewer paging stays within documents', (tester) async { + await _pump( + tester, + steps: [ + step( + stage: 'review', + visit: 1, + artifacts: [ + _recorded('report.csv', contentType: 'text/csv', sizeBytes: 23), + _recorded('input.md', contentType: 'text/markdown', sizeBytes: 1), + _recorded('output.md', contentType: 'text/markdown', sizeBytes: 1), + ], + ), + ], ); - testWidgets('${platform.name}: session.html stays external-only', ( + expect(find.text('Artifact · 1 recorded'), findsOneWidget); + expect(find.text('report.csv'), findsOneWidget); + expect(find.text('input.md'), findsNothing); + await _showTurnDocuments(tester); + await tester.tap(find.text('input.md')); + await tester.pumpAndSettle(); + expect(find.byType(ArtifactViewerPage), findsOneWidget); + expect(find.text('1 of 2 · text/markdown'), findsOneWidget); + }); + + testWidgets('document-only visits retain an honest empty ' + 'artifact state', (tester) async { + await _pump( tester, - ) async { - final opened = []; - await _pump( - tester, - platform, - openExternal: (uri) async { - opened.add(uri); - return true; - }, - fetch: (_) async => throw StateError('x'), - ); - await _showTurnDocuments(tester); - await tester.tap(find.text('session.html').first); - await tester.pumpAndSettle(); - expect(find.byType(ArtifactViewerPage), findsNothing); - expect(_dialog(platform, 'session.html'), findsOneWidget); - expect(_dialog(platform, 'text/plain · 512\u00a0B'), findsOneWidget); - await tester.tap(_dialog(platform, 'Open in browser')); - await tester.pumpAndSettle(); - expect(find.byType(ArtifactViewerPage), findsNothing); - expect(opened, [ - Uri.parse('http://127.0.0.1:8081/artifacts/1/1/session.html'), - ]); - }); + steps: [ + step( + stage: 'review', + visit: 1, + artifacts: [ + _recorded('input.md', contentType: 'text/markdown', sizeBytes: 1), + ], + ), + ], + ); - testWidgets('${platform.name}: a stage artifact pages only through stage ' - 'artifacts while Debug is off', (tester) async { - await _pump(tester, platform); + expect(find.text('No artifacts recorded for this run.'), findsOneWidget); + expect(find.text('input.md'), findsNothing); + await _showTurnDocuments(tester); + expect(find.text('input.md'), findsOneWidget); + }); - // report.csv (visit 1) and notes.md (visit 2) are the only stage - // artifacts; the visits' turn documents stay out of the viewer. - await tester.tap(find.text('report.csv')); - await tester.pumpAndSettle(); - expect(find.byType(ArtifactViewerPage), findsOneWidget); - expect(find.text('1 of 2 · text/csv'), findsOneWidget); - }); - - testWidgets('${platform.name}: with Debug on, a stage artifact pages ' - 'through turn documents too', (tester) async { - await _pump(tester, platform); - await _showTurnDocuments(tester); - - await tester.tap(find.text('report.csv')); - await tester.pumpAndSettle(); - expect(find.byType(ArtifactViewerPage), findsOneWidget); - // Both stage artifacts plus the recorded viewer documents - // (session.html opens externally only). - expect(find.text('1 of 6 · text/csv'), findsOneWidget); - }); - - testWidgets('${platform.name}: documents do not count as artifacts and ' - 'viewer paging stays within documents', (tester) async { - await _pump( - tester, - platform, - steps: [ - step( - stage: 'review', - visit: 1, - artifacts: [ - _recorded('report.csv', contentType: 'text/csv', sizeBytes: 23), - _recorded('input.md', contentType: 'text/markdown', sizeBytes: 1), - _recorded( - 'output.md', - contentType: 'text/markdown', - sizeBytes: 1, - ), - ], - ), - ], - ); - - expect(find.text('Artifact · 1 recorded'), findsOneWidget); - expect(find.text('report.csv'), findsOneWidget); - expect(find.text('input.md'), findsNothing); - await _showTurnDocuments(tester); - await tester.tap(find.text('input.md')); - await tester.pumpAndSettle(); - expect(find.byType(ArtifactViewerPage), findsOneWidget); - expect(find.text('1 of 2 · text/markdown'), findsOneWidget); - }); - - testWidgets('${platform.name}: document-only visits retain an honest empty ' - 'artifact state', (tester) async { - await _pump( - tester, - platform, - steps: [ - step( - stage: 'review', - visit: 1, - artifacts: [ - _recorded('input.md', contentType: 'text/markdown', sizeBytes: 1), - ], - ), - ], - ); - - expect(find.text('No artifacts recorded for this run.'), findsOneWidget); - expect(find.text('input.md'), findsNothing); - await _showTurnDocuments(tester); - expect(find.text('input.md'), findsOneWidget); - }); - - testWidgets('${platform.name}: focused document-only visits retain turn ' - 'documents', (tester) async { - await _pump( - tester, - platform, - focusIndex: 0, - steps: [ - step( - stage: 'review', - visit: 1, - artifacts: [ - _recorded('input.md', contentType: 'text/markdown', sizeBytes: 1), - ], - ), - ], - ); - - expect( - find.text('No artifacts recorded for this visit.'), - findsOneWidget, - ); - expect(find.text('input.md'), findsNothing); - await _showTurnDocuments(tester); - expect(find.text('input.md'), findsOneWidget); - }); - - testWidgets('${platform.name}: focused visits retain session documents', ( + testWidgets('focused document-only visits retain turn ' + 'documents', (tester) async { + await _pump( tester, - ) async { - await _pump(tester, platform, focusIndex: 0); + focusIndex: 0, + steps: [ + step( + stage: 'review', + visit: 1, + artifacts: [ + _recorded('input.md', contentType: 'text/markdown', sizeBytes: 1), + ], + ), + ], + ); - expect(find.text('session.html'), findsNothing); - await _showTurnDocuments(tester); - expect(find.text('session.html'), findsOneWidget); - }); - } + expect(find.text('No artifacts recorded for this visit.'), findsOneWidget); + expect(find.text('input.md'), findsNothing); + await _showTurnDocuments(tester); + expect(find.text('input.md'), findsOneWidget); + }); + + testWidgets('focused visits retain session documents', (tester) async { + await _pump(tester, focusIndex: 0); + + expect(find.text('session.html'), findsNothing); + await _showTurnDocuments(tester); + expect(find.text('session.html'), findsOneWidget); + }); } diff --git a/app/test/features/artifacts/ui/artifact_gallery_page_test.dart b/app/test/features/artifacts/ui/artifact_gallery_page_test.dart index 1415326b..57f7f029 100644 --- a/app/test/features/artifacts/ui/artifact_gallery_page_test.dart +++ b/app/test/features/artifacts/ui/artifact_gallery_page_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -9,8 +8,6 @@ import 'package:pipelines_app/features/artifacts/ui/artifact_visit_list.dart'; import '../domain/artifact_fixtures.dart'; -enum _Platform { material, cupertino } - JsonMap _recorded( String name, { String url = '', @@ -51,7 +48,6 @@ List _steps() => [ Future _pumpGallery( WidgetTester tester, - _Platform platform, List steps, { int? focusIndex, String configuredEndpoint = '', @@ -77,65 +73,53 @@ Future _pumpGallery( size: surface, textScaler: TextScaler.linear(textScale), ), - child: platform == _Platform.material - ? MaterialApp(home: page) - : CupertinoApp(home: page), + child: MaterialApp(home: page), ), ); await tester.pumpAndSettle(); } -Finder _inDialog(_Platform platform, String text) => find.descendant( - of: find.byType( - platform == _Platform.material ? AlertDialog : CupertinoAlertDialog, - ), - matching: find.text(text), -); +Finder _inDialog(String text) => + find.descendant(of: find.byType(AlertDialog), matching: find.text(text)); void main() { - for (final platform in _Platform.values) { - testWidgets('${platform.name}: lists recorded groups and rows', ( - tester, - ) async { - await _pumpGallery(tester, platform, _steps()); - expect(find.text('Artifacts · 4 recorded'), findsOneWidget); - expect(find.text('build · visit 1'), findsOneWidget); - expect(find.text('review · visit 1'), findsOneWidget); - expect(find.text('review · visit 2'), findsOneWidget); - expect(find.text('result.zip'), findsNWidgets(2)); - expect(find.text('notes.md'), findsOneWidget); - expect(find.text('text/markdown · 2.0\u00a0KiB'), findsOneWidget); - }); + testWidgets('lists recorded groups and rows', (tester) async { + await _pumpGallery(tester, _steps()); + expect(find.text('Artifacts · 4 recorded'), findsOneWidget); + expect(find.text('build · visit 1'), findsOneWidget); + expect(find.text('review · visit 1'), findsOneWidget); + expect(find.text('review · visit 2'), findsOneWidget); + expect(find.text('result.zip'), findsNWidgets(2)); + expect(find.text('notes.md'), findsOneWidget); + expect(find.text('text/markdown · 2.0\u00a0KiB'), findsOneWidget); + }); - testWidgets('${platform.name}: duplicate filename stays visit distinct', ( - tester, - ) async { - final steps = _steps(); - await _pumpGallery(tester, platform, steps); - await tester.tap(find.text('result.zip').at(1)); - await tester.pumpAndSettle(); + testWidgets('duplicate filename stays visit distinct', (tester) async { + final steps = _steps(); + await _pumpGallery(tester, steps); + await tester.tap(find.text('result.zip').at(1)); + await tester.pumpAndSettle(); - final groups = artifactGroups(steps); - final visitTwo = groups.firstWhere( - (group) => group.stageKey == 'review' && group.visit == 2, - ); - final list = tester.widget( - find.byType(ArtifactVisitList), - ); - expect( - list.selectedIdentity, - artifactVisitIdentity(visitTwo, visitTwo.artifacts.single), - ); - expect(_inDialog(platform, 'review · visit 2'), findsOneWidget); - expect(_inDialog(platform, 'review · visit 1'), findsNothing); - expect(_inDialog(platform, 'Artifacts · 1 recorded'), findsOneWidget); - }); - } + final groups = artifactGroups(steps); + final visitTwo = groups.firstWhere( + (group) => group.stageKey == 'review' && group.visit == 2, + ); + final list = tester.widget( + find.byType(ArtifactVisitList), + ); + expect( + list.selectedIdentity, + artifactVisitIdentity(visitTwo, visitTwo.artifacts.single), + ); + expect(_inDialog('review · visit 2'), findsOneWidget); + expect(_inDialog('review · visit 1'), findsNothing); + expect(_inDialog('Artifacts · 1 recorded'), findsOneWidget); + }); testWidgets('capture notes and partial label come from the visit step', ( tester, ) async { - await _pumpGallery(tester, _Platform.material, [ + await _pumpGallery(tester, [ step( stage: 'review', visit: 1, @@ -151,18 +135,15 @@ void main() { await tester.tap(find.text('result.zip')); await tester.pumpAndSettle(); expect( - _inDialog(_Platform.material, 'Artifacts · 2 recorded · partial capture'), + _inDialog('Artifacts · 2 recorded · partial capture'), findsOneWidget, ); expect( - _inDialog(_Platform.material, '2 files excluded from artifact capture.'), + _inDialog('2 files excluded from artifact capture.'), findsOneWidget, ); expect( - _inDialog( - _Platform.material, - '3 files omitted by artifact capture limits.', - ), + _inDialog('3 files omitted by artifact capture limits.'), findsOneWidget, ); }); @@ -170,7 +151,7 @@ void main() { testWidgets('an unavailable capture never claims nothing was recorded', ( tester, ) async { - await _pumpGallery(tester, _Platform.material, [ + await _pumpGallery(tester, [ step(stage: 'review', visit: 1, includeArtifacts: false), ]); expect(find.text('Artifacts · capture unavailable'), findsOneWidget); @@ -180,7 +161,7 @@ void main() { testWidgets('a recorded empty capture says nothing was recorded', ( tester, ) async { - await _pumpGallery(tester, _Platform.material, [ + await _pumpGallery(tester, [ step(stage: 'review', visit: 1, artifacts: const []), ]); expect(find.text('No artifacts recorded for this run.'), findsOneWidget); @@ -188,7 +169,7 @@ void main() { }); testWidgets('a page with no steps says so explicitly', (tester) async { - await _pumpGallery(tester, _Platform.material, const []); + await _pumpGallery(tester, const []); expect(find.text('No steps recorded for this run.'), findsOneWidget); }); @@ -196,7 +177,6 @@ void main() { final opened = []; await _pumpGallery( tester, - _Platform.material, [ step( stage: 'review', @@ -214,7 +194,7 @@ void main() { ); await tester.tap(find.text('result.zip')); await tester.pumpAndSettle(); - await tester.tap(_inDialog(_Platform.material, 'Open in browser')); + await tester.tap(_inDialog('Open in browser')); await tester.pumpAndSettle(); expect(opened, [ @@ -227,7 +207,7 @@ void main() { testWidgets('an unsafe recorded url offers no open or copy action', ( tester, ) async { - await _pumpGallery(tester, _Platform.material, [ + await _pumpGallery(tester, [ step( stage: 'review', visit: 1, @@ -237,20 +217,17 @@ void main() { await tester.tap(find.text('result.zip')); await tester.pumpAndSettle(); expect( - _inDialog( - _Platform.material, - 'The recorded artifact URL cannot be opened safely.', - ), + _inDialog('The recorded artifact URL cannot be opened safely.'), findsOneWidget, ); - expect(_inDialog(_Platform.material, 'Open in browser'), findsNothing); - expect(_inDialog(_Platform.material, 'Copy link'), findsNothing); + expect(_inDialog('Open in browser'), findsNothing); + expect(_inDialog('Copy link'), findsNothing); }); testWidgets('a record with no url is explicit and offers no action', ( tester, ) async { - await _pumpGallery(tester, _Platform.material, [ + await _pumpGallery(tester, [ step( stage: 'review', visit: 1, @@ -266,11 +243,8 @@ void main() { ]); await tester.tap(find.text('result.zip')); await tester.pumpAndSettle(); - expect( - _inDialog(_Platform.material, 'No artifact URL recorded.'), - findsOneWidget, - ); - expect(_inDialog(_Platform.material, 'Open in browser'), findsNothing); + expect(_inDialog('No artifact URL recorded.'), findsOneWidget); + expect(_inDialog('Open in browser'), findsNothing); }); testWidgets('Copy link copies the resolved url, separate from Open', ( @@ -295,7 +269,6 @@ void main() { final opened = []; await _pumpGallery( tester, - _Platform.material, [ step( stage: 'review', @@ -313,7 +286,7 @@ void main() { ); await tester.tap(find.text('result.zip')); await tester.pumpAndSettle(); - await tester.tap(_inDialog(_Platform.material, 'Copy link')); + await tester.tap(_inDialog('Copy link')); await tester.pumpAndSettle(); expect(copied, ['http://127.0.0.1:8081/artifacts/1/1/result.zip']); @@ -322,7 +295,7 @@ void main() { }); testWidgets('an executing run says capture pending', (tester) async { - await _pumpGallery(tester, _Platform.material, [ + await _pumpGallery(tester, [ step( stage: 'review', visit: 1, @@ -336,7 +309,7 @@ void main() { testWidgets('the run header names the visit each capture note belongs to', ( tester, ) async { - await _pumpGallery(tester, _Platform.material, [ + await _pumpGallery(tester, [ step( stage: 'review', visit: 1, @@ -368,7 +341,7 @@ void main() { testWidgets('a focused visit header states its own notes without a prefix', ( tester, ) async { - await _pumpGallery(tester, _Platform.material, [ + await _pumpGallery(tester, [ step( stage: 'review', visit: 1, @@ -400,7 +373,7 @@ void main() { }); testWidgets('a complete capture adds no header notes', (tester) async { - await _pumpGallery(tester, _Platform.material, [ + await _pumpGallery(tester, [ step(stage: 'review', visit: 1, artifacts: [_recorded('result.zip')]), ]); @@ -409,103 +382,93 @@ void main() { expect(find.textContaining('files omitted'), findsNothing); }); - for (final platform in _Platform.values) { - testWidgets( - '${platform.name}: a long run header scrolls with the gallery rows', - (tester) async { - // Ten partial visits at a phone surface: the header is taller than the - // free space a fixed sibling could get without taking the list's. - await _pumpGallery(tester, platform, [ - for (var visit = 1; visit <= 10; visit += 1) - step( - stage: 'review', - sequence: visit, - visit: visit, - artifacts: [_recorded('file$visit.zip')], - skipped: 1, - ), - ], surface: const Size(360, 640)); + testWidgets('a long run header scrolls with the gallery rows', ( + tester, + ) async { + // Ten partial visits at a phone surface: the header is taller than the + // free space a fixed sibling could get without taking the list's. + await _pumpGallery(tester, [ + for (var visit = 1; visit <= 10; visit += 1) + step( + stage: 'review', + sequence: visit, + visit: visit, + artifacts: [_recorded('file$visit.zip')], + skipped: 1, + ), + ], surface: const Size(360, 640)); - expect(tester.takeException(), isNull); - final list = find.byType(CustomScrollView); - expect(tester.getSize(list).height, greaterThan(0)); - // The header belongs to that scroll view, so it scrolls away instead of - // shrinking the list. - expect( - find.descendant( - of: list, - matching: find.text('Artifacts · 10 recorded · partial capture'), - ), - findsOneWidget, - ); - await tester.scrollUntilVisible(find.text('file10.zip'), 200); - expect(find.text('file10.zip'), findsOneWidget); - }, + expect(tester.takeException(), isNull); + final list = find.byType(CustomScrollView); + expect(tester.getSize(list).height, greaterThan(0)); + // The header belongs to that scroll view, so it scrolls away instead of + // shrinking the list. + expect( + find.descendant( + of: list, + matching: find.text('Artifacts · 10 recorded · partial capture'), + ), + findsOneWidget, ); + await tester.scrollUntilVisible(find.text('file10.zip'), 200); + expect(find.text('file10.zip'), findsOneWidget); + }); - testWidgets( - '${platform.name}: focused notes at 2x text keep the artifact list', - (tester) async { - await _pumpGallery( - tester, - platform, - [ - step( - stage: 'review', - visit: 1, - artifacts: [ - _recorded('result.zip', url: '/artifacts/1/1/result.zip'), - ], - skipped: 12, - truncated: 34, - ), + testWidgets('focused notes at 2x text keep the artifact list', ( + tester, + ) async { + await _pumpGallery( + tester, + [ + step( + stage: 'review', + visit: 1, + artifacts: [ + _recorded('result.zip', url: '/artifacts/1/1/result.zip'), ], - focusIndex: 0, - surface: const Size(320, 568), - textScale: 2, - ); - - expect(tester.takeException(), isNull); - expect( - tester.getSize(find.byType(CustomScrollView)).height, - greaterThan(0), - ); - expect( - find.text('12 files excluded from artifact capture.'), - findsOneWidget, - ); - expect( - find.text('34 files omitted by artifact capture limits.'), - findsOneWidget, - ); - await tester.scrollUntilVisible(find.text('result.zip'), 200); - expect(find.text('result.zip'), findsOneWidget); - }, + skipped: 12, + truncated: 34, + ), + ], + focusIndex: 0, + surface: const Size(320, 568), + textScale: 2, ); - testWidgets( - '${platform.name}: sheet actions keep Close, Copy, Open order', - (tester) async { - await _pumpGallery(tester, platform, [ - step( - stage: 'review', - visit: 1, - artifacts: [ - _recorded('result.zip', url: '/artifacts/1/1/result.zip'), - ], - ), - ], configuredEndpoint: 'ws://127.0.0.1:8081/connect'); - await tester.tap(find.text('result.zip')); - await tester.pumpAndSettle(); - - double orderOf(String label) { - final offset = tester.getTopLeft(_inDialog(platform, label)); - return platform == _Platform.material ? offset.dx : offset.dy; - } - - expect(orderOf('Close'), lessThan(orderOf('Copy link'))); - expect(orderOf('Copy link'), lessThan(orderOf('Open in browser'))); - }, + expect(tester.takeException(), isNull); + expect( + tester.getSize(find.byType(CustomScrollView)).height, + greaterThan(0), ); - } + expect( + find.text('12 files excluded from artifact capture.'), + findsOneWidget, + ); + expect( + find.text('34 files omitted by artifact capture limits.'), + findsOneWidget, + ); + await tester.scrollUntilVisible(find.text('result.zip'), 200); + expect(find.text('result.zip'), findsOneWidget); + }); + + testWidgets('sheet actions keep Close, Copy, Open order', (tester) async { + await _pumpGallery(tester, [ + step( + stage: 'review', + visit: 1, + artifacts: [_recorded('result.zip', url: '/artifacts/1/1/result.zip')], + ), + ], configuredEndpoint: 'ws://127.0.0.1:8081/connect'); + await tester.tap(find.text('result.zip')); + await tester.pumpAndSettle(); + + double orderOf(String label) { + final offset = tester.getTopLeft(_inDialog(label)); + return offset.dx; + } + + expect(orderOf('Close'), lessThan(orderOf('Copy link'))); + expect(orderOf('Copy link'), lessThan(orderOf('Open in browser'))); + }); } diff --git a/app/test/features/artifacts/ui/artifact_selection_facts_test.dart b/app/test/features/artifacts/ui/artifact_selection_facts_test.dart index 224f082d..a9f85c82 100644 --- a/app/test/features/artifacts/ui/artifact_selection_facts_test.dart +++ b/app/test/features/artifacts/ui/artifact_selection_facts_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -21,7 +20,7 @@ ArtifactGroup _group() => ArtifactGroup( artifacts: [ArtifactRecord.fromJson(_recorded())], ); -Future _pump(WidgetTester tester, {required bool cupertino}) async { +Future _pump(WidgetTester tester) async { final group = _group(); final facts = Padding( padding: const EdgeInsets.all(16), @@ -37,50 +36,36 @@ Future _pump(WidgetTester tester, {required bool cupertino}) async { resolved: null, ), ); - await tester.pumpWidget( - cupertino - ? CupertinoApp( - home: CupertinoPageScaffold( - backgroundColor: CupertinoColors.systemGroupedBackground, - child: facts, - ), - ) - : MaterialApp(home: Scaffold(body: facts)), - ); + await tester.pumpWidget(MaterialApp(home: Scaffold(body: facts))); } void main() { - for (final cupertino in [false, true]) { - testWidgets( - '${cupertino ? 'cupertino' : 'material'}: facts lead with metadata, then the visit, then its capture', - (tester) async { - await _pump(tester, cupertino: cupertino); + testWidgets('facts lead with metadata, then the visit, then its capture', ( + tester, + ) async { + await _pump(tester); - const metadata = 'text/csv · 2.0\u00a0KiB'; - const visit = 'review · visit 1'; - const summary = 'Artifacts · 1 recorded · partial capture'; - const note = '2 files excluded from artifact capture.'; - const urlState = 'The recorded artifact URL cannot be opened safely.'; + const metadata = 'text/csv · 2.0\u00a0KiB'; + const visit = 'review · visit 1'; + const summary = 'Artifacts · 1 recorded · partial capture'; + const note = '2 files excluded from artifact capture.'; + const urlState = 'The recorded artifact URL cannot be opened safely.'; - double topOf(String text) => tester.getTopLeft(find.text(text)).dy; + double topOf(String text) => tester.getTopLeft(find.text(text)).dy; - expect(topOf(metadata), lessThan(topOf(visit))); - expect(topOf(visit), lessThan(topOf(summary))); - expect(topOf(summary), lessThan(topOf(note))); - expect(topOf(note), lessThan(topOf(urlState))); + expect(topOf(metadata), lessThan(topOf(visit))); + expect(topOf(visit), lessThan(topOf(summary))); + expect(topOf(summary), lessThan(topOf(note))); + expect(topOf(note), lessThan(topOf(urlState))); - final context = tester.element(find.text(metadata)); - final secondary = cupertino - ? CupertinoColors.secondaryLabel.resolveFrom(context) - : Theme.of(context).colorScheme.onSurfaceVariant; - final metadataStyle = tester.widget(find.text(metadata)).style; - final visitStyle = tester.widget(find.text(visit)).style; - final summaryStyle = tester.widget(find.text(summary)).style; + final context = tester.element(find.text(metadata)); + final secondary = Theme.of(context).colorScheme.onSurfaceVariant; + final metadataStyle = tester.widget(find.text(metadata)).style; + final visitStyle = tester.widget(find.text(visit)).style; + final summaryStyle = tester.widget(find.text(summary)).style; - expect(metadataStyle?.color, secondary); - expect(visitStyle?.color, secondary); - expect(summaryStyle?.color, isNot(secondary)); - }, - ); - } + expect(metadataStyle?.color, secondary); + expect(visitStyle?.color, secondary); + expect(summaryStyle?.color, isNot(secondary)); + }); } diff --git a/app/test/features/artifacts/ui/artifact_viewer_page_test.dart b/app/test/features/artifacts/ui/artifact_viewer_page_test.dart index 800a9c1b..4072820e 100644 --- a/app/test/features/artifacts/ui/artifact_viewer_page_test.dart +++ b/app/test/features/artifacts/ui/artifact_viewer_page_test.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'dart:convert'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -42,7 +41,6 @@ Future _pumpViewer( WidgetTester tester, { required List groups, required String selected, - bool cupertino = false, ArtifactFetch? fetch, Widget Function(BuildContext, String)? markdownBuilder, ArtifactExternalOpen? openExternal, @@ -61,11 +59,7 @@ Future _pumpViewer( data: MediaQueryData(padding: EdgeInsets.only(bottom: bottomClearance)), child: page, ); - await tester.pumpWidget( - cupertino - ? CupertinoApp(home: child) - : MaterialApp(home: Scaffold(body: child)), - ); + await tester.pumpWidget(MaterialApp(home: Scaffold(body: child))); await tester.pumpAndSettle(); } @@ -86,7 +80,6 @@ const String _markdownBody = /// viewer exactly as the run detail does. Future _openMarkdownFromGallery( WidgetTester tester, { - required bool cupertino, String name = 'notes.md', String contentType = 'text/markdown', }) async { @@ -109,9 +102,7 @@ Future _openMarkdownFromGallery( fetch: (_) async => ArtifactFetchResult(status: 200, bytes: utf8.encode(_markdownBody)), ); - await tester.pumpWidget( - cupertino ? CupertinoApp(home: page) : MaterialApp(home: page), - ); + await tester.pumpWidget(MaterialApp(home: page)); await tester.pumpAndSettle(); await tester.tap(find.text(name)); await tester.pumpAndSettle(); @@ -533,33 +524,10 @@ void main() { expect(find.byKey(artifactPreviewRetryKey), findsOneWidget); }); - testWidgets('Cupertino draws the same text preview and controls', ( - tester, - ) async { - final text = recordedArtifact( - 'notes.txt', - url: '/artifacts/1/1/notes.txt', - contentType: 'text/plain', - ); - final group = _group([text]); - await _pumpViewer( - tester, - cupertino: true, - groups: [group], - selected: artifactVisitIdentity(group, text), - fetch: (_) async => ArtifactFetchResult( - status: 200, - bytes: utf8.encode('cupertino text'), - ), - ); - expect(find.text('cupertino text'), findsOneWidget); - expect(find.byType(CupertinoButton), findsWidgets); - }); - testWidgets('the gallery previews markdown through the chat renderer', ( tester, ) async { - await _openMarkdownFromGallery(tester, cupertino: false); + await _openMarkdownFromGallery(tester); expect(find.byType(ArtifactViewerPage), findsOneWidget); expect(find.byType(ChatMarkdownView), findsOneWidget); @@ -583,7 +551,6 @@ void main() { ) async { await _openMarkdownFromGallery( tester, - cupertino: false, name: 'notes.markdown', contentType: '', ); @@ -597,29 +564,6 @@ void main() { expect(find.text('type not recorded · 4.0\u00a0KiB'), findsOneWidget); }); - testWidgets('Cupertino markdown preview is native at 320px and 2x text', ( - tester, - ) async { - tester.view.physicalSize = const Size(640, 1200); - tester.view.devicePixelRatio = 2; - tester.platformDispatcher.textScaleFactorTestValue = 2; - tester.platformDispatcher.platformBrightnessTestValue = Brightness.dark; - addTearDown(tester.view.resetPhysicalSize); - addTearDown(tester.view.resetDevicePixelRatio); - addTearDown(tester.platformDispatcher.clearTextScaleFactorTestValue); - addTearDown(tester.platformDispatcher.clearPlatformBrightnessTestValue); - - await _openMarkdownFromGallery(tester, cupertino: true); - - expect(tester.takeException(), isNull); - expect(find.byType(ChatMarkdownView), findsOneWidget); - expect(find.text('Report'), findsOneWidget); - expect(find.text('dart'), findsOneWidget); - expect(find.text('1 of 1 · text/markdown'), findsOneWidget); - // The viewer and its markdown add no Material control to a Cupertino host. - expect(find.byType(Material), findsNothing); - }); - testWidgets('a swipe moves to the next and previous artifact', ( tester, ) async { @@ -651,83 +595,71 @@ void main() { expect(find.textContaining('1 of 2'), findsWidgets); }); - for (final cupertino in [false, true]) { - testWidgets( - 'pinch owns image pan and native reset (Cupertino=$cupertino)', - (tester) async { - final first = recordedArtifact( - 'a.png', - url: '/artifacts/1/1/a.png', - contentType: 'image/png', - ); - final second = recordedArtifact( - 'b.png', - url: '/artifacts/1/2/b.png', - contentType: 'image/png', - ); - final groups = [ - _group([first], visit: 1), - _group([second], visit: 2), - ]; - await _pumpViewer( - tester, - groups: groups, - cupertino: cupertino, - selected: artifactVisitIdentity(groups[0], first), - ); - - final viewport = tester.getRect( - find.byKey(const Key('artifact-image-zoom')), - ); - final center = viewport.center; - final one = await tester.startGesture( - center + const Offset(-30, 0), - pointer: 1, - ); - final two = await tester.startGesture( - center + const Offset(30, 0), - pointer: 2, - ); - await one.moveTo(center + const Offset(-110, 0)); - await two.moveTo(center + const Offset(110, 0)); - await tester.pump(); - await one.up(); - await two.up(); - await tester.pumpAndSettle(); - - expect( - find.byKey(const Key('artifact-image-reset-zoom')), - findsOneWidget, - ); - expect( - tester.widget(find.byKey(const Key('artifact-image-reset-zoom'))), - cupertino ? isA() : isA(), - ); - // A one-finger drag now belongs to the zoomed image, not the gallery. - await tester.fling( - find.byKey(const Key('artifact-image-zoom')), - const Offset(-300, 0), - 1000, - ); - await tester.pumpAndSettle(); - expect(find.textContaining('1 of 2'), findsWidgets); - - await tester.tap(find.byKey(const Key('artifact-image-reset-zoom'))); - await tester.pumpAndSettle(); - expect( - find.byKey(const Key('artifact-image-reset-zoom')), - findsNothing, - ); - await tester.fling( - find.byKey(const Key('artifact-viewer-swipe')), - const Offset(-300, 0), - 1000, - ); - await tester.pumpAndSettle(); - expect(find.textContaining('2 of 2'), findsWidgets); - }, + testWidgets('pinch owns image pan and native reset', (tester) async { + final first = recordedArtifact( + 'a.png', + url: '/artifacts/1/1/a.png', + contentType: 'image/png', ); - } + final second = recordedArtifact( + 'b.png', + url: '/artifacts/1/2/b.png', + contentType: 'image/png', + ); + final groups = [ + _group([first], visit: 1), + _group([second], visit: 2), + ]; + await _pumpViewer( + tester, + groups: groups, + selected: artifactVisitIdentity(groups[0], first), + ); + + final viewport = tester.getRect( + find.byKey(const Key('artifact-image-zoom')), + ); + final center = viewport.center; + final one = await tester.startGesture( + center + const Offset(-30, 0), + pointer: 1, + ); + final two = await tester.startGesture( + center + const Offset(30, 0), + pointer: 2, + ); + await one.moveTo(center + const Offset(-110, 0)); + await two.moveTo(center + const Offset(110, 0)); + await tester.pump(); + await one.up(); + await two.up(); + await tester.pumpAndSettle(); + + expect(find.byKey(const Key('artifact-image-reset-zoom')), findsOneWidget); + expect( + tester.widget(find.byKey(const Key('artifact-image-reset-zoom'))), + isA(), + ); + // A one-finger drag now belongs to the zoomed image, not the gallery. + await tester.fling( + find.byKey(const Key('artifact-image-zoom')), + const Offset(-300, 0), + 1000, + ); + await tester.pumpAndSettle(); + expect(find.textContaining('1 of 2'), findsWidgets); + + await tester.tap(find.byKey(const Key('artifact-image-reset-zoom'))); + await tester.pumpAndSettle(); + expect(find.byKey(const Key('artifact-image-reset-zoom')), findsNothing); + await tester.fling( + find.byKey(const Key('artifact-viewer-swipe')), + const Offset(-300, 0), + 1000, + ); + await tester.pumpAndSettle(); + expect(find.textContaining('2 of 2'), findsWidgets); + }); testWidgets('Material paging stays inside 320px at 2x text', (tester) async { tester.view.physicalSize = const Size(640, 1200); @@ -770,57 +702,49 @@ void main() { } }); - for (final cupertino in [false, true]) { - for (final size in [ - const Size(390, 844), - const Size(880, 1000), - const Size(1100, 800), - ]) { - testWidgets( - '${cupertino ? 'Cupertino' : 'Material'} pager clears stacked bar at $size', - (tester) async { - tester.view.physicalSize = size; - tester.view.devicePixelRatio = 1; - addTearDown(tester.view.reset); - final first = recordedArtifact( - 'a.png', - url: '/artifacts/1/1/a.png', - contentType: 'image/png', - ); - final second = recordedArtifact( - 'b.png', - url: '/artifacts/1/2/b.png', - contentType: 'image/png', - ); - final groups = [ - _group([first], visit: 1), - _group([second], visit: 2), - ]; - await _pumpViewer( - tester, - groups: groups, - selected: artifactVisitIdentity(groups[0], first), - cupertino: cupertino, - bottomClearance: 120, - ); - final pager = tester.getRect(find.byKey(artifactNextKey)); - expect(pager.bottom, lessThanOrEqualTo(size.height - 120)); - // Right above the stacked bar, not lifted by its clearance twice - // (the bar is one 56 px pill above the inset plus its margin). - expect(pager.bottom, greaterThanOrEqualTo(size.height - 120 - 56)); - // The preview sits between the bars, never behind either. - final preview = tester.getRect( - find.byType(ArtifactPreviewBody).first, - ); - final actions = tester.getRect( - find.byKey(const Key('artifact-viewer-actions')), - ); - final topBar = tester.getRect(find.byType(SegmentedBar).first); - expect(preview.bottom, lessThanOrEqualTo(actions.top)); - expect(preview.top, greaterThanOrEqualTo(topBar.bottom - 1)); - }, + for (final size in [ + const Size(390, 844), + const Size(880, 1000), + const Size(1100, 800), + ]) { + testWidgets('pager clears stacked bar at $size', (tester) async { + tester.view.physicalSize = size; + tester.view.devicePixelRatio = 1; + addTearDown(tester.view.reset); + final first = recordedArtifact( + 'a.png', + url: '/artifacts/1/1/a.png', + contentType: 'image/png', ); - } + final second = recordedArtifact( + 'b.png', + url: '/artifacts/1/2/b.png', + contentType: 'image/png', + ); + final groups = [ + _group([first], visit: 1), + _group([second], visit: 2), + ]; + await _pumpViewer( + tester, + groups: groups, + selected: artifactVisitIdentity(groups[0], first), + bottomClearance: 120, + ); + final pager = tester.getRect(find.byKey(artifactNextKey)); + expect(pager.bottom, lessThanOrEqualTo(size.height - 120)); + // Right above the stacked bar, not lifted by its clearance twice + // (the bar is one 56 px pill above the inset plus its margin). + expect(pager.bottom, greaterThanOrEqualTo(size.height - 120 - 56)); + // The preview sits between the bars, never behind either. + final preview = tester.getRect(find.byType(ArtifactPreviewBody).first); + final actions = tester.getRect( + find.byKey(const Key('artifact-viewer-actions')), + ); + final topBar = tester.getRect(find.byType(SegmentedBar).first); + expect(preview.bottom, lessThanOrEqualTo(actions.top)); + expect(preview.top, greaterThanOrEqualTo(topBar.bottom - 1)); + }); } testWidgets('Escape closes the viewer back to the gallery', (tester) async { diff --git a/app/test/features/artifacts/ui/artifact_visit_list_fixture.dart b/app/test/features/artifacts/ui/artifact_visit_list_fixture.dart index 8ca8f37b..2ba68d23 100644 --- a/app/test/features/artifacts/ui/artifact_visit_list_fixture.dart +++ b/app/test/features/artifacts/ui/artifact_visit_list_fixture.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:pipelines_app/features/artifacts/domain/artifact_groups.dart'; import 'package:pipelines_app/features/artifacts/domain/artifact_record.dart'; @@ -52,10 +51,9 @@ ArtifactGroup visitGroup({ return ArtifactGroup(stageKey: stageKey, visit: visit, artifacts: artifacts); } -/// The list under the native host it is composed into, with the optional +/// The list under the Material host it is composed into, with the optional /// grouped page colour a gallery must supply. Widget artifactListHost({ - required bool cupertino, required List groups, String? selectedIdentity, ArtifactSelected? onSelected, @@ -73,16 +71,8 @@ Widget artifactListHost({ ).copyWith(textScaler: TextScaler.linear(textScale)), child: child ?? const SizedBox.shrink(), ); - return cupertino - ? CupertinoApp( - builder: scaled, - home: CupertinoPageScaffold( - backgroundColor: CupertinoColors.systemGroupedBackground, - child: list, - ), - ) - : MaterialApp( - builder: scaled, - home: Scaffold(body: list), - ); + return MaterialApp( + builder: scaled, + home: Scaffold(body: list), + ); } diff --git a/app/test/features/artifacts/ui/artifact_visit_list_semantics_test.dart b/app/test/features/artifacts/ui/artifact_visit_list_semantics_test.dart index 8d580d37..9fd90356 100644 --- a/app/test/features/artifacts/ui/artifact_visit_list_semantics_test.dart +++ b/app/test/features/artifacts/ui/artifact_visit_list_semantics_test.dart @@ -32,35 +32,25 @@ List _threeGroups() => [ ]; void main() { - testWidgets('every group heading is a header node under both hosts', ( - tester, - ) async { + testWidgets('every group heading is a header node', (tester) async { final handle = tester.ensureSemantics(); - for (final cupertino in [false, true]) { - await tester.pumpWidget( - artifactListHost(cupertino: cupertino, groups: _threeGroups()), + await tester.pumpWidget(artifactListHost(groups: _threeGroups())); + for (final label in [ + 'build · visit 1', + 'review · visit 1', + 'review · visit 2', + ]) { + expect( + tester.getSemantics(find.text(label)), + isSemantics(label: label, isHeader: true), + reason: '$label must be exposed as a heading', ); - for (final label in [ - 'build · visit 1', - 'review · visit 1', - 'review · visit 2', - ]) { - expect( - tester.getSemantics(find.text(label)), - isSemantics(label: label, isHeader: true), - reason: - '${cupertino ? 'Cupertino' : 'Material'} must expose $label as a ' - 'heading', - ); - } } handle.dispose(); }); - testWidgets('a Cupertino heading stays separate from its single row', ( - tester, - ) async { + testWidgets('a heading stays separate from its single row', (tester) async { final handle = tester.ensureSemantics(); final group = visitGroup( visit: 2, @@ -74,7 +64,7 @@ void main() { ], ); await tester.pumpWidget( - artifactListHost(cupertino: true, groups: [group], onSelected: (_, _) {}), + artifactListHost(groups: [group], onSelected: (_, _) {}), ); final heading = tester.getSemantics(find.text('review · visit 2')); @@ -105,9 +95,7 @@ void main() { handle.dispose(); }); - testWidgets('rows without a callback expose no tap action under both hosts', ( - tester, - ) async { + testWidgets('rows without a callback expose no tap action', (tester) async { final handle = tester.ensureSemantics(); final group = visitGroup( artifacts: [ @@ -115,24 +103,20 @@ void main() { ], ); - for (final cupertino in [false, true]) { - await tester.pumpWidget( - artifactListHost(cupertino: cupertino, groups: [group]), - ); - final row = tester.getSemantics(find.text('result.csv')); - expect( - row.getSemanticsData().hasAction(SemanticsAction.tap), - isFalse, - reason: 'without onSelected the row is read-only', - ); - expect( - row, - isSemantics(isButton: false), - reason: 'a read-only row must not expose a button role', - ); - await tester.tap(find.text('result.csv')); - expect(tester.takeException(), isNull); - } + await tester.pumpWidget(artifactListHost(groups: [group])); + final row = tester.getSemantics(find.text('result.csv')); + expect( + row.getSemanticsData().hasAction(SemanticsAction.tap), + isFalse, + reason: 'without onSelected the row is read-only', + ); + expect( + row, + isSemantics(isButton: false), + reason: 'a read-only row must not expose a button role', + ); + await tester.tap(find.text('result.csv')); + expect(tester.takeException(), isNull); handle.dispose(); }); @@ -150,7 +134,6 @@ void main() { ); await tester.pumpWidget( artifactListHost( - cupertino: true, groups: [first, second], selectedIdentity: artifactVisitIdentity( second, diff --git a/app/test/features/artifacts/ui/artifact_visit_list_test.dart b/app/test/features/artifacts/ui/artifact_visit_list_test.dart index 5f123121..82a9f44e 100644 --- a/app/test/features/artifacts/ui/artifact_visit_list_test.dart +++ b/app/test/features/artifacts/ui/artifact_visit_list_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/artifacts/ui/artifact_tile.dart'; @@ -10,31 +9,20 @@ import 'package:pipelines_app/ui/layout/sticky_section.dart'; import 'artifact_visit_list_fixture.dart'; void main() { - for (final cupertino in [false, true]) { - testWidgets( - '${cupertino ? 'Cupertino' : 'Material'} artifact groups start collapsed and expand', - (tester) async { - final group = visitGroup(artifacts: [recordedArtifact('result.csv')]); - await tester.pumpWidget( - cupertino - ? CupertinoApp( - home: CupertinoPageScaffold( - child: ArtifactVisitList(groups: [group]), - ), - ) - : MaterialApp( - home: Scaffold(body: ArtifactVisitList(groups: [group])), - ), - ); - expect(find.byType(ArtifactTile), findsNothing); - expect(find.bySemanticsLabel('review · visit 1'), findsOneWidget); - - await tester.tap(find.byType(StickySectionTitle)); - await tester.pumpAndSettle(); - expect(find.byType(ArtifactTile), findsOneWidget); - }, + testWidgets('artifact groups start collapsed and expand', (tester) async { + final group = visitGroup(artifacts: [recordedArtifact('result.csv')]); + await tester.pumpWidget( + MaterialApp( + home: Scaffold(body: ArtifactVisitList(groups: [group])), + ), ); - } + expect(find.byType(ArtifactTile), findsNothing); + expect(find.bySemanticsLabel('review · visit 1'), findsOneWidget); + + await tester.tap(find.byType(StickySectionTitle)); + await tester.pumpAndSettle(); + expect(find.byType(ArtifactTile), findsOneWidget); + }); test('a shared filename in two visits has distinct identities', () { const url = '/artifacts/7/result.csv'; @@ -112,7 +100,6 @@ void main() { ArtifactRecord? pickedArtifact; await tester.pumpWidget( artifactListHost( - cupertino: false, groups: [first, second], selectedIdentity: artifactVisitIdentity( second, @@ -147,48 +134,7 @@ void main() { expect(pickedArtifact!.url, '/artifacts/7/2/result.csv'); }); - testWidgets('Cupertino shows a grid of tiles and selects per visit', ( - tester, - ) async { - final first = visitGroup( - visit: 1, - artifacts: [ - recordedArtifact('result.csv', url: '/artifacts/7/1/result.csv'), - ], - ); - final second = visitGroup( - visit: 2, - artifacts: [ - recordedArtifact('result.csv', url: '/artifacts/7/2/result.csv'), - ], - ); - ArtifactGroup? pickedGroup; - await tester.pumpWidget( - artifactListHost( - cupertino: true, - groups: [first, second], - selectedIdentity: artifactVisitIdentity(first, first.artifacts.single), - onSelected: (selectedGroup, _) => pickedGroup = selectedGroup, - ), - ); - - // A grid tile per artifact, no Material list tiles. - expect(find.byType(ArtifactTile), findsNWidgets(2)); - expect(find.byType(ListTile), findsNothing); - expect( - tester - .widgetList(find.byType(ArtifactTile)) - .where((tile) => tile.selected), - hasLength(1), - ); - - await tester.tap(find.text('result.csv').last); - expect(pickedGroup, same(second)); - }); - - testWidgets('long names fit their tile at 2x under both native hosts', ( - tester, - ) async { + testWidgets('long names fit their tile at 2x', (tester) async { tester.view.devicePixelRatio = 2; tester.view.physicalSize = const Size(780, 1560); addTearDown(tester.view.resetPhysicalSize); @@ -206,22 +152,19 @@ void main() { ], ); - for (final cupertino in [false, true]) { - await tester.pumpWidget( - artifactListHost( - cupertino: cupertino, - groups: [withLongName], - textScale: 2, - onSelected: (_, _) {}, - ), - ); - expect(tester.takeException(), isNull); - // A tile shows one line of the name; its accessible name is whole. - expect( - find.bySemanticsLabel(RegExp(RegExp.escape(longArtifactName))), - findsOneWidget, - ); - } + await tester.pumpWidget( + artifactListHost( + groups: [withLongName], + textScale: 2, + onSelected: (_, _) {}, + ), + ); + expect(tester.takeException(), isNull); + // A tile shows one line of the name; its accessible name is whole. + expect( + find.bySemanticsLabel(RegExp(RegExp.escape(longArtifactName))), + findsOneWidget, + ); }); testWidgets('a missing name and content type stay explicit', (tester) async { @@ -236,9 +179,7 @@ void main() { ), ], ); - await tester.pumpWidget( - artifactListHost(cupertino: false, groups: [group]), - ); + await tester.pumpWidget(artifactListHost(groups: [group])); expect(find.text('(unnamed artifact)'), findsOneWidget); expect( @@ -254,9 +195,7 @@ void main() { }); testWidgets('empty groups keep the honest empty wording', (tester) async { - await tester.pumpWidget( - artifactListHost(cupertino: false, groups: const []), - ); + await tester.pumpWidget(artifactListHost(groups: const [])); expect(find.text('No stage artifacts recorded.'), findsOneWidget); expect(find.byType(ListTile), findsNothing); }); @@ -319,11 +258,7 @@ void main() { ], ); await tester.pumpWidget( - artifactListHost( - cupertino: false, - groups: [group], - onSelected: (_, _) {}, - ), + artifactListHost(groups: [group], onSelected: (_, _) {}), ); expect(find.byType(ArtifactTile), findsNWidgets(2)); diff --git a/app/test/features/runs/ui/run_artifacts_action_test.dart b/app/test/features/runs/ui/run_artifacts_action_test.dart index 54c3973b..fd1595a3 100644 --- a/app/test/features/runs/ui/run_artifacts_action_test.dart +++ b/app/test/features/runs/ui/run_artifacts_action_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -8,8 +7,6 @@ import 'package:pipelines_app/features/runs/ui/runs_controller.dart'; import '../../artifacts/domain/artifact_fixtures.dart'; -enum _Platform { material, cupertino } - class _FakeGateway implements ApiGateway { _FakeGateway(this.detail); final JsonMap detail; @@ -34,7 +31,6 @@ JsonMap _run({required List steps}) => { Future _pumpDetail( WidgetTester tester, - _Platform platform, RunsController controller, ApiGateway gateway, ) async { @@ -46,17 +42,7 @@ Future _pumpDetail( gateway: gateway, onBack: () {}, ); - await tester.pumpWidget( - platform == _Platform.material - ? MaterialApp(home: Scaffold(body: view)) - : CupertinoApp( - builder: (context, app) => Theme( - data: ThemeData(platform: TargetPlatform.iOS), - child: app!, - ), - home: CupertinoPageScaffold(child: view), - ), - ); + await tester.pumpWidget(MaterialApp(home: Scaffold(body: view))); await tester.pumpAndSettle(); } @@ -67,61 +53,49 @@ Future _loaded(ApiGateway gateway) async { } void main() { - for (final platform in _Platform.values) { - testWidgets('${platform.name}: the action opens the recorded groups', ( - tester, - ) async { - final gateway = _FakeGateway( - _run( - steps: [ - step( - stage: 'implementer', - sequence: 1, - artifacts: [ - artifact( - 'build.log', - contentType: 'text/plain', - sizeBytes: 2337, - ), - ], - ), - step( - stage: 'reviewer', - sequence: 2, - artifacts: [ - artifact( - 'shot.png', - contentType: 'image/png', - sizeBytes: 80544, - ), - ], - ), - ], - ), - ); - final controller = await _loaded(gateway); - addTearDown(controller.dispose); - await _pumpDetail(tester, platform, controller, gateway); + testWidgets('the action opens the recorded groups', (tester) async { + final gateway = _FakeGateway( + _run( + steps: [ + step( + stage: 'implementer', + sequence: 1, + artifacts: [ + artifact('build.log', contentType: 'text/plain', sizeBytes: 2337), + ], + ), + step( + stage: 'reviewer', + sequence: 2, + artifacts: [ + artifact('shot.png', contentType: 'image/png', sizeBytes: 80544), + ], + ), + ], + ), + ); + final controller = await _loaded(gateway); + addTearDown(controller.dispose); + await _pumpDetail(tester, controller, gateway); - expect( - find.byKey(const ValueKey('run-detail-tab-artifacts')), - findsOneWidget, - ); - await tester.ensureVisible( - find.byKey(const ValueKey('run-detail-tab-artifacts')), - ); - await tester.pumpAndSettle(); - await tester.tap(find.byKey(const ValueKey('run-detail-tab-artifacts'))); - await tester.pumpAndSettle(); - // Artifact groups start open: the files show without a tap. + expect( + find.byKey(const ValueKey('run-detail-tab-artifacts')), + findsOneWidget, + ); + await tester.ensureVisible( + find.byKey(const ValueKey('run-detail-tab-artifacts')), + ); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const ValueKey('run-detail-tab-artifacts'))); + await tester.pumpAndSettle(); + // Artifact groups start open: the files show without a tap. - expect(find.text('Artifacts · 2 recorded'), findsOneWidget); - expect(find.text('build.log'), findsOneWidget); - expect(find.text('shot.png'), findsOneWidget); - expect(find.text('implementer · visit 1'), findsOneWidget); - expect(find.text('reviewer · visit 1'), findsOneWidget); - }); - } + expect(find.text('Artifacts · 2 recorded'), findsOneWidget); + expect(find.text('build.log'), findsOneWidget); + expect(find.text('shot.png'), findsOneWidget); + expect(find.text('implementer · visit 1'), findsOneWidget); + expect(find.text('reviewer · visit 1'), findsOneWidget); + }); testWidgets('the action is offered only when the detail has steps', ( tester, @@ -129,7 +103,7 @@ void main() { final gateway = _FakeGateway(_run(steps: const [])); final controller = await _loaded(gateway); addTearDown(controller.dispose); - await _pumpDetail(tester, _Platform.material, controller, gateway); + await _pumpDetail(tester, controller, gateway); expect( find.byKey(const ValueKey('run-detail-tab-artifacts')), findsNothing, @@ -146,7 +120,7 @@ void main() { ); final controller = await _loaded(gateway); addTearDown(controller.dispose); - await _pumpDetail(tester, _Platform.material, controller, gateway); + await _pumpDetail(tester, controller, gateway); await tester.ensureVisible( find.byKey(const ValueKey('run-detail-tab-artifacts')), @@ -167,7 +141,7 @@ void main() { ); final controller = await _loaded(gateway); addTearDown(controller.dispose); - await _pumpDetail(tester, _Platform.material, controller, gateway); + await _pumpDetail(tester, controller, gateway); await tester.ensureVisible( find.byKey(const ValueKey('run-detail-tab-artifacts')), diff --git a/app/test/features/runs/ui/run_detail_flat_bodies_test.dart b/app/test/features/runs/ui/run_detail_flat_bodies_test.dart index 6bb26ec5..f14264d8 100644 --- a/app/test/features/runs/ui/run_detail_flat_bodies_test.dart +++ b/app/test/features/runs/ui/run_detail_flat_bodies_test.dart @@ -26,13 +26,15 @@ void main() { expect(tester.takeException(), isNull); }); - testWidgets('${platform.name} the stage Session nests no group in a ' - 'group', (tester) async { - await openVisit(tester, platform); - await openVisitTab(tester, RunVisitSection.session); - expect(find.text('Turn documents'), findsOneWidget); - expect(find.byType(CupertinoListSection), findsNothing); - }); + if (platform == RunDetailTestPlatform.material) { + testWidgets('${platform.name} the stage Session nests no group in a ' + 'group', (tester) async { + await openVisit(tester, platform); + await openVisitTab(tester, RunVisitSection.session); + expect(find.text('Turn documents'), findsOneWidget); + expect(find.byType(CupertinoListSection), findsNothing); + }); + } testWidgets('${platform.name} beside a list the tabs and the header ' 'share one row', (tester) async { diff --git a/app/test/features/runs/ui/run_detail_visit_documents_test.dart b/app/test/features/runs/ui/run_detail_visit_documents_test.dart index f5b5dd5d..eb388957 100644 --- a/app/test/features/runs/ui/run_detail_visit_documents_test.dart +++ b/app/test/features/runs/ui/run_detail_visit_documents_test.dart @@ -1,6 +1,5 @@ import 'dart:convert'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -20,7 +19,7 @@ JsonMap document(String name, int sequence, {String? url}) => { }; void main() { - for (final platform in RunDetailTestPlatform.values) { + for (final platform in const [RunDetailTestPlatform.material]) { testWidgets( '${platform.name} Session exposes exact repeated visit documents', (tester) async { @@ -87,11 +86,7 @@ void main() { }, ); await tester.pumpWidget(const SizedBox.shrink()); - await tester.pumpWidget( - platform == RunDetailTestPlatform.cupertino - ? CupertinoApp(home: preview) - : MaterialApp(home: preview), - ); + await tester.pumpWidget(MaterialApp(home: preview)); await tester.pumpAndSettle(); expect(fetched.single.path, '/artifacts/3/$name'); expect(find.text('Raw $name visit 3'), findsOneWidget); diff --git a/app/test/features/runs/ui/run_detail_visit_sections_test.dart b/app/test/features/runs/ui/run_detail_visit_sections_test.dart index 4e855bda..21610c2d 100644 --- a/app/test/features/runs/ui/run_detail_visit_sections_test.dart +++ b/app/test/features/runs/ui/run_detail_visit_sections_test.dart @@ -17,7 +17,7 @@ Future _showTurnDocuments(WidgetTester tester) async { } void main() { - for (final platform in RunDetailTestPlatform.values) { + for (final platform in const [RunDetailTestPlatform.material]) { testWidgets('${platform.name} stage tabs sit at the bottom with one Back', ( tester, ) async { @@ -221,7 +221,7 @@ void main() { }); } - for (final platform in RunDetailTestPlatform.values) { + for (final platform in const [RunDetailTestPlatform.material]) { for (final size in const [ Size(390, 844), Size(884, 832), diff --git a/app/test/features/runs/ui/run_detail_visit_session_test.dart b/app/test/features/runs/ui/run_detail_visit_session_test.dart index 079f5eb3..1055e635 100644 --- a/app/test/features/runs/ui/run_detail_visit_session_test.dart +++ b/app/test/features/runs/ui/run_detail_visit_session_test.dart @@ -8,7 +8,7 @@ import 'run_detail_graph_support.dart'; import 'run_detail_visit_support.dart'; void main() { - for (final platform in RunDetailTestPlatform.values) { + for (final platform in const [RunDetailTestPlatform.material]) { testWidgets('${platform.name} legacy session.html stays openable', ( tester, ) async { diff --git a/app/test/features/runs/ui/run_search_selection_test.dart b/app/test/features/runs/ui/run_search_selection_test.dart index df30a291..d64b0540 100644 --- a/app/test/features/runs/ui/run_search_selection_test.dart +++ b/app/test/features/runs/ui/run_search_selection_test.dart @@ -107,7 +107,7 @@ void _expectSummarySection(RunSearchTarget target, RunSummarySection? section) { const _origin = 'http://127.0.0.1:8096'; void main() { - for (final platform in RunDetailTestPlatform.values) { + for (final platform in const [RunDetailTestPlatform.material]) { testWidgets('${platform.name} artifact hit opens its recorded visit', ( tester, ) async { @@ -145,7 +145,7 @@ void main() { return {...run, 'steps': steps}; } - for (final platform in RunDetailTestPlatform.values) { + for (final platform in const [RunDetailTestPlatform.material]) { testWidgets('${platform.name} artifact hit opens that artifact over the ' 'Artifacts tab, and the timeline keeps working afterwards', ( tester,