fix(#222): escape single quotation marks in data tables
This commit is contained in:
parent
1f63ecc858
commit
6736af335e
|
@ -1,3 +1,6 @@
|
||||||
|
## [3.0.0-rc.12] - 24/06/2022
|
||||||
|
- Fix #222 - escape single quotation marks in data tables
|
||||||
|
|
||||||
## [3.0.0-rc.11] - 24/06/2022
|
## [3.0.0-rc.11] - 24/06/2022
|
||||||
- Fix #231 - Removed the use of explicitly calling `pumpAndSettle` in the pre-defined steps in favour of the implicit `pumpAndSettle` calls used in the `WidgetTesterAppDriverAdapter`.
|
- Fix #231 - Removed the use of explicitly calling `pumpAndSettle` in the pre-defined steps in favour of the implicit `pumpAndSettle` calls used in the `WidgetTesterAppDriverAdapter`.
|
||||||
- Added ability to add a `appLifecyclePumpHandler` to override the default handler that determines how the app is pumped during lifecycle events. Useful if your app has a long splash screen etc. Parameter is on `executeTestSuite`.
|
- Added ability to add a `appLifecyclePumpHandler` to override the default handler that determines how the app is pumped during lifecycle events. Useful if your app has a long splash screen etc. Parameter is on `executeTestSuite`.
|
||||||
|
|
|
@ -11,15 +11,15 @@ Feature: Creating todos
|
||||||
Scenario: User can create multiple new todo items
|
Scenario: User can create multiple new todo items
|
||||||
Given I fill the "todo" field with "Buy carrots"
|
Given I fill the "todo" field with "Buy carrots"
|
||||||
When I tap the "add" button
|
When I tap the "add" button
|
||||||
And I fill the "todo" field with "Buy apples"
|
And I fill the "todo" field with "Buy hannah's apples"
|
||||||
When I tap the "add" button
|
When I tap the "add" button
|
||||||
And I fill the "todo" field with "Buy blueberries"
|
And I fill the "todo" field with "Buy blueberries"
|
||||||
When I tap the "add" button
|
When I tap the "add" button
|
||||||
Then I expect the todo list
|
Then I expect the todo list
|
||||||
| Todo |
|
| Todo |
|
||||||
| Buy blueberries |
|
| Buy blueberries |
|
||||||
| Buy apples |
|
| Buy hannah's apples |
|
||||||
| Buy carrots |
|
| Buy carrots |
|
||||||
Given I wait 5 seconds for the animation to complete
|
Given I wait 5 seconds for the animation to complete
|
||||||
Given I have item with data
|
Given I have item with data
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -27,6 +27,146 @@ class _CustomGherkinIntegrationTestRunner extends GherkinIntegrationTestRunner {
|
||||||
}
|
}
|
||||||
|
|
||||||
void testFeature0() {
|
void testFeature0() {
|
||||||
|
runFeature(
|
||||||
|
name: 'Swiping:',
|
||||||
|
tags: <String>['@tag'],
|
||||||
|
run: () {
|
||||||
|
runScenario(
|
||||||
|
name: 'User can swipe cards left and right',
|
||||||
|
path: '.\\integration_test\\features\\swiping.feature',
|
||||||
|
tags: <String>['@tag', '@debug'],
|
||||||
|
steps: [
|
||||||
|
(
|
||||||
|
TestDependencies dependencies,
|
||||||
|
bool skip,
|
||||||
|
) async {
|
||||||
|
return await runStep(
|
||||||
|
name:
|
||||||
|
'Given I swipe right by 250 pixels on the "scrollable cards"`',
|
||||||
|
multiLineStrings: <String>[],
|
||||||
|
table: null,
|
||||||
|
dependencies: dependencies,
|
||||||
|
skip: skip,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
(
|
||||||
|
TestDependencies dependencies,
|
||||||
|
bool skip,
|
||||||
|
) async {
|
||||||
|
return await runStep(
|
||||||
|
name: 'Then I expect the text "Page 2" to be present',
|
||||||
|
multiLineStrings: <String>[],
|
||||||
|
table: null,
|
||||||
|
dependencies: dependencies,
|
||||||
|
skip: skip,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
(
|
||||||
|
TestDependencies dependencies,
|
||||||
|
bool skip,
|
||||||
|
) async {
|
||||||
|
return await runStep(
|
||||||
|
name:
|
||||||
|
'Given I swipe left by 250 pixels on the "scrollable cards"`',
|
||||||
|
multiLineStrings: <String>[],
|
||||||
|
table: null,
|
||||||
|
dependencies: dependencies,
|
||||||
|
skip: skip,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
(
|
||||||
|
TestDependencies dependencies,
|
||||||
|
bool skip,
|
||||||
|
) async {
|
||||||
|
return await runStep(
|
||||||
|
name: 'Then I expect the text "Page 1" to be present',
|
||||||
|
multiLineStrings: <String>[],
|
||||||
|
table: null,
|
||||||
|
dependencies: dependencies,
|
||||||
|
skip: skip,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
],
|
||||||
|
onBefore: () async => onBeforeRunFeature(
|
||||||
|
name: 'Swiping',
|
||||||
|
path: r'.\\integration_test\\features\\swiping.feature',
|
||||||
|
tags: <String>['@tag'],
|
||||||
|
),
|
||||||
|
onAfter: () async => onAfterRunFeature(
|
||||||
|
name: 'Swiping',
|
||||||
|
path: r'.\\integration_test\\features\\swiping.feature',
|
||||||
|
tags: <String>['@tag'],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void testFeature1() {
|
||||||
|
runFeature(
|
||||||
|
name: 'Checking data:',
|
||||||
|
tags: <String>['@tag'],
|
||||||
|
run: () {
|
||||||
|
runScenario(
|
||||||
|
name: 'User can have data',
|
||||||
|
path: '.\\integration_test\\features\\check.feature',
|
||||||
|
tags: <String>['@tag', '@tag1'],
|
||||||
|
steps: [
|
||||||
|
(
|
||||||
|
TestDependencies dependencies,
|
||||||
|
bool skip,
|
||||||
|
) async {
|
||||||
|
return await runStep(
|
||||||
|
name: 'Given I have item with data',
|
||||||
|
multiLineStrings: <String>[
|
||||||
|
"""{
|
||||||
|
"glossary": {
|
||||||
|
"title": "example glossary",
|
||||||
|
"GlossDiv": {
|
||||||
|
"title": "S",
|
||||||
|
"GlossList": {
|
||||||
|
"GlossEntry": {
|
||||||
|
"ID": "SGML",
|
||||||
|
"SortAs": "SGML",
|
||||||
|
"GlossTerm": "Standard Generalized Markup Language",
|
||||||
|
"Acronym": "SGML",
|
||||||
|
"Abbrev": "ISO 8879:1986",
|
||||||
|
"GlossDef": {
|
||||||
|
"para": "A meta-markup language, used to create markup languages such as DocBook.",
|
||||||
|
"GlossSeeAlso": [
|
||||||
|
"GML",
|
||||||
|
"XML"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"GlossSee": "markup"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}"""
|
||||||
|
],
|
||||||
|
table: null,
|
||||||
|
dependencies: dependencies,
|
||||||
|
skip: skip,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
],
|
||||||
|
onBefore: () async => onBeforeRunFeature(
|
||||||
|
name: 'Checking data',
|
||||||
|
path: r'.\\integration_test\\features\\check.feature',
|
||||||
|
tags: <String>['@tag'],
|
||||||
|
),
|
||||||
|
onAfter: () async => onAfterRunFeature(
|
||||||
|
name: 'Checking data',
|
||||||
|
path: r'.\\integration_test\\features\\check.feature',
|
||||||
|
tags: <String>['@tag'],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void testFeature2() {
|
||||||
runFeature(
|
runFeature(
|
||||||
name: 'Creating todos:',
|
name: 'Creating todos:',
|
||||||
tags: <String>['@tag'],
|
tags: <String>['@tag'],
|
||||||
|
@ -114,7 +254,7 @@ class _CustomGherkinIntegrationTestRunner extends GherkinIntegrationTestRunner {
|
||||||
bool skip,
|
bool skip,
|
||||||
) async {
|
) async {
|
||||||
return await runStep(
|
return await runStep(
|
||||||
name: 'And I fill the "todo" field with "Buy apples"',
|
name: 'And I fill the "todo" field with "Buy hannah\'s apples"',
|
||||||
multiLineStrings: <String>[],
|
multiLineStrings: <String>[],
|
||||||
table: null,
|
table: null,
|
||||||
dependencies: dependencies,
|
dependencies: dependencies,
|
||||||
|
@ -165,7 +305,7 @@ class _CustomGherkinIntegrationTestRunner extends GherkinIntegrationTestRunner {
|
||||||
name: 'Then I expect the todo list',
|
name: 'Then I expect the todo list',
|
||||||
multiLineStrings: <String>[],
|
multiLineStrings: <String>[],
|
||||||
table: GherkinTable.fromJson(
|
table: GherkinTable.fromJson(
|
||||||
'[{"Todo":"Buy blueberries"},{"Todo":"Buy apples"},{"Todo":"Buy carrots"}]'),
|
'[{"Todo":"Buy blueberries"},{"Todo":"Buy hannah\'s apples"},{"Todo":"Buy carrots"}]'),
|
||||||
dependencies: dependencies,
|
dependencies: dependencies,
|
||||||
skip: skip,
|
skip: skip,
|
||||||
);
|
);
|
||||||
|
@ -230,146 +370,6 @@ class _CustomGherkinIntegrationTestRunner extends GherkinIntegrationTestRunner {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testFeature1() {
|
|
||||||
runFeature(
|
|
||||||
name: 'Swiping:',
|
|
||||||
tags: <String>['@tag'],
|
|
||||||
run: () {
|
|
||||||
runScenario(
|
|
||||||
name: 'User can swipe cards left and right',
|
|
||||||
path: '.\\integration_test\\features\\swiping.feature',
|
|
||||||
tags: <String>['@tag', '@debug'],
|
|
||||||
steps: [
|
|
||||||
(
|
|
||||||
TestDependencies dependencies,
|
|
||||||
bool skip,
|
|
||||||
) async {
|
|
||||||
return await runStep(
|
|
||||||
name:
|
|
||||||
'Given I swipe right by 250 pixels on the "scrollable cards"`',
|
|
||||||
multiLineStrings: <String>[],
|
|
||||||
table: null,
|
|
||||||
dependencies: dependencies,
|
|
||||||
skip: skip,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
(
|
|
||||||
TestDependencies dependencies,
|
|
||||||
bool skip,
|
|
||||||
) async {
|
|
||||||
return await runStep(
|
|
||||||
name: 'Then I expect the text "Page 2" to be present',
|
|
||||||
multiLineStrings: <String>[],
|
|
||||||
table: null,
|
|
||||||
dependencies: dependencies,
|
|
||||||
skip: skip,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
(
|
|
||||||
TestDependencies dependencies,
|
|
||||||
bool skip,
|
|
||||||
) async {
|
|
||||||
return await runStep(
|
|
||||||
name:
|
|
||||||
'Given I swipe left by 250 pixels on the "scrollable cards"`',
|
|
||||||
multiLineStrings: <String>[],
|
|
||||||
table: null,
|
|
||||||
dependencies: dependencies,
|
|
||||||
skip: skip,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
(
|
|
||||||
TestDependencies dependencies,
|
|
||||||
bool skip,
|
|
||||||
) async {
|
|
||||||
return await runStep(
|
|
||||||
name: 'Then I expect the text "Page 1" to be present',
|
|
||||||
multiLineStrings: <String>[],
|
|
||||||
table: null,
|
|
||||||
dependencies: dependencies,
|
|
||||||
skip: skip,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
],
|
|
||||||
onBefore: () async => onBeforeRunFeature(
|
|
||||||
name: 'Swiping',
|
|
||||||
path: r'.\\integration_test\\features\\swiping.feature',
|
|
||||||
tags: <String>['@tag'],
|
|
||||||
),
|
|
||||||
onAfter: () async => onAfterRunFeature(
|
|
||||||
name: 'Swiping',
|
|
||||||
path: r'.\\integration_test\\features\\swiping.feature',
|
|
||||||
tags: <String>['@tag'],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void testFeature2() {
|
|
||||||
runFeature(
|
|
||||||
name: 'Checking data:',
|
|
||||||
tags: <String>['@tag'],
|
|
||||||
run: () {
|
|
||||||
runScenario(
|
|
||||||
name: 'User can have data',
|
|
||||||
path: '.\\integration_test\\features\\check.feature',
|
|
||||||
tags: <String>['@tag', '@tag1'],
|
|
||||||
steps: [
|
|
||||||
(
|
|
||||||
TestDependencies dependencies,
|
|
||||||
bool skip,
|
|
||||||
) async {
|
|
||||||
return await runStep(
|
|
||||||
name: 'Given I have item with data',
|
|
||||||
multiLineStrings: <String>[
|
|
||||||
"""{
|
|
||||||
"glossary": {
|
|
||||||
"title": "example glossary",
|
|
||||||
"GlossDiv": {
|
|
||||||
"title": "S",
|
|
||||||
"GlossList": {
|
|
||||||
"GlossEntry": {
|
|
||||||
"ID": "SGML",
|
|
||||||
"SortAs": "SGML",
|
|
||||||
"GlossTerm": "Standard Generalized Markup Language",
|
|
||||||
"Acronym": "SGML",
|
|
||||||
"Abbrev": "ISO 8879:1986",
|
|
||||||
"GlossDef": {
|
|
||||||
"para": "A meta-markup language, used to create markup languages such as DocBook.",
|
|
||||||
"GlossSeeAlso": [
|
|
||||||
"GML",
|
|
||||||
"XML"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"GlossSee": "markup"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}"""
|
|
||||||
],
|
|
||||||
table: null,
|
|
||||||
dependencies: dependencies,
|
|
||||||
skip: skip,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
],
|
|
||||||
onBefore: () async => onBeforeRunFeature(
|
|
||||||
name: 'Checking data',
|
|
||||||
path: r'.\\integration_test\\features\\check.feature',
|
|
||||||
tags: <String>['@tag'],
|
|
||||||
),
|
|
||||||
onAfter: () async => onAfterRunFeature(
|
|
||||||
name: 'Checking data',
|
|
||||||
path: r'.\\integration_test\\features\\check.feature',
|
|
||||||
tags: <String>['@tag'],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void executeTestSuite({
|
void executeTestSuite({
|
||||||
|
|
|
@ -301,13 +301,14 @@ class FeatureFileTestGeneratorVisitor extends FeatureFileVisitor {
|
||||||
code = _replaceVariable(
|
code = _replaceVariable(
|
||||||
code,
|
code,
|
||||||
'step_multi_line_strings',
|
'step_multi_line_strings',
|
||||||
// '<String>[${multiLineStrings.map((s) => "'${_escapeText(s)}'").join(',')}]',
|
|
||||||
'<String>[${multiLineStrings.map((s) => '"""$s"""').join(',')}]',
|
'<String>[${multiLineStrings.map((s) => '"""$s"""').join(',')}]',
|
||||||
);
|
);
|
||||||
code = _replaceVariable(
|
code = _replaceVariable(
|
||||||
code,
|
code,
|
||||||
'step_table',
|
'step_table',
|
||||||
table == null ? 'null' : 'GherkinTable.fromJson(\'${table.toJson()}\')',
|
table == null
|
||||||
|
? 'null'
|
||||||
|
: 'GherkinTable.fromJson(\'${_escapeText(table.toJson())}\')',
|
||||||
);
|
);
|
||||||
|
|
||||||
_stepBuffer.writeln(code);
|
_stepBuffer.writeln(code);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: flutter_gherkin
|
name: flutter_gherkin
|
||||||
description: A Gherkin / Cucumber parser and test runner for Dart and Flutter
|
description: A Gherkin / Cucumber parser and test runner for Dart and Flutter
|
||||||
version: 3.0.0-rc.11
|
version: 3.0.0-rc.12
|
||||||
homepage: https://github.com/jonsamwell/flutter_gherkin
|
homepage: https://github.com/jonsamwell/flutter_gherkin
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
|
Loading…
Reference in New Issue