new tests prep

This commit is contained in:
erinn 2022-01-27 13:03:01 -08:00
parent 5e4c190e41
commit ab79a343a9
9 changed files with 333 additions and 16 deletions

View File

@ -45,6 +45,10 @@ class CwtchNotifier {
appState.SetAppError(data["Error"]);
break;
case "NewPeer":
// empty events can be caused by the testing framework
if (data["Online"] == null) {
break;
}
EnvironmentConfig.debugLog("NewPeer $data");
// if tag != v1-defaultPassword then it is either encrypted OR it is an unencrypted account created during pre-beta...
profileCN.add(data["Identity"], data["name"], data["picture"], data["ContactsJson"], data["ServerList"], data["Online"] == "true", data["tag"] != "v1-defaultPassword");

View File

@ -19,7 +19,7 @@ import 'model.dart';
import 'models/servers.dart';
import 'views/profilemgrview.dart';
import 'views/splashView.dart';
import 'dart:io' show Platform, exit;
import 'dart:io' show Platform, exit, sleep;
import 'themes/opaque.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
@ -29,12 +29,13 @@ var globalTorStatus = TorStatus();
var globalAppState = AppState();
var globalServersList = ServerListState();
void main() {
Future<void> main() async {
print("Cwtch version: ${EnvironmentConfig.BUILD_VER} built on: ${EnvironmentConfig.BUILD_DATE}");
LicenseRegistry.addLicense(() => licenses());
WidgetsFlutterBinding.ensureInitialized();
print("runApp()");
runApp(Flwtch());
sleep(Duration(seconds:1));
}
class Flwtch extends StatefulWidget {
@ -42,6 +43,10 @@ class Flwtch extends StatefulWidget {
@override
FlwtchState createState() => FlwtchState();
String yay() {
return "yay!";
}
}
class FlwtchState extends State<Flwtch> {
@ -204,6 +209,7 @@ class FlwtchState extends State<Flwtch> {
@override
void dispose() {
cwtch.Shutdown();
cwtch.dispose();
super.dispose();
}

View File

@ -49,6 +49,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
return LayoutBuilder(builder: (BuildContext context, BoxConstraints viewportConstraints) {
var appIcon = Icon(Icons.info, color: settings.current().mainTextColor);
return Scrollbar(
key: Key("SettingsView"),
isAlwaysShown: true,
child: SingleChildScrollView(
clipBehavior: Clip.antiAlias,
@ -94,6 +95,8 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
ListTile(
title: Text(AppLocalizations.of(context)!.themeColorLabel),
trailing: DropdownButton<String>(
key: Key("DropdownTheme"),
isDense: true,
value: Provider.of<Settings>(context).theme.theme,
onChanged: (String? newValue) {
setState(() {
@ -104,7 +107,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
items: themes.keys.map<DropdownMenuItem<String>>((String themeId) {
return DropdownMenuItem<String>(
value: themeId,
child: Text(getThemeName(context, themeId)),
child: Text("ddi_$themeId",key: Key("ddi_$themeId")),//getThemeName(context, themeId)),
);
}).toList()),
leading: Icon(CwtchIcons.change_theme, color: settings.current().mainTextColor),
@ -278,6 +281,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
Visibility(
visible: settings.isExperimentEnabled(ImagePreviewsExperiment) && !Platform.isAndroid,
child: CwtchFolderPicker(
testKey: Key("DownloadFolderPicker"),
label: AppLocalizations.of(context)!.settingDownloadFolder,
initialValue: settings.downloadPath,
onSave: (newVal) {

View File

@ -46,6 +46,7 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
return Provider.of<AppState>(context, listen: false).cwtchIsClosing;
},
child: Scaffold(
key: Key("ProfileManagerView"),
backgroundColor: settings.theme.backgroundMainColor,
appBar: AppBar(
title: Row(children: [
@ -88,8 +89,6 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
: (Provider.of<TorStatus>(context).progress == 0 ? AppLocalizations.of(context)!.networkStatusDisconnected : AppLocalizations.of(context)!.networkStatusAttemptingTor),
));
// Only show debug button on development builds
// Unlock Profiles
actions.add(IconButton(
icon: Icon(CwtchIcons.lock_open_24px),
@ -104,7 +103,7 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
}
// Global Settings
actions.add(IconButton(icon: Icon(Icons.settings), tooltip: AppLocalizations.of(context)!.tooltipOpenSettings, onPressed: _pushGlobalSettings));
actions.add(IconButton(key: Key("OpenSettingsView"), icon: Icon(Icons.settings), tooltip: AppLocalizations.of(context)!.tooltipOpenSettings, onPressed: _pushGlobalSettings));
// shutdown cwtch
actions.add(IconButton(icon: Icon(Icons.close), tooltip: AppLocalizations.of(context)!.shutdownCwtchTooltip, onPressed: _modalShutdown));

View File

@ -16,6 +16,7 @@ class _SplashViewState extends State<SplashView> {
Widget build(BuildContext context) {
return Consumer<AppState>(
builder: (context, appState, child) => Scaffold(
key: Key("SplashView"),
body: Center(
child: Column(mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [
Image(

View File

@ -5,12 +5,14 @@ import 'package:provider/provider.dart';
// Provides a styled Text Field for use in Form Widgets.
// Callers must provide a text controller, label helper text and a validator.
class CwtchButtonTextField extends StatefulWidget {
CwtchButtonTextField({required this.controller, required this.onPressed, required this.icon, required this.tooltip, this.readonly = true, this.labelText});
CwtchButtonTextField({required this.controller, required this.onPressed, required this.icon, required this.tooltip, this.readonly = true, this.labelText, this.testKey, this.onChanged,});
final TextEditingController controller;
final Function()? onPressed;
final Function(String)? onChanged;
final Icon icon;
final String tooltip;
final bool readonly;
final Key? testKey;
String? labelText;
@override
@ -34,11 +36,13 @@ class _CwtchButtonTextFieldState extends State<CwtchButtonTextField> {
Widget build(BuildContext context) {
return Consumer<Settings>(builder: (context, theme, child) {
return TextFormField(
key: widget.testKey,
controller: widget.controller,
readOnly: widget.readonly,
showCursor: !widget.readonly,
focusNode: _focusNode,
enableIMEPersonalizedLearning: false,
onChanged: widget.onChanged,
decoration: InputDecoration(
labelText: widget.labelText,
labelStyle: TextStyle(color: theme.current().mainTextColor, backgroundColor: theme.current().textfieldBackgroundColor),

View File

@ -10,7 +10,8 @@ class CwtchFolderPicker extends StatefulWidget {
final String label;
final String initialValue;
final Function(String)? onSave;
const CwtchFolderPicker({Key? key, this.label = "", this.initialValue = "", this.onSave}) : super(key: key);
final Key? testKey;
const CwtchFolderPicker({Key? key, this.testKey, this.label = "", this.initialValue = "", this.onSave}) : super(key: key);
@override
_CwtchFolderPickerState createState() => _CwtchFolderPickerState();
@ -36,6 +37,7 @@ class _CwtchFolderPickerState extends State<CwtchFolderPicker> {
height: 20,
),
CwtchButtonTextField(
testKey: widget.testKey,
controller: ctrlrVal,
readonly: Platform.isAndroid,
onPressed: () async {
@ -59,6 +61,14 @@ class _CwtchFolderPickerState extends State<CwtchFolderPicker> {
print(e);
}
},
onChanged: (x) async {
if (Platform.isAndroid) {
return;
}
if (widget.onSave != null) {
widget.onSave!(ctrlrVal.text);
}
},
icon: Icon(Icons.folder),
tooltip: "Browse", //todo: l18n
)

View File

@ -1,6 +1,20 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
_fe_analyzer_shared:
dependency: transitive
description:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "31.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.0"
ansicolor:
dependency: transitive
description:
@ -8,6 +22,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.6"
args:
dependency: transitive
description:
@ -29,6 +50,62 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
build:
dependency: transitive
description:
name: build
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
build_config:
dependency: transitive
description:
name: build_config
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
build_daemon:
dependency: transitive
description:
name: build_daemon
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
build_resolvers:
dependency: transitive
description:
name: build_resolvers
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.6"
build_runner:
dependency: "direct dev"
description:
name: build_runner
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.7"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
url: "https://pub.dartlang.org"
source: hosted
version: "7.2.3"
built_collection:
dependency: transitive
description:
name: built_collection
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.1"
built_value:
dependency: transitive
description:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "8.1.3"
characters:
dependency: transitive
description:
@ -43,6 +120,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
checked_yaml:
dependency: transitive
description:
name: checked_yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
cli_util:
dependency: transitive
description:
name: cli_util
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.5"
clock:
dependency: transitive
description:
@ -50,6 +141,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
code_builder:
dependency: transitive
description:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
collection:
dependency: transitive
description:
@ -57,6 +155,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
crypto:
dependency: "direct main"
description:
@ -71,6 +176,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
dart_style:
dependency: transitive
description:
name: dart_style
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
dbus:
dependency: transitive
description:
@ -120,11 +232,30 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
fixnum:
dependency: transitive
description:
name: fixnum
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_driver:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
flutter_gherkin:
dependency: "direct dev"
description:
name: flutter_gherkin
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0-rc.9"
flutter_linkify:
dependency: "direct main"
description:
@ -145,7 +276,7 @@ packages:
source: hosted
version: "2.0.3"
flutter_test:
dependency: "direct main"
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
@ -154,13 +285,39 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
frontend_server_client:
dependency: transitive
description:
name: frontend_server_client
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
fuchsia_remote_debug_protocol:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
gherkin:
dependency: transitive
description:
name: gherkin
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
glob:
dependency: "direct main"
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.2"
graphs:
dependency: transitive
description:
name: graphs
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
http:
dependency: transitive
description:
@ -168,6 +325,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.3"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
http_parser:
dependency: transitive
description:
@ -182,6 +346,11 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
integration_test:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
intl:
dependency: transitive
description:
@ -189,6 +358,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.0"
io:
dependency: transitive
description:
name: io
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
js:
dependency: transitive
description:
@ -196,6 +372,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
json_annotation:
dependency: transitive
description:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "4.4.0"
linkify:
dependency: transitive
description:
@ -203,6 +386,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
matcher:
dependency: transitive
description:
@ -217,6 +407,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
msix:
dependency: "direct dev"
description:
@ -342,7 +539,7 @@ packages:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "3.0.2"
plugin_platform_interface:
dependency: transitive
description:
@ -350,13 +547,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
pool:
dependency: transitive
description:
name: pool
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
process:
dependency: transitive
description:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.1"
version: "4.2.4"
provider:
dependency: "direct main"
description:
@ -364,6 +568,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
pubspec_parse:
dependency: transitive
description:
name: pubspec_parse
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
scrollable_positioned_list:
dependency: "direct main"
description:
@ -371,11 +589,32 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0-nullsafety.0"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_gen:
dependency: transitive
description:
name: source_gen
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
source_span:
dependency: transitive
description:
@ -397,6 +636,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
stream_transform:
dependency: transitive
description:
name: stream_transform
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
string_scanner:
dependency: transitive
description:
@ -404,6 +650,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
sync_http:
dependency: transitive
description:
name: sync_http
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
term_glyph:
dependency: transitive
description:
@ -418,6 +671,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.3"
timing:
dependency: transitive
description:
name: timing
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
typed_data:
dependency: transitive
description:
@ -474,6 +734,34 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
vm_service:
dependency: transitive
description:
name: vm_service
url: "https://pub.dartlang.org"
source: hosted
version: "7.3.0"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
webdriver:
dependency: transitive
description:
name: webdriver
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
win32:
dependency: transitive
description:
@ -503,5 +791,5 @@ packages:
source: hosted
version: "3.1.0"
sdks:
dart: ">=2.14.0 <3.0.0"
dart: ">=2.15.0 <3.0.0"
flutter: ">=2.5.0"

View File

@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.5.2+24
environment:
sdk: ">=2.12.0 <3.0.0"
sdk: ">=2.15.0 <3.0.0"
dependencies:
flutter:
@ -38,8 +38,6 @@ dependencies:
crypto: 3.0.1
glob: any
flutter_test:
sdk: flutter
scrollable_positioned_list: ^0.2.0-nullsafety.0
file_picker: ^4.0.1
file_picker_desktop: ^1.1.0
@ -48,6 +46,9 @@ dependencies:
dev_dependencies:
msix: ^2.1.3
flutter_gherkin: ^3.0.0-rc.9
build_runner: any
# integration_test: any
# Uncomment to update lokalise translations (see README for list of deps to comment out bc incompatibilities)
#dev_dependencies:
# flutter_lokalise: any