Skip to content

Commit

Permalink
Merge pull request #2 from tappeddev/improve-browserstack-config
Browse files Browse the repository at this point in the history
improve-browserstack-config
  • Loading branch information
stefanschaller authored Jan 15, 2024
2 parents 6a16ff3 + 54fd424 commit 0abead0
Show file tree
Hide file tree
Showing 12 changed files with 214 additions and 79 deletions.
4 changes: 2 additions & 2 deletions .fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"flutterSdkVersion": "3.7.9",
"flutterSdkVersion": "3.16.5",
"flavors": {}
}
}
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:
jobs:
analyze:
timeout-minutes: 5
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: kuhnroyal/flutter-fvm-config-action@v1
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ migrate_working_dir/
.dart_tool/
.packages
build/
/.fvm/flutter_sdk/
.fvm/flutter_sdk
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This repository contains utilities for testing.

## Browserstack integration

You are able to upload and run intergration tests by using `run_android_intergration_test.dart` and `run_ios_integration_test.dart`. This tools communicate with the browserstack api and therefore require a browserstack username and access key.
You are able to upload and run integration tests by using `run_android_intergration_test.dart` and `run_ios_integration_test.dart`. This tools communicate with the browserstack api and therefore require a browserstack username and access key.

Before running the scripts make sure that you setup your android and iOS projects to be able to generate integration test builds.
Steps can be found here: https://www.browserstack.com/docs/app-automate/flutter/getting-started
Expand Down Expand Up @@ -54,7 +54,7 @@ popd
fvm dart run lib/ios_tests.dart --user="$BROWSERSTACK_USERNAME" --accessKey="$BROWSERSTACK_ACCESS_KEY" --path="../app/$IOS_INTEGRATION_PRODUCT/ios_tests.zip"
```
android_ios.dart:
ios_tests.dart:
```dart
import 'package:tapped_test_toolkit/tapped_test_toolkit.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ class IntegrationTestAndroidOption with _$IntegrationTestAndroidOption {
required String browserstackAccessKey,
required File apk,
required File testSuite,
@Default(["Samsung Galaxy S9 Plus-9.0"]) List<String> devices,
@Default(true) bool networkLogs,
@Default(true) bool deviceLogs,
}) = _IntegrationTestAndroidOption;

static Future<IntegrationTestAndroidOption> fromArguments(
List<String> arguments) async {
List<String> arguments,
) async {
final parser = ArgParser()
..addOption(IntegrationTestParameter.apkPathParam)
..addOption(IntegrationTestParameter.testSuitePathParam)
Expand Down Expand Up @@ -48,6 +52,4 @@ class IntegrationTestAndroidOption with _$IntegrationTestAndroidOption {
String get basicAuthValue {
return "Basic ${base64Encode(utf8.encode("$browserstackUsername:$browserstackAccessKey"))}";
}

List<String> get devices => ["Samsung Galaxy S9 Plus-9.0"];
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ mixin _$IntegrationTestAndroidOption {
String get browserstackAccessKey => throw _privateConstructorUsedError;
File get apk => throw _privateConstructorUsedError;
File get testSuite => throw _privateConstructorUsedError;
List<String> get devices => throw _privateConstructorUsedError;
bool get networkLogs => throw _privateConstructorUsedError;
bool get deviceLogs => throw _privateConstructorUsedError;

@JsonKey(ignore: true)
$IntegrationTestAndroidOptionCopyWith<IntegrationTestAndroidOption>
Expand All @@ -38,7 +41,10 @@ abstract class $IntegrationTestAndroidOptionCopyWith<$Res> {
{String browserstackUsername,
String browserstackAccessKey,
File apk,
File testSuite});
File testSuite,
List<String> devices,
bool networkLogs,
bool deviceLogs});
}

/// @nodoc
Expand All @@ -59,6 +65,9 @@ class _$IntegrationTestAndroidOptionCopyWithImpl<$Res,
Object? browserstackAccessKey = null,
Object? apk = null,
Object? testSuite = null,
Object? devices = null,
Object? networkLogs = null,
Object? deviceLogs = null,
}) {
return _then(_value.copyWith(
browserstackUsername: null == browserstackUsername
Expand All @@ -77,34 +86,49 @@ class _$IntegrationTestAndroidOptionCopyWithImpl<$Res,
? _value.testSuite
: testSuite // ignore: cast_nullable_to_non_nullable
as File,
devices: null == devices
? _value.devices
: devices // ignore: cast_nullable_to_non_nullable
as List<String>,
networkLogs: null == networkLogs
? _value.networkLogs
: networkLogs // ignore: cast_nullable_to_non_nullable
as bool,
deviceLogs: null == deviceLogs
? _value.deviceLogs
: deviceLogs // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
}
}

/// @nodoc
abstract class _$$_IntegrationTestAndroidOptionCopyWith<$Res>
abstract class _$$IntegrationTestAndroidOptionImplCopyWith<$Res>
implements $IntegrationTestAndroidOptionCopyWith<$Res> {
factory _$$_IntegrationTestAndroidOptionCopyWith(
_$_IntegrationTestAndroidOption value,
$Res Function(_$_IntegrationTestAndroidOption) then) =
__$$_IntegrationTestAndroidOptionCopyWithImpl<$Res>;
factory _$$IntegrationTestAndroidOptionImplCopyWith(
_$IntegrationTestAndroidOptionImpl value,
$Res Function(_$IntegrationTestAndroidOptionImpl) then) =
__$$IntegrationTestAndroidOptionImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String browserstackUsername,
String browserstackAccessKey,
File apk,
File testSuite});
File testSuite,
List<String> devices,
bool networkLogs,
bool deviceLogs});
}

/// @nodoc
class __$$_IntegrationTestAndroidOptionCopyWithImpl<$Res>
class __$$IntegrationTestAndroidOptionImplCopyWithImpl<$Res>
extends _$IntegrationTestAndroidOptionCopyWithImpl<$Res,
_$_IntegrationTestAndroidOption>
implements _$$_IntegrationTestAndroidOptionCopyWith<$Res> {
__$$_IntegrationTestAndroidOptionCopyWithImpl(
_$_IntegrationTestAndroidOption _value,
$Res Function(_$_IntegrationTestAndroidOption) _then)
_$IntegrationTestAndroidOptionImpl>
implements _$$IntegrationTestAndroidOptionImplCopyWith<$Res> {
__$$IntegrationTestAndroidOptionImplCopyWithImpl(
_$IntegrationTestAndroidOptionImpl _value,
$Res Function(_$IntegrationTestAndroidOptionImpl) _then)
: super(_value, _then);

@pragma('vm:prefer-inline')
Expand All @@ -114,8 +138,11 @@ class __$$_IntegrationTestAndroidOptionCopyWithImpl<$Res>
Object? browserstackAccessKey = null,
Object? apk = null,
Object? testSuite = null,
Object? devices = null,
Object? networkLogs = null,
Object? deviceLogs = null,
}) {
return _then(_$_IntegrationTestAndroidOption(
return _then(_$IntegrationTestAndroidOptionImpl(
browserstackUsername: null == browserstackUsername
? _value.browserstackUsername
: browserstackUsername // ignore: cast_nullable_to_non_nullable
Expand All @@ -132,19 +159,35 @@ class __$$_IntegrationTestAndroidOptionCopyWithImpl<$Res>
? _value.testSuite
: testSuite // ignore: cast_nullable_to_non_nullable
as File,
devices: null == devices
? _value._devices
: devices // ignore: cast_nullable_to_non_nullable
as List<String>,
networkLogs: null == networkLogs
? _value.networkLogs
: networkLogs // ignore: cast_nullable_to_non_nullable
as bool,
deviceLogs: null == deviceLogs
? _value.deviceLogs
: deviceLogs // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}

/// @nodoc
class _$_IntegrationTestAndroidOption extends _IntegrationTestAndroidOption {
const _$_IntegrationTestAndroidOption(
class _$IntegrationTestAndroidOptionImpl extends _IntegrationTestAndroidOption {
const _$IntegrationTestAndroidOptionImpl(
{required this.browserstackUsername,
required this.browserstackAccessKey,
required this.apk,
required this.testSuite})
: super._();
required this.testSuite,
final List<String> devices = const ["Samsung Galaxy S9 Plus-9.0"],
this.networkLogs = true,
this.deviceLogs = true})
: _devices = devices,
super._();

@override
final String browserstackUsername;
Expand All @@ -154,36 +197,64 @@ class _$_IntegrationTestAndroidOption extends _IntegrationTestAndroidOption {
final File apk;
@override
final File testSuite;
final List<String> _devices;
@override
@JsonKey()
List<String> get devices {
if (_devices is EqualUnmodifiableListView) return _devices;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_devices);
}

@override
@JsonKey()
final bool networkLogs;
@override
@JsonKey()
final bool deviceLogs;

@override
String toString() {
return 'IntegrationTestAndroidOption(browserstackUsername: $browserstackUsername, browserstackAccessKey: $browserstackAccessKey, apk: $apk, testSuite: $testSuite)';
return 'IntegrationTestAndroidOption(browserstackUsername: $browserstackUsername, browserstackAccessKey: $browserstackAccessKey, apk: $apk, testSuite: $testSuite, devices: $devices, networkLogs: $networkLogs, deviceLogs: $deviceLogs)';
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$_IntegrationTestAndroidOption &&
other is _$IntegrationTestAndroidOptionImpl &&
(identical(other.browserstackUsername, browserstackUsername) ||
other.browserstackUsername == browserstackUsername) &&
(identical(other.browserstackAccessKey, browserstackAccessKey) ||
other.browserstackAccessKey == browserstackAccessKey) &&
(identical(other.apk, apk) || other.apk == apk) &&
(identical(other.testSuite, testSuite) ||
other.testSuite == testSuite));
other.testSuite == testSuite) &&
const DeepCollectionEquality().equals(other._devices, _devices) &&
(identical(other.networkLogs, networkLogs) ||
other.networkLogs == networkLogs) &&
(identical(other.deviceLogs, deviceLogs) ||
other.deviceLogs == deviceLogs));
}

@override
int get hashCode => Object.hash(
runtimeType, browserstackUsername, browserstackAccessKey, apk, testSuite);
runtimeType,
browserstackUsername,
browserstackAccessKey,
apk,
testSuite,
const DeepCollectionEquality().hash(_devices),
networkLogs,
deviceLogs);

@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$_IntegrationTestAndroidOptionCopyWith<_$_IntegrationTestAndroidOption>
get copyWith => __$$_IntegrationTestAndroidOptionCopyWithImpl<
_$_IntegrationTestAndroidOption>(this, _$identity);
_$$IntegrationTestAndroidOptionImplCopyWith<
_$IntegrationTestAndroidOptionImpl>
get copyWith => __$$IntegrationTestAndroidOptionImplCopyWithImpl<
_$IntegrationTestAndroidOptionImpl>(this, _$identity);
}

abstract class _IntegrationTestAndroidOption
Expand All @@ -192,7 +263,10 @@ abstract class _IntegrationTestAndroidOption
{required final String browserstackUsername,
required final String browserstackAccessKey,
required final File apk,
required final File testSuite}) = _$_IntegrationTestAndroidOption;
required final File testSuite,
final List<String> devices,
final bool networkLogs,
final bool deviceLogs}) = _$IntegrationTestAndroidOptionImpl;
const _IntegrationTestAndroidOption._() : super._();

@override
Expand All @@ -204,7 +278,14 @@ abstract class _IntegrationTestAndroidOption
@override
File get testSuite;
@override
List<String> get devices;
@override
bool get networkLogs;
@override
bool get deviceLogs;
@override
@JsonKey(ignore: true)
_$$_IntegrationTestAndroidOptionCopyWith<_$_IntegrationTestAndroidOption>
_$$IntegrationTestAndroidOptionImplCopyWith<
_$IntegrationTestAndroidOptionImpl>
get copyWith => throw _privateConstructorUsedError;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ class IntegrationTestIosOption with _$IntegrationTestIosOption {
required String browserstackUsername,
required String browserstackAccessKey,
required File testPackage,
@Default(true) bool networkLogs,
@Default(true) bool deviceLogs,
}) = _IntegrationTestIosOption;

static Future<IntegrationTestIosOption> fromArguments(
List<String> arguments) async {
List<String> arguments,
) async {
final parser = ArgParser()
..addOption(IntegrationTestParameter.browserstackUserParam)
..addOption(IntegrationTestParameter.browserstackAccessKeyParam)
Expand Down
Loading

0 comments on commit 0abead0

Please sign in to comment.