fix(#76): fixed issue with tap back button step

This commit is contained in:
Jon Samwell 2020-07-26 12:25:22 +10:00
parent 465f8eb00f
commit 91a065e362
10 changed files with 100 additions and 9 deletions

View File

@ -1,3 +1,6 @@
## [1.1.8+4] - 26/07/2020
* Fixes #76
## [1.1.8+3] - 19/07/2020
* Updated Gherkin library version to allow for function step implementations; updated docs to match.
* Add steps `SiblingContainsText`, `SwipeOnKey`, `SwipeOnText`, `TapTextWithinWidget`, `TapWidgetOfType`, `TapWidgetOfTypeWithin`, `TapWidgetWithText`, `TextExists`, `TextExistsWithin`, `WaitUntilKeyExists`, and `WaitUntilTypeExists` . Thanks to @tshedor for the PR!

View File

@ -83,6 +83,15 @@ class _MyHomePageState extends State<MyHomePage> {
key: const Key('counter'),
style: Theme.of(context).textTheme.headline4,
),
FlatButton(
child: Text('Open page 2'),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => PageTwo()),
);
},
)
],
),
),
@ -97,3 +106,20 @@ class _MyHomePageState extends State<MyHomePage> {
);
}
}
class PageTwo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: true,
title: Text('Page 2'),
),
body: SafeArea(
child: Center(
child: Text('Contents of page 2'),
),
),
);
}
}

View File

@ -0,0 +1,13 @@
Feature: Navigation
@debug
Scenario: User can navigate back from page two
Given I expect the "counter" to be "0"
When I tap the "increment" button
Then I expect the "counter" to be "1"
Given I tap the label that contains the text "Open page 2"
Then I expect the text "Contents of page 2" to be present
Given I tap the back button
Then I expect the "counter" to be "1"

View File

@ -1,5 +1,5 @@
Feature: Drawer
@debug
Scenario: should open the drawer
Given I open the drawer
Given I close the drawer

File diff suppressed because one or more lines are too long

View File

@ -191,9 +191,9 @@ class FlutterTestConfiguration extends TestConfiguration {
stepDefinitions = List.from(stepDefinitions ?? [])
..addAll([
ThenExpectElementToHaveValue(),
WhenTapBackButtonWidget(),
WhenTapWidget(),
WhenTapWidgetWithoutScroll(),
WhenTapBackButtonWidget(),
GivenOpenDrawer(),
WhenPauseStep(),
WhenFillFieldStep(),

View File

@ -30,3 +30,45 @@ StepDefinitionGeneric ThenExpectElementToHaveValue() {
},
);
}
class AuthenticationSteps {
static Iterable<StepDefinitionGeneric> steps = [
StepOne(),
StepFive(),
];
static StepDefinitionGeneric StepOne() => given(
'some step',
(context) async {
// do something
},
);
static StepDefinitionGeneric StepFive() => given2<String, int, FlutterWorld>(
'step five with {string} and {int}',
(str, value, context) async {
// do something
},
);
}
class AccountSteps {
static Iterable<StepDefinitionGeneric> steps = [
StepOne(),
StepFive(),
];
static StepDefinitionGeneric StepOne() => given(
'some step account step',
(context) async {
// do something
},
);
static StepDefinitionGeneric StepFive() => given2<String, int, FlutterWorld>(
'step five with {string} and {int}',
(str, value, context) async {
// do something
},
);
}

View File

@ -11,9 +11,9 @@ import 'package:gherkin/gherkin.dart';
/// `When I tap the back element"`
/// `When I tap the back widget"`
StepDefinitionGeneric WhenTapBackButtonWidget() {
return when1<String, FlutterWorld>(
return when<FlutterWorld>(
RegExp(r'I tap the back (?:button|element|widget|icon|text)$'),
(_, context) async {
(context) async {
await FlutterDriverUtils.tap(
context.world.driver,
find.pageBack(),

View File

@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0"
version: "6.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "0.39.13"
version: "0.39.15"
archive:
dependency: transitive
description:
@ -50,6 +50,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
cli_util:
dependency: transitive
description:
name: cli_util
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
collection:
dependency: transitive
description:

View File

@ -1,6 +1,6 @@
name: flutter_gherkin
description: A Gherkin / Cucumber parser and test runner for Dart and Flutter
version: 1.1.8+3
version: 1.1.8+4
homepage: https://github.com/jonsamwell/flutter_gherkin
environment:
@ -18,7 +18,7 @@ dependencies:
meta: ">=1.1.6 <2.0.0"
gherkin: ^1.1.8+2
# gherkin:
# path: ../dart_gherkin
# path: ../dart_gherkin
dev_dependencies:
test: