@suffolklitlab/alkiln 4.6.1 → 4.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/test_tests.yml +14 -34
- package/CHANGELOG.md +26 -0
- package/action.yml +6 -35
- package/lib/docassemble/setup.js +6 -0
- package/lib/scope.js +529 -111
- package/lib/steps.js +236 -25
- package/lib/utils/clean_reports.js +9 -3
- package/lib/utils/files.js +33 -0
- package/lib/utils/session_vars.js +56 -13
- package/package.json +2 -1
- package/tests/features/interactive_steps.feature +2 -2
- package/tests/features/observation_steps.feature +2 -2
- package/tests/features/random_input.feature +31 -0
- package/tests/features/story_table_formats.feature +49 -1
- package/tests/unit_tests/getSafeScenarioBaseFilename.fixtures.js +0 -2
- package/tests/unit_tests/getSafeScenarioBaseFilename.test.js +10 -21
- package/tests/unit_tests/getSafeScenarioFilename.test.js +6 -3
- package/tests/unit_tests/names.fixtures.js +8 -8
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
@random_input
|
|
2
|
+
Feature: Assembly Line package-specific Steps
|
|
3
|
+
|
|
4
|
+
# In tag names, 'ri' is for 'random input'
|
|
5
|
+
|
|
6
|
+
@fast @ri1 @random
|
|
7
|
+
Scenario: I fill in random input till the end
|
|
8
|
+
Given I start the interview at "test_random_input"
|
|
9
|
+
And I answer randomly for at most 20 pages
|
|
10
|
+
Then the question id should be "end"
|
|
11
|
+
|
|
12
|
+
@fast @ri2 @random
|
|
13
|
+
Scenario: I fill in random input for 1 page
|
|
14
|
+
Given I start the interview at "test_random_input"
|
|
15
|
+
And I answer randomly for at most 1 page
|
|
16
|
+
|
|
17
|
+
# Should create two unique folders for random step screenshots which
|
|
18
|
+
# must be checked manually
|
|
19
|
+
@fast @ri3 @random
|
|
20
|
+
Scenario: I answer randomly till the end twice
|
|
21
|
+
Given I start the interview at "test_random_input"
|
|
22
|
+
And I answer randomly for at most 50 pages
|
|
23
|
+
Given I start the interview at "test_random_input"
|
|
24
|
+
And I answer randomly for at most 50 pages
|
|
25
|
+
|
|
26
|
+
@fast @ri4 @random @error
|
|
27
|
+
Scenario: Fail with error page from random input
|
|
28
|
+
Given the final Scenario status should be "failed"
|
|
29
|
+
Given I start the interview at "test_missing_var_error_screen"
|
|
30
|
+
And the max seconds for each step in this scenario is 10
|
|
31
|
+
And I answer randomly for at most 3 pages
|
|
@@ -3,7 +3,6 @@ Feature: Supported story table formats
|
|
|
3
3
|
|
|
4
4
|
NOTE:
|
|
5
5
|
Unsupported formats:
|
|
6
|
-
- Arrays (see https://github.com/plocket/docassemble-cucumber/issues/257)
|
|
7
6
|
- Format 1 and 2 tables (permanent) (see https://github.com/plocket/docassemble-cucumber/issues/264)
|
|
8
7
|
|
|
9
8
|
NOTE:
|
|
@@ -75,3 +74,52 @@ Scenario: Table MISSING trigger column
|
|
|
75
74
|
| single_quote_dict['single_quote_key']['sq_two'] | true |
|
|
76
75
|
| text_input | Regular text input field value |
|
|
77
76
|
| textarea | Multiline text\narea value |
|
|
77
|
+
|
|
78
|
+
@fast @stf5
|
|
79
|
+
Scenario: Table has no header row, has trigger column
|
|
80
|
+
Given I start the interview at "all_tests"
|
|
81
|
+
And I get to "showifs" with this data:
|
|
82
|
+
| double_quote_dict["double_quote_key"]['dq_two'] | true | |
|
|
83
|
+
| checkboxes_other['checkbox_other_opt_1'] | true | |
|
|
84
|
+
| checkboxes_other['checkbox_other_opt_2'] | true | |
|
|
85
|
+
| checkboxes_other['checkbox_other_opt_3'] | false | |
|
|
86
|
+
| checkboxes_yesno | True | |
|
|
87
|
+
| dropdown_test | dropdown_opt_2 | |
|
|
88
|
+
| radio_other | radio_other_opt_3 | |
|
|
89
|
+
| radio_yesno | False | |
|
|
90
|
+
| single_quote_dict['single_quote_key']['sq_two'] | true | |
|
|
91
|
+
| text_input | Regular text input field value | |
|
|
92
|
+
| textarea | Multiline text\narea value | |
|
|
93
|
+
|
|
94
|
+
@fast @stf6
|
|
95
|
+
Scenario: Table has no header row, MISSING trigger column
|
|
96
|
+
Given I start the interview at "all_tests"
|
|
97
|
+
And I get to "showifs" with this data:
|
|
98
|
+
| double_quote_dict["double_quote_key"]['dq_two'] | true |
|
|
99
|
+
| checkboxes_other['checkbox_other_opt_2'] | true |
|
|
100
|
+
| checkboxes_yesno | True |
|
|
101
|
+
| dropdown_test | dropdown_opt_2 |
|
|
102
|
+
| radio_other | radio_other_opt_3 |
|
|
103
|
+
| radio_yesno | False |
|
|
104
|
+
| single_quote_dict['single_quote_key']['sq_two'] | true |
|
|
105
|
+
| text_input | Regular text input field value |
|
|
106
|
+
| textarea | Multiline text\narea value |
|
|
107
|
+
|
|
108
|
+
@fast @stf7
|
|
109
|
+
Scenario: Fails when table has no header row and rows have only one column
|
|
110
|
+
Given the final Scenario status should be "failed"
|
|
111
|
+
And the Scenario report should include:
|
|
112
|
+
"""
|
|
113
|
+
Your Story Table definition needs to be changed.
|
|
114
|
+
"""
|
|
115
|
+
Given I start the interview at "all_tests"
|
|
116
|
+
And I get to "showifs" with this data:
|
|
117
|
+
| double_quote_dict["double_quote_key"]['dq_two'] |
|
|
118
|
+
| checkboxes_other['checkbox_other_opt_2'] |
|
|
119
|
+
| checkboxes_yesno |
|
|
120
|
+
| dropdown_test |
|
|
121
|
+
| radio_other |
|
|
122
|
+
| radio_yesno |
|
|
123
|
+
| single_quote_dict['single_quote_key']['sq_two'] |
|
|
124
|
+
| text_input |
|
|
125
|
+
| textarea |
|
|
@@ -6,14 +6,11 @@ const scope = require(`../../lib/scope.js`);
|
|
|
6
6
|
const getSafeScenarioBaseFilename = scope.getSafeScenarioBaseFilename;
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
let mock_scenario = function ( description
|
|
9
|
+
let mock_scenario = function ( description ) {
|
|
10
10
|
/** Mock the complex structure of a Scenario object */
|
|
11
11
|
let scenario = {
|
|
12
|
-
pickle: { name: description
|
|
12
|
+
pickle: { name: description }
|
|
13
13
|
};
|
|
14
|
-
for ( let tag of tag_names ) {
|
|
15
|
-
scenario.pickle.tags.push({ name: tag });
|
|
16
|
-
}
|
|
17
14
|
return scenario;
|
|
18
15
|
}; // Ends mock_scenario();
|
|
19
16
|
|
|
@@ -23,39 +20,31 @@ describe(`When I use scope.getSafeScenarioBaseFilename()`, function() {
|
|
|
23
20
|
scope.language = undefined;
|
|
24
21
|
});
|
|
25
22
|
|
|
26
|
-
// No language
|
|
23
|
+
// No language
|
|
27
24
|
it(`preserves spaces`, async function() {
|
|
28
|
-
let scenario = mock_scenario( names.with_spaces
|
|
25
|
+
let scenario = mock_scenario( names.with_spaces );
|
|
29
26
|
let result = await getSafeScenarioBaseFilename( scope, { scenario });
|
|
30
27
|
expect( result ).to.equal( names.with_spaces );
|
|
31
28
|
});
|
|
32
29
|
|
|
33
30
|
it(`preserves non-english characters`, async function() {
|
|
34
|
-
let scenario = mock_scenario( names.non_english_chars
|
|
31
|
+
let scenario = mock_scenario( names.non_english_chars );
|
|
35
32
|
let result = await getSafeScenarioBaseFilename( scope, { scenario });
|
|
36
33
|
expect( result ).to.equal( names.non_english_chars );
|
|
37
34
|
});
|
|
38
35
|
|
|
39
36
|
it(`replaces invalid characters with "_"`, async function() {
|
|
40
|
-
let scenario = mock_scenario( names.colon_input
|
|
37
|
+
let scenario = mock_scenario( names.colon_input );
|
|
41
38
|
let result = await getSafeScenarioBaseFilename( scope, { scenario });
|
|
42
39
|
expect( result ).to.equal( names.colon_output );
|
|
43
40
|
});
|
|
44
41
|
|
|
45
|
-
// language
|
|
46
|
-
it(`adds a language
|
|
42
|
+
// language
|
|
43
|
+
it(`adds a language correctly to a description`, async function() {
|
|
47
44
|
scope.language = names.non_english_chars;
|
|
48
|
-
let scenario = mock_scenario( names.with_spaces
|
|
45
|
+
let scenario = mock_scenario( names.with_spaces );
|
|
49
46
|
let result = await getSafeScenarioBaseFilename( scope, { scenario });
|
|
50
|
-
let expected = `${ names.non_english_chars }-${ names.with_spaces }
|
|
51
|
-
expect( result ).to.equal( expected );
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// 2 tags
|
|
55
|
-
it(`adds 2 tags correctly, preserving numbers`, async function() {
|
|
56
|
-
let scenario = mock_scenario( names.with_spaces, [ names.tag1, names.tag2 ] );
|
|
57
|
-
let result = await getSafeScenarioBaseFilename( scope, { scenario });
|
|
58
|
-
let expected = `${ names.with_spaces }-${ names.tag1 }-${ names.tag2 }`;
|
|
47
|
+
let expected = `${ names.non_english_chars }-${ names.with_spaces }`;
|
|
59
48
|
expect( result ).to.equal( expected );
|
|
60
49
|
});
|
|
61
50
|
|
|
@@ -8,9 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
let test_filename = function ( expected_prefix, result ) {
|
|
11
|
-
|
|
12
|
-
let expected_name_regex_str = `^${ expected_prefix }
|
|
13
|
-
|
|
11
|
+
/* Test a name to see if it's valid output with a language defined. */
|
|
12
|
+
let expected_name_regex_str = `^${ expected_prefix }-${ names.base_filename }-\.{37}$`;
|
|
13
|
+
if ( expected_prefix == `` ) {
|
|
14
|
+
expected_name_regex_str = `^${ names.base_filename }-\.{37}$`;
|
|
15
|
+
}
|
|
16
|
+
let regex = new RegExp( expected_name_regex_str );
|
|
14
17
|
|
|
15
18
|
// Log more info if it failed
|
|
16
19
|
let found_match = regex.test( result );
|
|
@@ -3,16 +3,16 @@ let names = {};
|
|
|
3
3
|
names.base_filename = `a_safe_id`;
|
|
4
4
|
|
|
5
5
|
names.chinese_input = `是汉字`;
|
|
6
|
-
names.chinese_output =
|
|
6
|
+
names.chinese_output = `是汉字`;
|
|
7
7
|
|
|
8
8
|
names.no_underscore_input = `ends_in_no_underscore`;
|
|
9
|
-
names.no_underscore_output = `
|
|
9
|
+
names.no_underscore_output = `ends_in_no_underscore`;
|
|
10
10
|
|
|
11
11
|
names.one_underscore_input = `ends_in_one_underscore_`;
|
|
12
|
-
names.one_underscore_output = `
|
|
12
|
+
names.one_underscore_output = `ends_in_one_underscore_`;
|
|
13
13
|
|
|
14
14
|
names.two_underscores_input = `ends_in_two_underscores__`;
|
|
15
|
-
names.two_underscores_output = `
|
|
15
|
+
names.two_underscores_output = `ends_in_two_underscores__`;
|
|
16
16
|
|
|
17
17
|
names.empty_string_input = ``;
|
|
18
18
|
names.empty_string_output = ``;
|
|
@@ -21,15 +21,15 @@ names.undefined_input;
|
|
|
21
21
|
names.undefined_output = ``;
|
|
22
22
|
|
|
23
23
|
names.colon_input = `invalid:colon`;
|
|
24
|
-
names.colon_output = `
|
|
24
|
+
names.colon_output = `invalid_colon`;
|
|
25
25
|
|
|
26
26
|
names.slash_input = `invalid/slash`;
|
|
27
|
-
names.slash_output = `
|
|
27
|
+
names.slash_output = `invalid_slash`;
|
|
28
28
|
|
|
29
29
|
names.two_consecutive_invalid_input = `two_consecutive//invalid`;
|
|
30
|
-
names.two_consecutive_invalid_output = `
|
|
30
|
+
names.two_consecutive_invalid_output = `two_consecutive__invalid`;
|
|
31
31
|
|
|
32
32
|
names.numerical_input = `scenario_w1th_number00`;
|
|
33
|
-
names.numerical_output = `
|
|
33
|
+
names.numerical_output = `scenario_w1th_number00`;
|
|
34
34
|
|
|
35
35
|
module.exports = names;
|