11import 'package:bdd_widget_test/src/feature_file.dart' ;
2- import 'package:bdd_widget_test/src/generator_options.dart' ;
32import 'package:test/test.dart' ;
43
54import 'util/testing_data.dart' ;
@@ -108,18 +107,49 @@ void main() {
108107 );
109108 expect (feature.dartContent, expectedFeatureDart);
110109 });
111- test ('custom headers replace default imports in feature file' , () async {
110+
111+ test ('Feature with special characters in names' , () {
112112 const expectedFeatureDart = '''
113- ${expectedComment }import 'package:patrol/patrol.dart';
114- // Import flutter_test for compatibility
115- import 'package:flutter_test/flutter_test.dart';
113+ $expectedComment // some comment
114+
115+ ${expectedImports }import './step/the_app_is_running.dart';
116+ import './step/i_see_text.dart';
117+
118+ void main() {
119+ group(\'\'\' "Testing" <Special> {Characters}\'\'\' , () {
120+ testWidgets(\'\'\' Test's "special" characters\'\'\' , (tester) async {
121+ await theAppIsRunning(tester);
122+ await iSeeText(tester, 'test');
123+ });
124+ });
125+ }
126+ ''' ;
116127
117- import './step/the_app_is_running.dart';
128+ final feature = FeatureFile (
129+ featureDir: 'test.feature' ,
130+ package: 'test' ,
131+ input: '''
132+ // some comment
133+
134+ Feature: "Testing" <Special> {Characters}
135+ Scenario: Test's "special" characters
136+ Given the app is running
137+ Then I see {'test'} text
138+ ''' ,
139+ );
140+ expect (feature.dartContent, expectedFeatureDart);
141+ });
142+
143+ test ('Feature with very long step description' , () {
144+ const expectedFeatureDart = '''
145+ ${expectedHeader }import './step/the_app_is_running.dart';
146+ import './step/i_verify_that_this_is_a_very_long_step_description_that_tests_whether_the_framework_can_handle_extremely_long_step_names_without_issues.dart';
118147
119148void main() {
120149 group(\'\'\' Testing feature\'\'\' , () {
121150 testWidgets(\'\'\' Testing scenario\'\'\' , (tester) async {
122151 await theAppIsRunning(tester);
152+ await iVerifyThatThisIsAVeryLongStepDescriptionThatTestsWhetherTheFrameworkCanHandleExtremelyLongStepNamesWithoutIssues(tester);
123153 });
124154 });
125155}
@@ -128,14 +158,55 @@ void main() {
128158 final feature = FeatureFile (
129159 featureDir: 'test.feature' ,
130160 package: 'test' ,
131- input: minimalFeatureFile,
132- generatorOptions: const GeneratorOptions (
133- customHeaders: [
134- "import 'package:patrol/patrol.dart';" ,
135- '// Import flutter_test for compatibility' ,
136- "import 'package:flutter_test/flutter_test.dart';" ,
137- ],
138- ),
161+ input: '''
162+ Feature: Testing feature
163+ Scenario: Testing scenario
164+ Given the app is running
165+ Then I verify that this is a very long step description that tests whether the framework can handle extremely long step names without issues
166+ ''' ,
167+ );
168+ expect (feature.dartContent, expectedFeatureDart);
169+ });
170+
171+ test ('Multiple scenarios in single feature' , () {
172+ const expectedFeatureDart = '''
173+ ${expectedHeader }import './step/the_app_is_running.dart';
174+ import './step/i_see_text.dart';
175+ import './step/i_tap_icon.dart';
176+
177+ void main() {
178+ group(\'\'\' Login feature\'\'\' , () {
179+ testWidgets(\'\'\' Successful login\'\'\' , (tester) async {
180+ await theAppIsRunning(tester);
181+ await iSeeText(tester, 'Login');
182+ });
183+ testWidgets(\'\'\' Failed login\'\'\' , (tester) async {
184+ await theAppIsRunning(tester);
185+ await iSeeText(tester, 'Error');
186+ });
187+ testWidgets(\'\'\' Logout\'\'\' , (tester) async {
188+ await iTapIcon(tester, Icons.logout);
189+ });
190+ });
191+ }
192+ ''' ;
193+
194+ final feature = FeatureFile (
195+ featureDir: 'test.feature' ,
196+ package: 'test' ,
197+ input: '''
198+ Feature: Login feature
199+ Scenario: Successful login
200+ Given the app is running
201+ Then I see {'Login'} text
202+
203+ Scenario: Failed login
204+ Given the app is running
205+ Then I see {'Error'} text
206+
207+ Scenario: Logout
208+ When I tap {Icons.logout} icon
209+ ''' ,
139210 );
140211 expect (feature.dartContent, expectedFeatureDart);
141212 });
0 commit comments