test env updates

This commit is contained in:
erinn 2022-02-04 13:25:22 -08:00
parent 42dedc76e4
commit 5b56dd3a9c
19 changed files with 90 additions and 18 deletions

View File

@ -14,11 +14,11 @@ Located in the `integration_test/env` folder and managed by the hooks in `integr
[~] tor status+reset
[~] shutdown cwtch
[ ] 2. global settings (verify functionality)
[ ] language
[ ] theme+color theme
[_] language # blocked by dropdown
[_] theme+color theme # blocked by dropdown
[ ] column mode -> background? so all tests check both modes?
[ ] block unknown
[ ] streamer mode
[X] block unknown
[X] streamer mode
[ ] 3. experiments (
[ ] group chat -> needs many
[ ] server hosting -> also many
@ -26,14 +26,16 @@ Located in the `integration_test/env` folder and managed by the hooks in `integr
[ ] image previews
[ ] clickable links (how much to test?)
[ ] 4. profile mgmt
[ ] create+delete
[ ] default+password load
[X] create+delete
[X] default+password load
[X] name change
[ ] password change
[ ] known server mgmt
[ ] 5. p2p chat
[ ] add, remove, block, archive
[ ] invite accept+reject
[ ] send+receive inc acks
[X] send+receive
[ ] acks
[ ] try to send a long message
[ ] malformed messages, replies
[ ] overlays (invite, file/image)

View File

@ -0,0 +1 @@
¢‰qö3‰ ÉÌ¥êÒŽB7 Å¢(ÊvQBöÞɱ<C389>øŒœ¾F±zŠ\\UƒÈG[Ü/ £Ñ?uš¼\;]y”HþG|þÛ,Þ3xÛÞeE0 !¬ÄSÍž<nÐÃòÐÉ®M~ üw “ÀëQ@6ǸËÖo£ÉüØ…ÕöÀiò

View File

@ -1,3 +1,3 @@
SocksPort 10144 OnionTrafficOnly
ControlPort 10145
HashedControlPassword 16:1826C7D5B8A8CB03604810EE78E1C9DDA1C8AF51AC052CE8A23A7A693C
SocksPort 10345 OnionTrafficOnly
ControlPort 10346
HashedControlPassword 16:7EE2233C316BC2A060EF23D7A871CC2ACC4AFEE1E40B25A23913F9013F

Binary file not shown.

View File

@ -8,10 +8,10 @@ Feature: Settings pane opens and can save settings persistently
Scenario: Change every setting (except Language)
Given I tap the 'OpenSettingsView' button
And I wait for 1 second
When I tap the widget that contains the text "Theme"
When I tap the widget that contains the text "Use Light Themes"
#And I choose option 3 from the "DropdownTheme" dropdown
When I tap the "DropdownTheme" button
And I tap the first "ddi_mermaid" element
#When I tap the "DropdownTheme" button
#And I tap the first "ddi_mermaid" element
#And I tap the element that contains the text "Mermaid"
#And I tap the element that contains the text "Mermaid" within the "DropdownTheme"
And I tap the widget that contains the text "Block Unknown Contacts"
@ -23,7 +23,7 @@ Feature: Settings pane opens and can save settings persistently
And I tap the widget that contains the text "Image Previews and Profile Pictures"
And I fill the "DownloadFolderPicker" field with "/this/is/a/test"
And I tap the widget that contains the text "Enable Clickable Links"
Then I expect the switch that contains the text "Theme" to be checked
Then I expect the switch that contains the text "Use Light Themes" to be checked
And I expect the switch that contains the text "Block Unknown Contacts" to be checked
And I expect the switch that contains the text "Streamer/Presentation Mode" to be checked
And I expect the switch that contains the text "Enable Experiments" to be checked
@ -37,7 +37,7 @@ Feature: Settings pane opens and can save settings persistently
Scenario: When the app is reloaded, settings from the previous scenario have persisted
Given I tap the 'OpenSettingsView' button
And I wait for 1 second
Then I expect the switch that contains the text "Theme" to be checked
Then I expect the switch that contains the text "Use Light Themes" to be checked
And I expect the switch that contains the text "Block Unknown Contacts" to be checked
And I expect the switch that contains the text "Streamer/Presentation Mode" to be checked
And I expect the switch that contains the text "Enable Experiments" to be checked

View File

@ -0,0 +1,20 @@
@env:aliceandbob1
Feature: Block unknown contacts setting
Scenario: Carol adds Alice but Alice doesn't see it because Block Unknowns is enabled
Given I wait until the widget with type 'ProfileMgrView' is present
Given I tap the 'OpenSettingsView' button
When I tap the widget that contains the text "Block Unknown Contacts"
Then I expect the switch that contains the text "Block Unknown Contacts" to be checked
Given I tap the back button
And I wait until the text "Carol" is present
And I tap the button that contains the text "Carol"
And I tap the button with tooltip "Add a new contact or conversation"
When I fill the "txtAddP2P" field with "vbmmsbx3rhndpfz6t3jkrd7m3yu62xzrldxkdgsw4rsehiwuw3tmo7yd"
And I wait for 1 second
And I take a screenshot
And I tap the back button
And I wait until the text "Alice" is present
And I wait until the tooltip "Online" is present
And I tap the button that contains the text "Alice"
And I wait for 20 seconds
Then I expect the text "yxj2pvhozedflp4g7yitpqkeho63maaffi2qgsj3e6s2fbmosuuas2qd" to be absent

View File

@ -0,0 +1,18 @@
@env:aliceandbob1
Feature: Streamer mode
Scenario: All onions disappear when Streamer Mode is enabled
Given I wait until the widget with type 'ProfileMgrView' is present
And I wait until the text "vbmmsbx3rhndpfz6t3jkrd7m3yu62xzrldxkdgsw4rsehiwuw3tmo7yd" is present
And I wait until the text "pjurzypqui3dnpxj6aemk6cqz22yx6zfr5lq4jzu7muwe2yyx2zrnzyd" is present
Given I tap the 'OpenSettingsView' button
And I wait for 1 second
And I tap the widget that contains the text "Streamer/Presentation Mode"
Then I expect the switch that contains the text "Streamer/Presentation Mode" to be checked
When I tap the back button
And I wait until the text "Alice" is present
And I wait until the text "Bob" is present
Then I expect the text "vbmmsbx3rhndpfz6t3jkrd7m3yu62xzrldxkdgsw4rsehiwuw3tmo7yd" to be absent
And I expect the text "pjurzypqui3dnpxj6aemk6cqz22yx6zfr5lq4jzu7muwe2yyx2zrnzyd" to be absent
When I tap the button that contains the text "Alice"
Then I expect the text "vbmmsbx3rhndpfz6t3jkrd7m3yu62xzrldxkdgsw4rsehiwuw3tmo7yd" to be absent
And I expect the text "pjurzypqui3dnpxj6aemk6cqz22yx6zfr5lq4jzu7muwe2yyx2zrnzyd" to be absent

View File

@ -45,6 +45,7 @@ void main() {
ExpectTextToBePresent(),
ExpectWidgetWithTextWithin(),
WaitUntilTextExists(),
WaitUntilTooltipExists(),
SwipeOnType(),
// text
TorVersionPresent(),

View File

@ -9,6 +9,7 @@ class ResetCwtchEnvironment extends Hook {
@override
Future<void> onBeforeRun(TestConfiguration config) async {
// initialize @env:persist
await Process.run("rm", ["-rf", "integration_test/env/temp-persist"]);
await Process.run("cp", ["-R", "integration_test/env/persist", "integration_test/env/temp-persist"]);
return super.onBeforeRun(config);

View File

@ -198,6 +198,30 @@ StepDefinitionGeneric WaitUntilTextExists() {
);
}
StepDefinitionGeneric WaitUntilTooltipExists() {
return then2<String, Existence, FlutterWorld>(
'I wait until the tooltip {string} is {existence}',
(ofType, existence, context) async {
await context.world.appDriver.waitUntil(
() async {
await context.world.appDriver.waitForAppToSettle();
return existence == Existence.absent
? context.world.appDriver.isAbsent(
context.world.appDriver.findBy(ofType, FindType.tooltip),
)
: context.world.appDriver.isPresent(
context.world.appDriver.findBy(ofType, FindType.tooltip),
);
},
timeout: Duration(seconds: 120),
);
},
configuration: StepDefinitionConfiguration()
..timeout = const Duration(days: 1),
);
}
mixin _SwipeHelper
on When4WithWorld<SwipeDirection, int, String, String, FlutterWorld> {
Future<void> swipeOnFinder(

View File

@ -138,6 +138,7 @@ class _AddContactViewState extends State<AddContactView> {
height: 20,
),
CwtchTextField(
testKey: Key("txtAddP2P"),
controller: ctrlrContact,
validator: (value) {
if (value == "") {

View File

@ -107,7 +107,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
items: themes.keys.map<DropdownMenuItem<String>>((String themeId) {
return DropdownMenuItem<String>(
value: themeId,
child: Text("ddi_$themeId", key: Key("ddi_$themeId")), //getThemeName(context, themeId)),
child: Text(getThemeName(context, themeId)), //"ddi_$themeId", key: Key("ddi_$themeId")),
);
}).toList()),
leading: Icon(CwtchIcons.change_theme, color: settings.current().mainTextColor),

View File

@ -64,6 +64,7 @@ class _CwtchFolderPickerState extends State<CwtchFolderPicker> {
print(e);
}
},
onChanged: widget.onSave,
icon: Icon(Icons.folder),
tooltip: widget.tooltip,
)));

View File

@ -8,7 +8,7 @@ doNothing(String x) {}
// Provides a styled Text Field for use in Form Widgets.
// Callers must provide a text controller, label helper text and a validator.
class CwtchTextField extends StatefulWidget {
CwtchTextField({required this.controller, this.hintText = "", this.validator, this.autofocus = false, this.onChanged = doNothing, this.number = false, this.multiLine = false, this.key});
CwtchTextField({required this.controller, this.hintText = "", this.validator, this.autofocus = false, this.onChanged = doNothing, this.number = false, this.multiLine = false, this.key, this.testKey});
final TextEditingController controller;
final String hintText;
final FormFieldValidator? validator;
@ -17,6 +17,7 @@ class CwtchTextField extends StatefulWidget {
final bool multiLine;
final bool number;
final Key? key;
final Key? testKey;
@override
_CwtchTextFieldState createState() => _CwtchTextFieldState();
@ -41,6 +42,7 @@ class _CwtchTextFieldState extends State<CwtchTextField> {
Widget build(BuildContext context) {
return Consumer<Settings>(builder: (context, theme, child) {
return TextFormField(
key: widget.testKey,
controller: widget.controller,
validator: widget.validator,
onChanged: widget.onChanged,

View File

@ -12,7 +12,7 @@ sed "s|featurePaths: REPLACED_BY_SCRIPT|featurePaths: <String>[$paths]|" integra
flutter pub run build_runner clean
flutter pub run build_runner build --delete-conflicting-outputs
pkill tor
LD_LIBRARY_PATH=$LDPATH CWTCH_HOME=./integration_test/env/temp/ flutter drive --dart-define TEST_MODE=true --driver=test_driver/integration_test_driver.dart --target=integration_test/gherkin_suite_test.dart
LD_LIBRARY_PATH=$LDPATH CWTCH_HOME=./integration_test/env/temp/ flutter drive --headless --dart-define TEST_MODE=true --driver=test_driver/integration_test_driver.dart --target=integration_test/gherkin_suite_test.dart
node index2.js
if [ "$HEADLESS" = "false" ]; then
xdg-open integration_test/gherkin/reports/cucumber_report.html