fix(app): scope pending pipeline runs by endpoint
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -7,6 +8,8 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/core/transport/connection_state.dart';
|
||||
import 'package:pipelines_app/features/pipelines/screen.dart';
|
||||
import 'package:pipelines_app/features/pipelines/pending_run_store.dart';
|
||||
import 'package:pipelines_app/features/pipelines/run_pipeline_intent.dart';
|
||||
import 'package:pipelines_app/features/pipelines/ui/run_pipeline_wording.dart';
|
||||
|
||||
import '../fixtures.dart';
|
||||
@@ -81,6 +84,53 @@ Future<void> fillFields(
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
testWidgets('pending launch intent is scoped to its server endpoint', (
|
||||
tester,
|
||||
) async {
|
||||
const intent = RunPipelineIntent(
|
||||
pipelineId: 1,
|
||||
version: 2,
|
||||
prompt: 'pending',
|
||||
workspace: '/work/alpha',
|
||||
notifyMode: RunNotifyMode.notify,
|
||||
requestKey: 'endpoint-intent',
|
||||
);
|
||||
SharedPreferences.setMockInitialValues({
|
||||
pendingRunStorageKey('ws://server-a/connect', 1, 2):
|
||||
jsonEncode(intent.toJson()),
|
||||
});
|
||||
final fixture = PipelineFixture();
|
||||
final gateway = launchGateway(fixture, onLaunch: (_) => noRun());
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: PipelinesScreen(
|
||||
gateway: gateway,
|
||||
endpoint: 'ws://server-b/connect',
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
await openDetail(tester);
|
||||
await tester.tap(find.byKey(runPipelineActionKey));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(runPipelineCheckRetryLabel), findsNothing);
|
||||
await tester.tap(find.byKey(runPipelineCancelKey));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: PipelinesScreen(
|
||||
gateway: gateway,
|
||||
endpoint: 'ws://server-a/connect',
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
await openDetail(tester);
|
||||
await tester.tap(find.byKey(runPipelineActionKey));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(runPipelineCheckRetryLabel), findsOneWidget);
|
||||
});
|
||||
testWidgets(
|
||||
'workspace directory suggestions load on open and selection is local',
|
||||
(tester) async {
|
||||
|
||||
Reference in New Issue
Block a user