@suffolklitlab/alkiln 3.0.9
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 +77 -0
- package/CHANGELOG.md +381 -0
- package/README.md +18 -0
- package/action.yml +158 -0
- package/lib/DOM.md.html +63 -0
- package/lib/github_integration/install-branch.js +84 -0
- package/lib/github_integration/puppeteer-utils.js +224 -0
- package/lib/github_integration/setup.js +4 -0
- package/lib/github_integration/takedown.js +4 -0
- package/lib/index.js +2 -0
- package/lib/scope.js +1632 -0
- package/lib/steps.js +878 -0
- package/lib/utils/env_vars.js +173 -0
- package/lib/utils/langs.js +51 -0
- package/lib/world.js +10 -0
- package/package.json +53 -0
- package/tests/features/assembly_line.feature +43 -0
- package/tests/features/establishing_steps.feature +22 -0
- package/tests/features/example_test.feature +11 -0
- package/tests/features/interactive_steps.feature +85 -0
- package/tests/features/observation_steps.feature +97 -0
- package/tests/features/reports.feature +482 -0
- package/tests/features/some_png_1.png +0 -0
- package/tests/features/some_png_2.png +0 -0
- package/tests/features/story_table_formats.feature +77 -0
- package/tests/features/story_tables.feature +88 -0
- package/tests/unit_tests/ensureSpecialRows.test.js +34 -0
- package/tests/unit_tests/env_vars.test.js +53 -0
- package/tests/unit_tests/fields.fixtures.js +904 -0
- package/tests/unit_tests/getAllFields.test.js +142 -0
- package/tests/unit_tests/getMatchingRows.test.js +261 -0
- package/tests/unit_tests/getSafeScenarioBaseFilename.fixtures.js +12 -0
- package/tests/unit_tests/getSafeScenarioBaseFilename.test.js +62 -0
- package/tests/unit_tests/getSafeScenarioFilename.test.js +83 -0
- package/tests/unit_tests/html.fixtures.js +861 -0
- package/tests/unit_tests/matches.fixtures.js +168 -0
- package/tests/unit_tests/names.fixtures.js +35 -0
- package/tests/unit_tests/normalizeTable.test.js +22 -0
- package/tests/unit_tests/special_rows.fixtures.js +101 -0
- package/tests/unit_tests/tables.fixtures.js +428 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
let matches = {}
|
|
2
|
+
|
|
3
|
+
// ============================
|
|
4
|
+
// Standard fields - no proxies, no showifs.
|
|
5
|
+
// ============================
|
|
6
|
+
// TODO: Add more complex fields. E.g `object_checkboxes` and dropdown with `object`.
|
|
7
|
+
matches.standard = [
|
|
8
|
+
[ { var: 'checkboxes_yesno', value: 'True' } ],
|
|
9
|
+
[ { var: "checkboxes_other['checkbox_other_opt_1']", value: 'false' } ],
|
|
10
|
+
[ { var: "checkboxes_other['checkbox_other_opt_2']", value: 'true' } ],
|
|
11
|
+
[ { var: "checkboxes_other['checkbox_other_opt_3']", value: 'false' } ],
|
|
12
|
+
[ { var: "checkboxes_other['None']", value: 'false' } ],
|
|
13
|
+
[],
|
|
14
|
+
[ { var: 'radio_yesno', value: 'False' } ],
|
|
15
|
+
[],
|
|
16
|
+
[ { var: 'radio_other', value: 'radio_other_opt_2' } ],
|
|
17
|
+
[],
|
|
18
|
+
[ { var: 'text_input', value: 'Some one-line text' }, { var: 'text_input', value: 'Some conflicting text' } ],
|
|
19
|
+
[ { var: 'textarea', value: 'Some\nmulti-line\ntext' } ],
|
|
20
|
+
[ { 'var': 'date_input','value':'today-1' } ],
|
|
21
|
+
[ { var: 'dropdown_test', value: 'dropdown_opt_2' } ],
|
|
22
|
+
[ { var: 'direct_standard_fields', value: 'True' } ]
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// ============================
|
|
27
|
+
// Simple show if fields - no proxies
|
|
28
|
+
// ============================
|
|
29
|
+
matches.show_if = [
|
|
30
|
+
[ { var: 'show_2', value: 'True' } ],
|
|
31
|
+
[ { var: 'show_3', value: 'True' } ],
|
|
32
|
+
[ { var: 'showif_checkbox_yesno', value: 'True' } ],
|
|
33
|
+
[ { var: "showif_checkboxes_other['showif_checkboxes_nota_1']", value: 'false' } ],
|
|
34
|
+
[ { var: "showif_checkboxes_other['showif_checkboxes_nota_2']", value: 'true' } ],
|
|
35
|
+
[],
|
|
36
|
+
[ { var: "showif_checkboxes_other['None']", value: 'false' } ],
|
|
37
|
+
[],
|
|
38
|
+
[ { var: 'showif_yesnoradio', value: 'False' } ],
|
|
39
|
+
[],
|
|
40
|
+
[ { var: 'showif_radio_other', value: 'showif_radio_multi_2' } ],
|
|
41
|
+
[],
|
|
42
|
+
[ { var: 'showif_text_input', value: 'Some one-line text in show if input' } ],
|
|
43
|
+
[ { var: 'showif_textarea', value: 'Some\nmulti-line\ntext in show if textarea' } ],
|
|
44
|
+
[ { var: 'showif_dropdown', value: 'showif_dropdown_2' } ],
|
|
45
|
+
[ { var: 'direct_showifs', value: 'True' } ]
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
// ============================
|
|
50
|
+
// Buttons
|
|
51
|
+
// ============================
|
|
52
|
+
// `continue button field:`
|
|
53
|
+
matches.button_continue = [
|
|
54
|
+
[{"var":"button_continue","value":"True"}]
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
// `yesnomaybe:`
|
|
58
|
+
matches.buttons_yesnomaybe_yes = [
|
|
59
|
+
[{"var":"buttons_yesnomaybe","value":"True"}],
|
|
60
|
+
[],
|
|
61
|
+
[]
|
|
62
|
+
];
|
|
63
|
+
matches.buttons_yesnomaybe_no = [
|
|
64
|
+
[],
|
|
65
|
+
[{"var":"buttons_yesnomaybe","value":"False"}],
|
|
66
|
+
[]
|
|
67
|
+
];
|
|
68
|
+
matches.buttons_yesnomaybe_none = [
|
|
69
|
+
[],
|
|
70
|
+
[],
|
|
71
|
+
[{"var":"buttons_yesnomaybe","value":"None"}]
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
// `field:` and `buttons:`
|
|
75
|
+
matches.buttons_other_1 = [
|
|
76
|
+
[{"var":"buttons_other","value":"button_1"}],
|
|
77
|
+
[],
|
|
78
|
+
[]
|
|
79
|
+
];
|
|
80
|
+
matches.buttons_other_2 = [
|
|
81
|
+
[],
|
|
82
|
+
[{"var":"buttons_other","value":"button_2"}],
|
|
83
|
+
[]
|
|
84
|
+
];
|
|
85
|
+
matches.buttons_other_3 = [
|
|
86
|
+
[],
|
|
87
|
+
[],
|
|
88
|
+
[{"var":"buttons_other","value":"button_3"}]
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
// `field:` and `action buttons:`
|
|
92
|
+
matches.buttons_event_action = [
|
|
93
|
+
[],
|
|
94
|
+
[{"var":"end","value":""}]
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
// ============================
|
|
99
|
+
// Proxy vars (x, i, j, ...)
|
|
100
|
+
// ============================
|
|
101
|
+
// x[i].name.first
|
|
102
|
+
matches.proxies_xi = [
|
|
103
|
+
[{"trigger":"proxy_list[0].name.first","var":"x[i].name.first","value":"Firstname"}],
|
|
104
|
+
[]
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
// Multiple proxies by the same name are on the list (because of a loop)
|
|
108
|
+
// x[i].name.first
|
|
109
|
+
matches.proxies_multi = [
|
|
110
|
+
[{"trigger":"proxy_list[1].name.first","var":"x[i].name.first","value":"Firstname"}],
|
|
111
|
+
[]
|
|
112
|
+
];
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
// ============================
|
|
116
|
+
// Signature
|
|
117
|
+
// ============================
|
|
118
|
+
matches.signature = [
|
|
119
|
+
[{"trigger":"signature_1","var":"signature_1","value":"/sign"}]
|
|
120
|
+
];
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
// ============================
|
|
124
|
+
// `choices:`
|
|
125
|
+
// ============================
|
|
126
|
+
// `field:` and `choices:`
|
|
127
|
+
matches.choices = [
|
|
128
|
+
[{"var":"field_and_choices","value":"Choice 1"}],
|
|
129
|
+
[],
|
|
130
|
+
[]
|
|
131
|
+
];
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
// ============================
|
|
135
|
+
// dropdowns created with objects
|
|
136
|
+
// ============================
|
|
137
|
+
// ```
|
|
138
|
+
// - Something: some_var
|
|
139
|
+
// datatype: object
|
|
140
|
+
// object labeler: |
|
|
141
|
+
// lambda y: y.short_label()```
|
|
142
|
+
// choices: some_obj
|
|
143
|
+
// ```
|
|
144
|
+
matches.object_dropdown = [
|
|
145
|
+
[{"var":"object_dropdown","value":"obj_opt_2"}],
|
|
146
|
+
[],
|
|
147
|
+
[]
|
|
148
|
+
];
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
// ============================
|
|
152
|
+
// quotes
|
|
153
|
+
// ============================
|
|
154
|
+
matches.mixed_quotes = [
|
|
155
|
+
[],
|
|
156
|
+
[ { var: `single_quote_dict["single_quote_key"]['sq_two']`, value: 'True', trigger: `double_quote_dict['double_quote_key']` } ],
|
|
157
|
+
[],
|
|
158
|
+
[],
|
|
159
|
+
[],
|
|
160
|
+
[ { var: `double_quote_dict['double_quote_key']["dq_two"]`, value: 'True', trigger: `double_quote_dict["double_quote_key"]` } ],
|
|
161
|
+
[],
|
|
162
|
+
[],
|
|
163
|
+
[],
|
|
164
|
+
[],
|
|
165
|
+
];
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
module.exports = matches;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
let names = {};
|
|
2
|
+
|
|
3
|
+
names.base_filename = `a_safe_id`;
|
|
4
|
+
|
|
5
|
+
names.chinese_input = `是汉字`;
|
|
6
|
+
names.chinese_output = `是汉字_`;
|
|
7
|
+
|
|
8
|
+
names.no_underscore_input = `ends_in_no_underscore`;
|
|
9
|
+
names.no_underscore_output = `ends_in_no_underscore_`;
|
|
10
|
+
|
|
11
|
+
names.one_underscore_input = `ends_in_one_underscore_`;
|
|
12
|
+
names.one_underscore_output = `ends_in_one_underscore__`;
|
|
13
|
+
|
|
14
|
+
names.two_underscores_input = `ends_in_two_underscores__`;
|
|
15
|
+
names.two_underscores_output = `ends_in_two_underscores___`;
|
|
16
|
+
|
|
17
|
+
names.empty_string_input = ``;
|
|
18
|
+
names.empty_string_output = ``;
|
|
19
|
+
|
|
20
|
+
names.undefined_input;
|
|
21
|
+
names.undefined_output = ``;
|
|
22
|
+
|
|
23
|
+
names.colon_input = `invalid:colon`;
|
|
24
|
+
names.colon_output = `invalid_colon_`;
|
|
25
|
+
|
|
26
|
+
names.slash_input = `invalid/slash`;
|
|
27
|
+
names.slash_output = `invalid_slash_`;
|
|
28
|
+
|
|
29
|
+
names.two_consecutive_invalid_input = `two_consecutive//invalid`;
|
|
30
|
+
names.two_consecutive_invalid_output = `two_consecutive__invalid_`;
|
|
31
|
+
|
|
32
|
+
names.numerical_input = `scenario_w1th_number00`;
|
|
33
|
+
names.numerical_output = `scenario_w1th_number00_`;
|
|
34
|
+
|
|
35
|
+
module.exports = names;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const chai = require('chai');
|
|
2
|
+
const expect = chai.expect;
|
|
3
|
+
// We need jest or something, right? To do fancy stuff.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const tables = require('./tables.fixtures.js');
|
|
7
|
+
const scope = require('../../lib/scope.js');
|
|
8
|
+
const normalizeTable = scope.normalizeTable;
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
// ============================
|
|
12
|
+
// Change old table into new table
|
|
13
|
+
// ============================
|
|
14
|
+
it("normalizes a table with standard formatting correctly", async function() {
|
|
15
|
+
let result = await normalizeTable( scope, { var_data: tables.standard_formatting });
|
|
16
|
+
expect( result ).to.deep.equal( tables.standard_normalized_formatting );
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("normalizes a table with missng `trigger` column correctly", async function() {
|
|
20
|
+
let result = await normalizeTable( scope, { var_data: tables.missing_sought });
|
|
21
|
+
expect( result ).to.deep.equal( tables.missing_sought_to_normalized_formatting );
|
|
22
|
+
});
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
let special_rows = {};
|
|
2
|
+
|
|
3
|
+
// Includes `.there_is_another` and `.target_nubmer`.
|
|
4
|
+
// In the future, maybe some false positives/negatives.
|
|
5
|
+
|
|
6
|
+
// ==============================
|
|
7
|
+
// `.target_number`
|
|
8
|
+
// ==============================
|
|
9
|
+
// 3 `users`, 2 `parents`
|
|
10
|
+
|
|
11
|
+
// 1st press (Yes)
|
|
12
|
+
special_rows.target_num_first_input = [
|
|
13
|
+
{
|
|
14
|
+
"original": { "var": "x.target_number", "value": "2", "trigger": "parents.there_is_another" },
|
|
15
|
+
"var": "x.target_number", "value": "2", "trigger": "parents.there_is_another", times_used: 0,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"original": { "var": "x.target_number", "value": "3", "trigger": "users.there_is_another" },
|
|
19
|
+
"var": "x.target_number", "value": "3", "trigger": "users.there_is_another", times_used: 0,
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
// Same as input plus`.there_is_another` rows
|
|
23
|
+
special_rows.target_num_first_output = [ ...special_rows.target_num_first_input ];
|
|
24
|
+
special_rows.target_num_first_output.push({
|
|
25
|
+
"artificial": true, "source": special_rows.target_num_first_input[0],
|
|
26
|
+
"var": "x.there_is_another", "value": "True", "trigger": "parents.there_is_another",
|
|
27
|
+
});
|
|
28
|
+
special_rows.target_num_first_output.push( {
|
|
29
|
+
"artificial": true, "source": special_rows.target_num_first_input[1],
|
|
30
|
+
"var": "x.there_is_another", "value": "True", "trigger": "users.there_is_another",
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// 2nd press (Yes and No)
|
|
34
|
+
special_rows.target_num_half_way_input = [
|
|
35
|
+
{
|
|
36
|
+
"original": { "var": "x.target_number", "value": "2", "trigger": "parents.there_is_another" },
|
|
37
|
+
"var": "x.target_number", "value": "2", "trigger": "parents.there_is_another", times_used: 1,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"original": { "var": "x.target_number", "value": "3", "trigger": "users.there_is_another" },
|
|
41
|
+
"var": "x.target_number", "value": "3", "trigger": "users.there_is_another", times_used: 1,
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
// Same as input plus `.there_is_another` rows
|
|
45
|
+
special_rows.target_num_half_way_output = [ ...special_rows.target_num_half_way_input ];
|
|
46
|
+
special_rows.target_num_half_way_output.push({
|
|
47
|
+
"var": "x.there_is_another", "value": "False", "trigger": "parents.there_is_another",
|
|
48
|
+
"artificial": true, "source": special_rows.target_num_half_way_input[0],
|
|
49
|
+
});
|
|
50
|
+
special_rows.target_num_half_way_output.push( {
|
|
51
|
+
"var": "x.there_is_another", "value": "True", "trigger": "users.there_is_another",
|
|
52
|
+
"artificial": true, "source": special_rows.target_num_half_way_input[1],
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// 3rd press (No and No)
|
|
56
|
+
special_rows.target_num_last_input = [
|
|
57
|
+
{
|
|
58
|
+
"original": { "var": "x.target_number", "value": "2", "trigger": "parents.there_is_another" },
|
|
59
|
+
"var": "x.target_number", "value": "2", "trigger": "parents.there_is_another", times_used: 2,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"original": { "var": "x.target_number", "value": "3", "trigger": "users.there_is_another" },
|
|
63
|
+
"var": "x.target_number", "value": "3", "trigger": "users.there_is_another", times_used: 2,
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
// Same as input plus `.there_is_another` rows
|
|
67
|
+
special_rows.target_num_last_output = [ ...special_rows.target_num_last_input ];
|
|
68
|
+
special_rows.target_num_last_output.push({
|
|
69
|
+
"var": "x.there_is_another", "value": "False", "trigger": "parents.there_is_another",
|
|
70
|
+
"artificial": true, "source": special_rows.target_num_last_input[0],
|
|
71
|
+
});
|
|
72
|
+
special_rows.target_num_last_output.push( {
|
|
73
|
+
"var": "x.there_is_another", "value": "False", "trigger": "users.there_is_another",
|
|
74
|
+
"artificial": true, "source": special_rows.target_num_last_input[1],
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// trigger uses `.target_number`
|
|
78
|
+
// devs are supposed to use the right `trigger` name, but they might not
|
|
79
|
+
special_rows.target_number_trigger_input = [
|
|
80
|
+
{
|
|
81
|
+
"original": { "var": "x.target_number", "value": "2", "trigger": "parents.target_number" },
|
|
82
|
+
"var": "x.target_number", "value": "2", "trigger": "parents.target_number", times_used: 0,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"original": { "var": "x.target_number", "value": "3", "trigger": "users.target_number" },
|
|
86
|
+
"var": "x.target_number", "value": "3", "trigger": "users.target_number", times_used: 0,
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
// Same as input plus`.there_is_another` rows
|
|
90
|
+
special_rows.target_number_trigger_output = [ ...special_rows.target_number_trigger_input ];
|
|
91
|
+
special_rows.target_number_trigger_output.push({
|
|
92
|
+
"artificial": true, "source": special_rows.target_number_trigger_input[0],
|
|
93
|
+
"var": "x.there_is_another", "value": "True", "trigger": "parents.there_is_another",
|
|
94
|
+
});
|
|
95
|
+
special_rows.target_number_trigger_output.push( {
|
|
96
|
+
"artificial": true, "source": special_rows.target_number_trigger_input[1],
|
|
97
|
+
"var": "x.there_is_another", "value": "True", "trigger": "users.there_is_another",
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
module.exports = special_rows;
|