2021-05-01 03:56:17 +00:00
|
|
|
import 'package:flutter_gherkin/flutter_gherkin_with_driver.dart';
|
2018-10-29 05:44:09 +00:00
|
|
|
import 'package:flutter_gherkin/src/flutter/hooks/app_runner_hook.dart';
|
2021-05-01 05:02:44 +00:00
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
2020-07-19 01:58:46 +00:00
|
|
|
import 'mocks/parameter_mock.dart';
|
2018-10-29 05:44:09 +00:00
|
|
|
import 'mocks/step_definition_mock.dart';
|
|
|
|
|
|
|
|
void main() {
|
2020-05-07 23:36:55 +00:00
|
|
|
group('config', () {
|
2022-06-17 06:25:39 +00:00
|
|
|
test('flutter app runner hook added', () {
|
|
|
|
final config = FlutterDriverTestConfiguration();
|
|
|
|
final newConfig = config.prepare();
|
2018-10-29 05:44:09 +00:00
|
|
|
|
2022-06-17 06:25:39 +00:00
|
|
|
expect(newConfig.hooks, isNotNull);
|
|
|
|
expect(newConfig.hooks!.length, 1);
|
|
|
|
expect(newConfig.hooks!.elementAt(0), (x) => x is FlutterAppRunnerHook);
|
|
|
|
});
|
2018-10-29 05:44:09 +00:00
|
|
|
|
2022-06-17 06:25:39 +00:00
|
|
|
test('common steps definition added', () {
|
|
|
|
final config = FlutterDriverTestConfiguration();
|
|
|
|
expect(config.stepDefinitions, isNotNull);
|
2022-06-27 02:39:31 +00:00
|
|
|
expect(config.stepDefinitions!.length, 24);
|
2022-06-17 06:25:39 +00:00
|
|
|
expect(config.customStepParameterDefinitions, isNotNull);
|
|
|
|
expect(config.customStepParameterDefinitions!.length, 2);
|
|
|
|
});
|
2018-10-29 05:44:09 +00:00
|
|
|
|
2022-06-17 06:25:39 +00:00
|
|
|
test('common step definition added to existing steps', () {
|
|
|
|
final config = FlutterTestConfiguration(
|
|
|
|
stepDefinitions: [MockStepDefinition()],
|
|
|
|
customStepParameterDefinitions: [MockParameter()],
|
|
|
|
);
|
2018-10-29 05:44:09 +00:00
|
|
|
|
2022-06-17 06:25:39 +00:00
|
|
|
expect(config.stepDefinitions, isNotNull);
|
2022-06-27 02:39:31 +00:00
|
|
|
expect(config.stepDefinitions!.length, 25);
|
2022-06-17 06:25:39 +00:00
|
|
|
expect(
|
|
|
|
config.stepDefinitions!.elementAt(0), (x) => x is MockStepDefinition);
|
|
|
|
expect(config.customStepParameterDefinitions, isNotNull);
|
|
|
|
expect(config.customStepParameterDefinitions!.length, 3);
|
|
|
|
expect(config.customStepParameterDefinitions!.elementAt(0),
|
|
|
|
(x) => x is MockParameter);
|
2018-10-29 05:44:09 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|