Files
pipelines/app/test/features/pipelines/pipeline_scope_control_test.dart
T
alan 5a9284ccf7 App: archive and unarchive pipelines
The pipeline's bar gets a Pipeline actions menu with Archive (confirm
dialog: history is kept) or Unarchive; an archived detail says so and
offers no Run. The list hides archived pipelines and the scope control
gains an Archived view. Server refusals (enabled schedule, newer
version) are shown verbatim. The capture fixture answers archive
requests.
2026-11-04 23:37:25 +00:00

69 lines
2.1 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/pipelines/widgets/pipeline_scope_control.dart';
void main() {
for (final cupertino in [false, true]) {
for (final width in [120.0, 500.0]) {
testWidgets(
'native scope remains usable at $width, Cupertino=$cupertino',
(tester) async {
var scope = PipelineScope.all;
final control = StatefulBuilder(
builder: (context, setState) => Center(
child: SizedBox(
width: width,
child: PipelineScopeControl(
scope: scope,
onSelected: (value) => setState(() => scope = value),
),
),
),
);
await tester.pumpWidget(
cupertino
? CupertinoApp(home: CupertinoPageScaffold(child: control))
: MaterialApp(home: Scaffold(body: control)),
);
await tester.pumpAndSettle();
if (width == 120) {
await tester.tap(find.byKey(const Key('pipeline-scope')));
await tester.pumpAndSettle();
await tester.tap(find.text('Scheduled').last);
} else {
await tester.tap(find.text('Scheduled'));
}
await tester.pumpAndSettle();
expect(scope, PipelineScope.scheduled);
expect(tester.takeException(), isNull);
},
);
}
}
testWidgets('wide scope control hugs its labels', (tester) async {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: SizedBox(
width: 500,
child: Align(
alignment: AlignmentDirectional.centerStart,
child: PipelineScopeControl(
scope: PipelineScope.all,
onSelected: (_) {},
),
),
),
),
),
);
expect(
tester.getSize(find.byKey(const Key('pipeline-scope'))).width,
lessThan(500),
);
});
}