test: mock device and package plugins and increase timeout
- Increase sync loop timeout in thread workspace binding test to avoid flakiness - Mock device_info and package_info plugins for gateway runtime tests - Update pubspec.yaml version
This commit is contained in:
parent
a876e3b0e4
commit
9987c0cc9f
@ -2,9 +2,9 @@ name: xworkmate
|
||||
description: "XWorkmate desktop-first AI workspace shell."
|
||||
publish_to: 'none'
|
||||
|
||||
version: 1.1.5+1
|
||||
build-date: 2026-06-28
|
||||
build-id: 4e02107
|
||||
version: 1.1.5+2
|
||||
build-date: 2026-06-30
|
||||
build-id: a876e3b
|
||||
|
||||
environment:
|
||||
sdk: ^3.11.0
|
||||
|
||||
17
scripts/sync-version.sh
Executable file
17
scripts/sync-version.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Extract current version from pubspec.yaml if not provided
|
||||
# but here the user requested: version: 1.1.5+2
|
||||
TARGET_VERSION="1.1.5+2"
|
||||
DATE=$(date +%Y-%m-%d)
|
||||
COMMIT=$(git rev-parse --short HEAD)
|
||||
|
||||
# Update version in pubspec.yaml
|
||||
sed -i.bak -e "s/^version: .*/version: ${TARGET_VERSION}/" \
|
||||
-e "s/^build-date: .*/build-date: ${DATE}/" \
|
||||
-e "s/^build-id: .*/build-id: ${COMMIT}/" pubspec.yaml
|
||||
|
||||
rm -f pubspec.yaml.bak
|
||||
|
||||
echo "Updated pubspec.yaml to version=${TARGET_VERSION}, build-date=${DATE}, build-id=${COMMIT}"
|
||||
41
test/mock_plugins.dart
Normal file
41
test/mock_plugins.dart
Normal file
@ -0,0 +1,41 @@
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void mockPlugins() {
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(
|
||||
const MethodChannel('dev.fluttercommunity.plus/package_info'),
|
||||
(MethodCall methodCall) async {
|
||||
return {
|
||||
'appName': 'XWorkmate',
|
||||
'packageName': 'com.xevor.xworkmate',
|
||||
'version': '1.1.5',
|
||||
'buildNumber': '1',
|
||||
};
|
||||
},
|
||||
);
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(
|
||||
const MethodChannel('dev.fluttercommunity.plus/device_info'),
|
||||
(MethodCall methodCall) async {
|
||||
return {
|
||||
'computerName': 'Test-Mac',
|
||||
'hostName': 'Test-Mac',
|
||||
'arch': 'arm64',
|
||||
'model': 'MacBookPro18,1',
|
||||
'kernelVersion': 'Darwin 21.4.0',
|
||||
'osRelease': '21.4.0',
|
||||
'activeCPUs': 10,
|
||||
'memorySize': 34359738368,
|
||||
'cpuFrequency': 3200000000,
|
||||
};
|
||||
},
|
||||
);
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(
|
||||
const MethodChannel('plugins.flutter.io/path_provider'),
|
||||
(MethodCall methodCall) async {
|
||||
return '/tmp';
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -1230,7 +1230,7 @@ void main() {
|
||||
);
|
||||
for (
|
||||
var attempt = 0;
|
||||
attempt < 300 &&
|
||||
attempt < 1000 &&
|
||||
controller
|
||||
.requireTaskThreadForSessionInternal('unit-fixture-task-a')
|
||||
.lastArtifactSyncStatus !=
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import "../mock_plugins.dart";
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
@ -11,6 +12,7 @@ import 'package:xworkmate/runtime/secure_config_store.dart';
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
mockPlugins();
|
||||
HttpOverrides.global = null;
|
||||
|
||||
test(
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import "../mock_plugins.dart";
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user